Big Problem Help
#1

why now cops can plantbomb - only for terrorists
and why cops can't defuse bomb - only cops no for terrorists

Код:
#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,1820.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(gTeam[playerid] == T1) return SendClientMessage(playerid,COLOR_RED,"Only the cops can defuse the bomb, your job is to plant it!");
if(!IsPlayerInRangeOfPoint(playerid,2.0,212.9239,1820.3402,6.4216)) return SendClientMessage(playerid,COLOR_RED,"You are not in the place for defusing");
if(PlantedBomb[T1] == 0) return SendClientMessage(playerid,COLOR_RED,"The bomb is not planted!");
SendClientMessage(playerid,COLOR_BLUE,"You are defusing a bomg, please wait.");
SetTimer("Defusion",10000,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;
}
Reply
#2

try this
pawn Код:
if(gTeam[playerid] != T1) return SendClientMessage(playerid,COLOR_RED,"Only the terrorists can plant the bomb!");

if(gTeam[playerid] != C1) return SendClientMessage(playerid,COLOR_RED,"Only the cops can defuse the bomb, your job is to plant it!");
Reply
#3

Quote:
Originally Posted by 1fret
Посмотреть сообщение
try this
pawn Код:
if(gTeam[playerid] != T1) return SendClientMessage(playerid,COLOR_RED,"Only the terrorists can plant the bomb!");

if(gTeam[playerid] != C1) return SendClientMessage(playerid,COLOR_RED,"Only the cops can defuse the bomb, your job is to plant it!");
now cops can plant and defuse can't and terrorists and cops

i want defuse only for cops
plant only for terrorists
Reply
#4

Quote:
Originally Posted by Mijata
Посмотреть сообщение
now cops can plant and defuse can't and terrorists and cops

i want defuse only for cops
plant only for terrorists
did you even set the players to a team?
Reply
#5

yes i have gamemode for this fs

but i don't know what is problem
Reply
#6

i fixed it but now is problem with /defusebomb command look and help now cops can't defuse bomb
Quote:

#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 (gTeam[playerid] == C1) return SendClientMessage (playerid, -1, "Only terrorists can plant bomb");
if (!IsPlayerInRangeOfPoint(playerid,2.0,212.9239,182 0.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!");
PlantedBomb [T1] ++;
GameTextForAll("~r~Bomb has been planted!",3000,5);
SetTimer("Explosion",300000,0);
}

if (strcmp("/defusebomb", cmdtext, true, 10) == 0)
{
if (gTeam[playerid] == C1)
{
if (IsPlayerInRangeOfPoint(playerid,2.0,213.3134,1825 .4974,6.4141))
if (PlantedBomb[T1] == 0) return SendClientMessage(playerid,COLOR_RED,"The bomb is not planted!");
SendClientMessage(playerid,COLOR_BLUE,"You are defusing a bomg, please wait.");
SetTimer("Defusion",10000,0);
}
else
{
SendClientMessage (playerid, -1, "Only cops can defuse");
}
}
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;
}

Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)