public OnPlayerEnterCheckpoint(playerid)
{
if(gTeam[playerid] == TEAM_DEFENDERS)
{
GameTextForPlayer(playerid,"~w~Defend this bomb checkpoint from ~b~terrorists!",5000,4);
}
else if(gTeam[playerid] == TEAM_TERRORISTS)
{
new name[MAX_PLAYER_NAME], string[128];
GetPlayerName(playerid, name, sizeof(name));
format(string, sizeof(string), "~r~%s ~w~will plant the ~r~bomb ~w~in 15 seconds!",name);
GameTextForAll(string,5000,4);
BombTimer = SetTimer("Explode",15000,false);
AlreadyPlanting[playerid] = 1;
if(AlreadyPlanting[playerid] == 1)
{
SendClientMessage(playerid, -1, "* Someone is already planting the {F2C80C}bomb, {FFFFFF}please wait.");
return 0;
}
if(Planted[playerid] == 1)
{
SendClientMessage(playerid, -1, "* The {F2C80C}bomb {FFFFFF}has been planted already and it will explode soon.");
return 0;
}
}
return 1;
}
|
Can someone tell me why if i enter the checkpoint i get the message: "Someone is already planting the bomb" but i can plant it however?
Код:
public OnPlayerEnterCheckpoint(playerid)
{
if(gTeam[playerid] == TEAM_DEFENDERS)
{
GameTextForPlayer(playerid,"~w~Defend this bomb checkpoint from ~b~terrorists!",5000,4);
}
else if(gTeam[playerid] == TEAM_TERRORISTS)
{
if(AlreadyPlanting[playerid] == 1)
{
SendClientMessage(playerid, -1, "* Someone is already planting the {F2C80C}bomb, {FFFFFF}please wait.");
return 0;
}
if(Planted[playerid] == 1)
{
SendClientMessage(playerid, -1, "* The {F2C80C}bomb {FFFFFF}has been planted already and it will explode soon.");
return 0;
}
new name[MAX_PLAYER_NAME], string[128];
GetPlayerName(playerid, name, sizeof(name));
format(string, sizeof(string), "~r~%s ~w~will plant the ~r~bomb ~w~in 15 seconds!",name);
GameTextForAll(string,5000,4);
BombTimer = SetTimer("Explode",15000,false);
AlreadyPlanting[playerid] = 1;
}
return 1;
}
|
for(new i = 0; i < MAX_PLAYERS; i++) { //foreach(new i : Player) or GetPlayerPool(); for better preformance
if(gTeam[i] == TEAM_TERRORISTS) {
AlreadyPlanting[i] = 1;
}
}