Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <a_samp>
- #include <zcmd>
- #include <streamer>
- #define FILTERSCRIPT
- new c4[MAX_PLAYERS];
- new c4o[11][MAX_PLAYERS];
- new Float:c4posx[11][MAX_PLAYERS];
- new Float:c4posy[11][MAX_PLAYERS];
- new Float:c4posz[11][MAX_PLAYERS];
- public OnFilterScriptInit()
- {
- print("\n--------------------------------------");
- print("C4 System by _Mohit_ Loaded");
- print("--------------------------------------\n");
- return 1;
- }
- public OnFilterScriptExit()
- {
- print("\n--------------------------------------");
- print("C4 System by _Mohit_ UnLoaded");
- print("--------------------------------------\n");
- return 1;
- }
- public OnPlayerConnect(playerid)
- {
- ApplyAnimation(playerid,"BOMBER","null",0,0,0,0,0,0,0); //This is to preload the animation Liberary
- for(new i;i < 11;i++)
- {
- c4posx[i][playerid] = 9999;
- c4posy[i][playerid] = 9999;
- c4posz[i][playerid] = 9999;
- }
- c4[playerid] = 0;
- return 1;
- }
- public OnPlayerDisconnect(playerid, reason)
- {
- for(new i;i < 11;i++)
- {
- c4posx[i][playerid] = 9999;
- c4posy[i][playerid] = 9999;
- c4posz[i][playerid] = 9999;
- DestroyDynamicObject(c4o[i][playerid]);
- }
- c4[playerid] = 0;
- return 1;
- }
- CMD:plantc4(playerid,params[])
- {
- if(IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid,-1,"Error:- You cannot plant a C4 while in a vehicle!!");
- if(c4[playerid] == 10) return SendClientMessage(playerid,-1,"Error:- You can only plant 10 C4's at a time!");
- new i;
- c4[playerid] ++;
- i = c4[playerid];
- new Float:x,Float:y,Float:z;
- GetPlayerPos(playerid,x,y,z);
- c4posx[i][playerid] = x;
- c4posy[i][playerid] = y;
- c4posz[i][playerid] = z;
- ApplyAnimation(playerid,"BOMBER","BOM_Plant",4.1,0,1,1,0,0,1);
- SendClientMessage(playerid,-1,"C4 has been succesfully planted.Press ` ~k~~SNEAK_ABOUT~ ` key to explode it.");
- c4o[i][playerid] = CreateDynamicObject(363,x,y,z-0.9,-90,0,0,-1,-1,-1,200);
- return 1;
- }
- public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
- {
- if(newkeys == KEY_WALK)
- {
- if(c4[playerid] != 0)
- {
- for(new i; i < 11;i++)
- {
- if(c4posx[i][playerid] != 9999 && c4posy[i][playerid] != 9999 && c4posz[i][playerid] != 9999)
- {
- CreateExplosion(c4posx[i][playerid],c4posy[i][playerid],c4posz[i][playerid],3,3);
- DestroyDynamicObject(c4o[i][playerid]);
- c4posx[i][playerid] = 9999;
- c4posy[i][playerid] = 9999;
- c4posz[i][playerid] = 9999;
- }
- }
- c4[playerid] = 0;
- }
- }
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement