Bomb cp
#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)
	{
 		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;
}
Thanks.
Reply
#2

Quote:
Originally Posted by Face9000
Посмотреть сообщение
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;
}
Thanks.
You checked after planting the bomb.


You might want to check the AlreadyPlanting[playerid] == 1 and loop through all players and check if they're planting.
Reply
#3

Can you make me an example please?
Reply
#4

Quote:
Originally Posted by Face9000
Посмотреть сообщение
Can you make me an example please?
Of the loop?
PHP код:
for(new 0MAX_PLAYERSi++) { //foreach(new i : Player) or GetPlayerPool(); for better preformance
    
if(gTeam[i] == TEAM_TERRORISTS) {
        
AlreadyPlanting[i] = 1;
    }

Then you would change AlreadyPlanting[i] = 0; in the bomb explosion timer.
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)