Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**//**//**//**//**//**//**//**//**/
- /*+--------------------------------+*/
- /*| |*/
- /*| C4 SYSTEM |*/
- /*| FILTERSCRIPT |*/
- /*| bY PSPgamer/FoxHound |*/
- /*| 2 0 0 9 |*/
- /*| |*/
- /*+--------------------------------+*/
- /*| 21 Januar 2010 |*/
- /*+--------------------------------+*/
- /**//**//**//**//**//**//**//**//**/
- #include <a_samp>
- #define MAX_BOMBS 3
- new pBombStatus[MAX_PLAYERS];
- new pPlacedBomb[MAX_PLAYERS];
- new BombObject[MAX_PLAYERS][MAX_BOMBS+1];
- new PlaceBombFunc[MAX_PLAYERS];
- new PlaceBombTimer[MAX_PLAYERS];
- public OnPlayerConnect(playerid)
- {
- pBombStatus[playerid] = 0;
- pPlacedBomb[playerid] = 0;
- PlaceBombFunc[playerid] = 0;
- return 1;
- }
- public OnPlayerDisconnect(playerid, reason)
- {
- DestroyBombsFromPlayer(playerid);
- return 1;
- }
- public OnPlayerDeath(playerid, killerid, reason)
- {
- DestroyBombsFromPlayer(playerid);
- return 1;
- }
- public OnPlayerCommandText(playerid, cmdtext[])
- {
- if(strcmp(cmdtext,"/c4",true) == 0)
- {
- if(PlaceBombFunc[playerid] == 0)
- {
- if(pBombStatus[playerid] < MAX_BOMBS)
- {
- new Float:x,Float:y,Float:z;
- GetPlayerPos(playerid,x,y,z);
- for(new i=0;i<MAX_PLAYERS;i++) { PlayerPlaySound(i,1055,x,y,z-0.85); }
- pBombStatus[playerid] += 1;
- TogglePlayerControllable(playerid, 0);
- ApplyAnimation(playerid, "BOMBER", "BOM_Plant", 4.0, 0, 0, 0, 0, 2000);
- PlaceBombFunc[playerid] = 1;
- PlaceBombTimer[playerid] = SetTimerEx("PlaceBomb",500,1,"u",playerid);
- pPlacedBomb[playerid] = 1;
- }
- return 1;
- }
- }
- return 0;
- }
- public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
- {
- if(newkeys == KEY_FIRE)
- {
- if(GetPlayerWeapon(playerid) == 0 || GetPlayerWeapon(playerid) == 4)
- {
- if(pPlacedBomb[playerid] == 1)
- {
- if(PlaceBombFunc[playerid] == 0)
- {
- new Float:x,Float:y,Float:z;
- GetObjectPos(BombObject[playerid][pBombStatus[playerid]],x,y,z);
- for(new i=0;i<MAX_PLAYERS;i++) { PlayerPlaySound(i,1055,x,y,z); }
- CreateExplosion(x,y,z,1,10.0);
- DestroyObject(BombObject[playerid][pBombStatus[playerid]]);
- pBombStatus[playerid] -= 1;
- }
- }
- }
- }
- return 1;
- }
- public OnPlayerUpdate(playerid)
- {
- if(pBombStatus[playerid] == 0) { pPlacedBomb[playerid] = 0; }
- return 1;
- }
- forward DestroyBombsFromPlayer(playerid);
- public DestroyBombsFromPlayer(playerid)
- {
- if(pBombStatus[playerid] > 0)
- {
- for(new i = 0; i<MAX_BOMBS+1; i++)
- {
- DestroyObject(BombObject[playerid][i]);
- }
- }
- pPlacedBomb[playerid] = 0;
- pBombStatus[playerid] = 0;
- return 1;
- }
- forward PlaceBomb(playerid);
- public PlaceBomb(playerid)
- {
- PlaceBombFunc[playerid] += 1;
- if(PlaceBombFunc[playerid] == 4)
- {
- new Float:x,Float:y,Float:z;
- GetPlayerPos(playerid,x,y,z);
- BombObject[playerid][pBombStatus[playerid]] = CreateObject(2742,x,y,z-0.90,270.0,0.0,0.0);
- }
- if(PlaceBombFunc[playerid] == 5)
- {
- KillTimer(PlaceBombTimer[playerid]);
- PlaceBombFunc[playerid] = 0;
- TogglePlayerControllable(playerid, 1);
- }
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement