PDA

View Full Version : /Defuse problem help


Mijata
10/01/2015, 12:47 AM
i don't know now how to create /defusebomb command only for cops

#include <a_samp>

#define T1 0
#define C1 1

#define COLOR_RED 0xFF0000AA
#define COLOR_BLUE 0x0000BBAA
#define SCM

new gTeam[MAX_PLAYERS];
new PlantedBomb[MAX_PLAYERS];

public OnGameModeInit()
{
return 1;
}

public OnGameModeExit()
{
return 1;
}

public OnPlayerRequestClass(playerid, classid)
{
return 1;
}

public OnPlayerConnect(playerid)
{
return 1;
}

public OnPlayerDisconnect(playerid, reason)
{
return 1;
}

public OnPlayerSpawn(playerid)
{
return 1;
}

public OnPlayerDeath(playerid, killerid, reason)
{
return 1;
}

public OnVehicleSpawn(vehicleid)
{
return 1;
}

public OnVehicleDeath(vehicleid, killerid)
{
return 1;
}

public OnPlayerText(playerid, text[])
{
return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp("/plantbomb", cmdtext, true, 10) == 0)
{
if(!IsPlayerInRangeOfPoint(playerid,2.0,212.9239,1 820.3402,6.4216)) return SendClientMessage(playerid,COLOR_RED,"You are not in the place for planting the bomb");
if(PlantedBomb[T1] == 1) return SendClientMessage(playerid,COLOR_RED,"The bomb is already planted!");
if(gTeam[playerid] == C1) return SendClientMessage(playerid,COLOR_RED,"Only the terrorists can plant the bomb!");
PlantedBomb [T1] ++;
GameTextForAll("~r~Bomb has been planted!",3000,5);
SetTimer("Explosion",300000,0);
}

if (strcmp("/defusebomb", cmdtext, true, 10) == 0)
{
if(!IsPlayerInRangeOfPoint(playerid,2.0,212.9239,1 820.3402,6.4216)) return SendClientMessage(playerid,COLOR_RED,"You are not in the place for planting the bomb");
if(PlantedBomb[T1] == 1) return SendClientMessage(playerid,COLOR_RED,"The bomb is already planted!");
if(gTeam[playerid] == C1) return SendClientMessage(playerid,COLOR_RED,"Only the terrorists can plant the bomb!");
PlantedBomb [T1] ++;
GameTextForAll("~r~Bomb has been planted!",3000,5);
SetTimer("Explosion",300000,0);
}


return 0;
}
forward Explosion(playerid);
public Explosion(playerid)
{
GameTextForAll("~r~Bomb exploded",3000,5);
CreateExplosion(212.9239,1820.3402,6.4216,12,20.0) ;
GivePlayerMoney(playerid,10000);
SetPlayerScore(playerid, GetPlayerScore(playerid) + 5);
return 1;
}
forward Defusion(playerid);
public Defusion(playerid)
{
KillTimer(0);
GameTextForAll("~b~Bomb defused",3000,5);
GivePlayerMoney(playerid,10000);
SetPlayerScore(playerid, GetPlayerScore(playerid) + 5);
return 1;
}
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
return 1;
}

public OnPlayerExitVehicle(playerid, vehicleid)
{
return 1;
}

public OnPlayerStateChange(playerid, newstate, oldstate)
{
return 1;
}

public OnPlayerEnterCheckpoint(playerid)
{
return 1;
}

public OnPlayerLeaveCheckpoint(playerid)
{
return 1;
}

public OnPlayerEnterRaceCheckpoint(playerid)
{
return 1;
}

public OnPlayerLeaveRaceCheckpoint(playerid)
{
return 1;
}

public OnRconCommand(cmd[])
{
return 1;
}

public OnPlayerRequestSpawn(playerid)
{
return 1;
}

public OnObjectMoved(objectid)
{
return 1;
}

public OnPlayerObjectMoved(playerid, objectid)
{
return 1;
}

public OnPlayerPickUpPickup(playerid, pickupid)
{
return 1;
}

public OnVehicleMod(playerid, vehicleid, componentid)
{
return 1;
}

public OnVehiclePaintjob(playerid, vehicleid, paintjobid)
{
return 1;
}

public OnVehicleRespray(playerid, vehicleid, color1, color2)
{
return 1;
}

public OnPlayerSelectedMenuRow(playerid, row)
{
return 1;
}

public OnPlayerExitedMenu(playerid)
{
return 1;
}

public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)
{
return 1;
}

public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
return 1;
}

public OnRconLoginAttempt(ip[], password[], success)
{
return 1;
}

public OnPlayerUpdate(playerid)
{
return 1;
}

public OnPlayerStreamIn(playerid, forplayerid)
{
return 1;
}

public OnPlayerStreamOut(playerid, forplayerid)
{
return 1;
}

public OnVehicleStreamIn(vehicleid, forplayerid)
{
return 1;
}

public OnVehicleStreamOut(vehicleid, forplayerid)
{
return 1;
}

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
return 1;
}

public OnPlayerClickPlayer(playerid, clickedplayerid, source)
{
return 1;
}

RayC
10/01/2015, 12:52 AM
Just use this same line
if(gTeam[playerid] == C1) return SendClientMessage(playerid,COLOR_RED,"Only the terrorists can plant the bomb!");

but for the cop team, do you have a cop team set out already? For instance, gTeam[playerid] == C1 will be the opposing team I'm guessing?

Mijata
10/01/2015, 12:57 AM
yes will be opposing team but i want /defusebomb command only for cops
and +5 score and 10k for player who defuse

Mijata
10/01/2015, 01:07 AM
you will help?

RayC
10/01/2015, 01:12 AM
You have to create your teams properly..
http://forum.sa-mp.com/showthread.php?t=418054

Mijata
10/01/2015, 01:16 AM
man i have gamemode it is only fs for gamemode