Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //---------------------Thanks to Everyone For Helping--------------" " '
- //---------------------Very Very Special Thanks to Southclaw------- " " '
- //----------------------------------------------------------------- " " '
- //------------------SA-MP Team/Slice,Y_Less,Incognito-------------- " " '
- //-----------------------------And all who helped------------------ " '
- //----------------------Thanks Twixx appreciate your testings------ " '
- //--------------------------------""""""--------------------------- " '
- //-------------------------------" "-------------------------- " '
- //------------------------------" "------------------------- " '
- //------------------------------" "------------------------- " '
- //------------------------------""""""""""------------------------- "
- //------------------Thanks to Everyone Helping SA-MP--------------- "
- //------------------------And Making Scripting easier-------------- "
- //------------------------Oh And me Too (Script)------------------- "
- //------------------------------------------------------------------------------
- #include <a_samp>
- new FireShot[MAX_PLAYERS];
- new gRocketObj[MAX_PLAYERS];
- public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
- {
- if(IsPlayerInAnyVehicle(playerid) && FireShot[playerid] == 0 && newkeys & 4 && !IsValidObject(gRocketObj[playerid])) // Only run the code if the object doesn't already exist, otherwise more objects will take up gRocketObj and the previous ones won't be deleted
- {
- SetPlayerTime(playerid,0,0);
- new
- vehicleid = GetPlayerVehicleID(playerid),
- Float:x,
- Float:y,
- Float:z,
- Float:r,
- Float:dist = 50.0,
- Float:tmpang,
- Float:tmpx,
- Float:tmpy,
- Float:tmpz;
- FireShot[playerid] = 1;
- SetTimerEx("ShotFire", 1000, 0, "i", playerid);
- GetVehiclePos(vehicleid, x, y, z);
- GetVehicleZAngle(vehicleid, r);
- new rand = random(11);
- switch(rand)
- {
- case 0: gRocketObj[playerid] = CreateObject(18647, x, y, z, 0, 0, r);
- case 1: gRocketObj[playerid] = CreateObject(18648, x, y, z, 0, 0, r);
- case 2: gRocketObj[playerid] = CreateObject(18649, x, y, z, 0, 0, r);
- case 3: gRocketObj[playerid] = CreateObject(18650, x, y, z, 0, 0, r);
- case 4: gRocketObj[playerid] = CreateObject(18651, x, y, z, 0, 0, r);
- case 5: gRocketObj[playerid] = CreateObject(18652, x, y, z, 0, 0, r);
- case 6: gRocketObj[playerid] = CreateObject(18647, x, y, z, 0, 0, r+90);
- case 7: gRocketObj[playerid] = CreateObject(18648, x, y, z, 0, 0, r+90);
- case 8: gRocketObj[playerid] = CreateObject(18649, x, y, z, 0, 0, r+90);
- case 9: gRocketObj[playerid] = CreateObject(18650, x, y, z, 0, 0, r+90);
- case 10: gRocketObj[playerid] = CreateObject(18651, x, y, z, 0, 0, r+90);
- case 11: gRocketObj[playerid] = CreateObject(18652, x, y, z, 0, 0, r+90);
- }
- //Thanks to Southclaw helped me alot
- for(new i;i<MAX_PLAYERS;i++)
- {
- if(i == playerid)continue;
- if(IsPlayerInRangeOfPoint(i, 50.0, x, y, z))
- {
- GetPlayerPos(i, tmpx, tmpy, tmpz);
- tmpang = (90-atan2(tmpy-y, tmpx-x));
- if(tmpang < 0)tmpang = 360.0+tmpang;
- tmpang = 360.0 - tmpang;
- if( floatabs(tmpang-r) < 5.0)
- {
- dist = GetPlayerDistanceFromPoint(i, x, y, z);
- }
- }
- }
- MoveObject(gRocketObj[playerid],x + (dist * floatsin(-r, degrees)),y + (dist * floatcos(-r, degrees)),z,100.0); // Nice and fast!
- }
- }
- forward ShotFire(playerid);
- public ShotFire(playerid)
- {
- FireShot[playerid] = 0;
- return 1;
- }
- public OnObjectMoved(objectid)
- {
- for(new i;i<MAX_PLAYERS;i++)
- {
- if(objectid == gRocketObj[i])
- {
- new
- Float:x,
- Float:y,
- Float:z;
- GetObjectPos(gRocketObj[i], x, y, z);
- CreateExplosion(x, y, z, 11, 3.0);
- DestroyObject(gRocketObj[i]);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement