Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #define FILTERSCRIPT
- #include <a_samp>
- #if defined FILTERSCRIPT
- new grenade;
- new trangr[MAX_PLAYERS];
- new Float:ox, Float:oy, Float:oz;
- new timer1;
- forward boom();
- #endif
- public OnFilterScriptExit()
- {
- KillTimer(timer1);
- return 1;
- }
- public OnPlayerConnect(playerid)
- {
- trangr[playerid] = 0;
- return 1;
- }
- public OnPlayerDisconnect(playerid, reason)
- {
- trangr[playerid] = 0;
- return 1;
- }
- public OnPlayerCommandText(playerid, cmdtext[])
- {
- if (strcmp("/mg", cmdtext, true, 10) == 0)
- {
- if(trangr[playerid] == 0)
- {
- trangr[playerid] = 1;
- SendClientMessage(playerid, 0x00FF00FF, "GTA IV Grenade Mode Activated");
- ShowPlayerDialog(playerid, 2756, DIALOG_STYLE_MSGBOX, "How to use", "{ff0000}If you have a grenade, press Y (if any buttons do not pressed (only Y))", "Ok", "");
- return 1;
- }
- else if(trangr[playerid] == 1)
- {
- trangr[playerid] = 0;
- SendClientMessage(playerid, 0xFF0000FF, "GTA IV Grenade Mode Deactivated");
- return 1;
- }
- }
- return 0;
- }
- public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
- {
- if(newkeys == KEY_YES)
- {
- if(IsPlayerInAnyVehicle(playerid))
- {
- if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
- {
- if(trangr[playerid] == 1)
- {
- new weapon,ammo;
- GetPlayerWeaponData(playerid, 8, weapon, ammo);
- if(weapon == 16)
- {
- if(ammo >= 1)
- {
- new Float:A, Float:x, Float:y, Float:z, veh;
- veh = GetPlayerVehicleID(playerid);
- GetVehicleZAngle(veh, A);
- if(A>=0 && A<45)
- {
- GetPlayerPos(playerid, x, y, z);
- grenade = CreateObject(342, x-1.4, y, z+0.8, 0, 90, 0, 0);
- MoveObject(grenade, x-5.0, y, z-1.2, 7, 0, 0, 0);
- SetPlayerAmmo(playerid, 16, ammo-1);
- }
- if(A>=45 && A<90)
- {
- GetPlayerPos(playerid, x, y, z);
- grenade = CreateObject(342, x-1.4, y-1.4, z+0.8, 0, 90, 0, 0);
- MoveObject(grenade, x-5.0, y-5.0, z-1.2, 7, 0, 0, 0);
- SetPlayerAmmo(playerid, 16, ammo-1);
- }
- if(A>=90 && A<135)
- {
- GetPlayerPos(playerid, x, y, z);
- grenade = CreateObject(342, x, y-1.4, z+0.8, 0, 90, 0, 0);
- MoveObject(grenade, x, y-5.0, z-1.2, 7, 0, 0, 0);
- SetPlayerAmmo(playerid, 16, ammo-1);
- }
- if(A>=135 && A<180)
- {
- GetPlayerPos(playerid, x, y, z);
- grenade = CreateObject(342, x+1.4, y-1.4, z+0.8, 0, 90, 0, 0);
- MoveObject(grenade, x+5.0, y-5.0, z-1.2, 7, 0, 0, 0);
- SetPlayerAmmo(playerid, 16, ammo-1);
- }
- if(A>=180 && A<225)
- {
- GetPlayerPos(playerid, x, y, z);
- grenade = CreateObject(342, x+1.4, y, z+0.8, 0, 90, 0, 0);
- MoveObject(grenade, x+5.0, y, z-1.2, 7, 0, 0, 0);
- SetPlayerAmmo(playerid, 16, ammo-1);
- }
- if(A>=225 && A<270)
- {
- GetPlayerPos(playerid, x, y, z);
- grenade = CreateObject(342, x+1.4, y+1.4, z+0.8, 0, 90, 0, 0);
- MoveObject(grenade, x+5.0, y+5.0, z-2, 7, 0, 0, 0);
- SetPlayerAmmo(playerid, 16, ammo-1);
- }
- if(A>=270 && A<315)
- {
- GetPlayerPos(playerid, x, y, z);
- grenade = CreateObject(342, x-1.4, y+1.4, z+0.8, 0, 90, 0, 0);
- MoveObject(grenade, x-5.0, y+5.0, z-1.2, 7, 0, 0, 0);
- SetPlayerAmmo(playerid, 16, ammo-1);
- }
- if(A>=315 && A<360)
- {
- GetPlayerPos(playerid, x, y, z);
- grenade = CreateObject(342, x-1.4, y+1.4, z+0.8, 0, 90, 0, 0);
- MoveObject(grenade, x-5.0, y+5.0, z-1.2, 7, 0, 0, 0);
- SetPlayerAmmo(playerid, 16, ammo-1);
- }
- timer1 = SetTimer("boom", 4000, false);
- }
- if(ammo == 0) SendClientMessage(playerid, 0xFF0000FF, "Where is grenade? Buy it now!");
- }
- else SendClientMessage(playerid, 0xFF0000FF, "Where is grenade? Buy it now!");
- }
- }
- }
- }
- return 1;
- }
- public boom()
- {
- GetObjectPos(grenade,ox,oy,oz);
- DestroyObject(grenade);
- CreateExplosion( ox,oy,oz, 2, 2.0);
- KillTimer(timer1);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement