open.mp forum
[Filterscript] Shoot fireballs script - Printable Version

+- open.mp forum (https://forum.open.mp)
+-- Forum: SA-MP (https://forum.open.mp/forumdisplay.php?fid=3)
+--- Forum: Releases (https://forum.open.mp/forumdisplay.php?fid=13)
+---- Forum: Filterscripts (https://forum.open.mp/forumdisplay.php?fid=30)
+---- Thread: [Filterscript] Shoot fireballs script (/showthread.php?tid=148)



Shoot fireballs script - dignity - 2019-04-14

Really old filterscript I released back when I was a weeb



PHP Code:
#include <a_samp> #include <zcmd> #define PRESSED(%0) (((newkeys & (%0)) == (%0)) && ((oldkeys & (%0)) != (%0))) stock IsPlayerAiming(playerid, aimid) { ? ? ? ?new Float:X1, Float:Y1, Float:Z1, Float:X2, Float:Y2, Float:Z2; ? ? ? ?GetPlayerPos(playerid, X1, Y1, Z1); ? ? ? ?GetPlayerPos(aimid, X2, Y2, Z2); ? ? ? ?new Float:Distance = floatsqroot(floatpower(floatabs(X1-X2), 2) floatpower(floatabs(Y1-Y2), 2)); ? ? ? ?if(Distance < 100) ? ? ? ?{ ? ? ? ? ? ? ? ?new Float:A; ? ? ? ? ? ? ? ?GetPlayerFacingAngle(playerid, A); ? ? ? ? ? ? ? ?X1 = (Distance * floatsin(-A, degrees)); ? ? ? ? ? ? ? ?Y1 = (Distance * floatcos(-A, degrees)); ? ? ? ? ? ? ? ?Distance = floatsqroot(floatpower(floatabs(X1-X2), 2) floatpower(floatabs(Y1-Y2), 2)); ? ? ? ? ? ? ? ?if(Distance < 0.5) ? ? ? ? ? ? ? ?{ ? ? ? ? ? ? ? ? ? ?return true; ? ? ? ? ? ? ? ?} ? ? ? ?} ? ? ? ?return false; } stock IsPlayerLookingAtPlayer(player1, player2) { // Simon edited by Carlton ? ? ? ?if (!IsPlayerConnected(player1) || !IsPlayerConnected(player2)) return 0; ? ? ? ?if(player1 == player2) return 0; ? ? ? ?new ? ? ? ? ? ? ? ?Float: distance, ? ? ? ? ? ? ? ?Float: vectorX, ? ? ? ? ? ? ? ?Float: vectorY, ? ? ? ? ? ? ? ?Float: vectorZ, ? ? ? ? ? ? ? ?Float: plyrPos[2][3], ? ? ? ? ? ? ? ?Float: projPos[3]; ? ? ? ?GetPlayerCameraFrontVector(player1, vectorX, vectorY, vectorZ); ? ? ? ?GetPlayerCameraPos(player1, plyrPos[0][0], plyrPos[0][1], plyrPos[0][2]); ? ? ? ?GetPlayerPos(player2, plyrPos[1][0], plyrPos[1][1], plyrPos[1][2]); ? ? ? ?#define SQUARE(%1) ?((%1)*(%1)) ? ? ? ?distance = floatsqroot( ? ? ? ?SQUARE(plyrPos[1][0]-plyrPos[0][0]) SQUARE(plyrPos[1][1]-plyrPos[0][1]) SQUARE(plyrPos[1][2]-plyrPos[0][2])); ? ? ? ?projPos[0] = plyrPos[0][0] vectorX * distance; ? ? ? ?projPos[1] = plyrPos[0][1] vectorY * distance; ? ? ? ?projPos[2] = plyrPos[0][2] vectorZ * distance; ? ? ? ?return ((SQUARE(plyrPos[1][0]-projPos[0]) SQUARE(plyrPos[1][1]-projPos[1]) SQUARE(plyrPos[1][2]-projPos[2])) <= SQUARE(distance / 6)); ? ? ? ?#undef SQUARE } CMD:fireballs(playerid, params[]) { ? ?if( !GetPVarInt(playerid, "FIREBALLS") ) SetPVarInt(playerid, "FIREBALLS", 1), SendClientMessage(playerid, -1, "Fireballs turned on."); ? ?else SetPVarInt(playerid, "FIREBALLS", 0), SendClientMessage(playerid, -1, "Fireballs turned off."); ? ?return 1; } public OnObjectMoved(objectid) { ? ?for( new i = 0; i < MAX_PLAYERS; i) ? ?{ ? ? ? ?if( objectid == GetPVarInt(i, "FIREOBJID") ) ? ? ? ?{ ? ? ? ? ? ?DestroyObject( GetPVarInt(i, "FIREOBJID") ); ? ? ? ? ? ?DeletePVar(i, "FIREOBJID"); ? ? ? ? ? ?CreateExplosion( GetPVarFloat(i, "FIREBALLX"), GetPVarFloat(i, "FIREBALLY"), GetPVarFloat(i, "FIREBALLZ"), 11, 7.5); ? ? ? ?} ? ?} } public OnPlayerKeyStateChange(playerid, newkeys, oldkeys) { ? ?if (GetPVarInt(playerid, "FIREBALLS") && PRESSED(KEY_FIRE)) ? ?{ ? ? ? ?new Float:posX, Float:posY, Float:posZ; ? ? ? ?for(new i = 0; i < MAX_PLAYERS; i) ? ? ? ?{ ? ? ? ? ? ?GetPlayerPos(i,posX,posY,posZ); ? ? ? ? ? ?if (i == playerid) continue; ? ? ? ? ? ?if(IsPlayerLookingAtPlayer(playerid, i) && IsPlayerAiming(playerid, i) && !IsPlayerInAnyVehicle(playerid) && !IsPlayerInAnyVehicle(i)) ? ? ? ? ? ?{ ? ? ? ? ? ? ? ?if( GetPVarInt(playerid, "FIREOBJID") != 0 ) return SendClientMessage(playerid, -1, "1 at a time!"); ? ? ? ? ? ? ? ?new str[100]; ? ? ? ? ? ? ? ?new nom[32]; ? ? ? ? ? ? ? ?GetPlayerName(i, nom, 32); ? ? ? ? ? ? ? ?format(str, 100, "You fireballed %s.", nom); ? ? ? ? ? ? ? ?SendClientMessage(playerid, -1, str); ? ? ? ? ? ? ? ?new Float:px, Float:py, Float:pz; ? ? ? ? ? ? ? ?GetPlayerPos(playerid, px, py, pz); ? ? ? ? ? ? ? ?SetPVarInt(playerid, "FIREOBJID", CreateObject(18688, px, py, pz-1.35, 0, 0, 0, 500.0)); ? ? ? ? ? ? ? ?GetPlayerPos(i, px, py, pz); ? ? ? ? ? ? ? ?SetPVarFloat(playerid, "FIREBALLX", px); ? ? ? ? ? ? ? ?SetPVarFloat(playerid, "FIREBALLY", py); ? ? ? ? ? ? ? ?SetPVarFloat(playerid, "FIREBALLZ", pz); ? ? ? ? ? ? ? ?MoveObject(GetPVarInt(playerid, "FIREOBJID"), px, py, pz-1.5, 15); ? ? ? ? ? ?} ? ? ? ?} ? ?} ? ?return 1; }



[Video: https://www.youtube.com/watch?v=BK7p5WafeRE&]


RE: Shoot fireballs script - Mugsy - 2019-04-14

lol what, dragon ball


RE: Shoot fireballs script - Rocky Balboa - 2019-04-14

Wow nice!


RE: Shoot fireballs script - Marg - 2019-04-15

?___________|Good job|__________?


RE: Shoot fireballs script - Wolf - 2019-04-18

Lol okay..


RE: Shoot fireballs script - s1cky - 2019-04-21

hahaha kame kame ha!