Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Entering shamal as passenger v3.1 by BeckzyBoi. (13/05/2017). Requires SA-MP 0.3z R2-2 or later
- #include <a_samp>
- public OnFilterScriptInit()
- {
- print("---------------------------------------");
- print("Loaded 'Entering shamal as passenger'");
- print("v3.1 by BeckzyBoi. (13/05/2017)");
- print("---------------------------------------");
- return 1;
- }
- new sExplode[MAX_VEHICLES] = {-1, ...};
- new bool:tCount[MAX_VEHICLES];
- #define S_EXPLODE_X 2.4015
- #define S_EXPLODE_Y 29.2775
- #define S_EXPLODE_Z 1199.593
- #define S_EXPLODE_RANGE 13.4
- forward ExplodeShamal(vehicleid);
- GetPlayerShamalID(playerid)
- {
- return GetPlayerVirtualWorld(playerid) > cellmax-MAX_VEHICLES ? cellmax-GetPlayerVirtualWorld(playerid)+1 : 0;
- }
- public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
- {
- if (ispassenger != 0 && GetVehicleModel(vehicleid) == 519)
- {
- SetPlayerVirtualWorld(playerid, cellmax-(vehicleid-1));
- SetPlayerInterior(playerid, 1);
- SetPlayerPos(playerid, 3.839, 22.977, 1199.601);
- SetPlayerFacingAngle(playerid, 90.0);
- SetCameraBehindPlayer(playerid);
- }
- return 1;
- }
- public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
- {
- new vehicleid = GetPlayerShamalID(playerid);
- if (newkeys == 16 && vehicleid != 0)
- {
- new Float:x, Float:y, Float:z, Float:a;
- GetVehiclePos(vehicleid, x, y, z);
- GetVehicleZAngle(vehicleid, a);
- x += (5.0*floatsin(-(a-45.0), degrees));
- y += (5.0*floatcos(-(a-45.0), degrees));
- SetPlayerVirtualWorld(playerid, GetVehicleVirtualWorld(vehicleid));
- SetPlayerInterior(playerid, 0);
- SetPlayerPos(playerid, x, y, z-0.94);
- SetPlayerFacingAngle(playerid, a);
- }
- return 1;
- }
- public OnVehicleDeath(vehicleid, killerid)
- {
- if (GetVehicleModel(vehicleid) == 519)
- {
- for (new i = 0; i < MAX_PLAYERS; i++)
- {
- if (GetPlayerShamalID(i) == vehicleid)
- {
- SetPlayerHealth(i, 0.0);
- CreateExplosionForPlayer(i, S_EXPLODE_X, S_EXPLODE_Y, S_EXPLODE_Z, 2, S_EXPLODE_RANGE);
- }
- }
- if (sExplode[vehicleid-1] != -1)
- {
- KillTimer(sExplode[vehicleid-1]);
- }
- sExplode[vehicleid-1] = SetTimerEx("ExplodeShamal", 700, 0, "d", vehicleid);
- tCount[vehicleid-1] = true;
- }
- return 1;
- }
- public OnVehicleSpawn(vehicleid)
- {
- tCount[vehicleid-1] = false;
- return 1;
- }
- public ExplodeShamal(vehicleid)
- {
- KillTimer(sExplode[vehicleid-1]);
- if (tCount[vehicleid-1])
- {
- for (new i = 0; i < MAX_PLAYERS; i++)
- {
- if (GetPlayerShamalID(i) == vehicleid)
- {
- CreateExplosionForPlayer(i, S_EXPLODE_X, S_EXPLODE_Y, S_EXPLODE_Z, 2, S_EXPLODE_RANGE);
- }
- }
- sExplode[vehicleid-1] = SetTimerEx("ExplodeShamal", random(1300) + 100, 0, "d", vehicleid);
- }
- else
- {
- sExplode[vehicleid-1] = -1;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement