Checkpoint problem
#1

Hello guys!
I wanted to make something like this. A player has entered the checkpoint, then if another player enter it, it will automaticly send a message to the second player like "Another player is already in the checkpoint!".
Well, can you guys tell me what should I do? I already searched for it on ****** and found nothing.
Help plox, thanks.
Reply
#2

pawn Код:
//Top of script:
new InCheckpoint[MAX_PLAYERS]=0;
//...
public OnPlayerEnterCheckpoint(playerid)
{
    if(InCheckpoint[playerid] == 0)
    {
        for(new i = 0; i < MAX_PLAYERS; i++)
        {
            if(InCheckpoint[i] == 1)
            {
                SendClientMessage(playerid,-1,"Someone has already entered the checkpoint !");
                return 1;
            }
        }
        InCheckpoint[playerid] = 1;
    }
    return 1;
}
Reply
#3

Thanks
Reply
#4

Oh btw, I'm trying to make something like this. There are 2 teams, Player 1 & Player 2 is in Red team. The objective of the Red team is to rob the bank. It takes 6 seconds for the Red team members to be in the checkpoint for the rob to be success.

This is the situation, if player 1 is in the checkpoint, the robbing timer will run like normal , and if player 2 enter the checkpoint, it will automaticly send Player 2 a message, "Another player is already robbing the bank!" and Player 2 can't rob the bank(kill the timer for player 2 only) unless Player 1 leave the checkpoint.

This is my some of script:

Код:
public OnPlayerEnterCheckpoint(playerid)
{
	new playername [MAX_PLAYER_NAME];
	GetPlayerName (playerid, playername, sizeof(playername));
  	if(gTeam[playerid] == TEAM_RED)
 	{
	new newtext[60], name[MAX_PLAYER_NAME];
        GetPlayerName(playerid, name, MAX_PLAYER_NAME);
        format(newtext, sizeof(newtext), "%s is now robbing the bank.", playername);
        SendClientMessageToAll(RED, newtext);
        BlowTimer = SetTimerEx("bombcountupdate", 6000, false, "i", playerid);
	}
    return 1;
}
/* ----------------------------------------------------------------------------------- */
public OnPlayerLeaveCheckpoint(playerid)
{
	new playername [MAX_PLAYER_NAME];
	GetPlayerName (playerid, playername, sizeof(playername));
  	if(gTeam[playerid] == TEAM_RED)
 	{
	new newtext[60], name[MAX_PLAYER_NAME];
        GetPlayerName(playerid, name, MAX_PLAYER_NAME);
        format(newtext, sizeof(newtext), "%s has stopped robbing the bank.", playername);
        SendClientMessageToAll(RED, newtext);
	KillTimer(BlowTimer);
	}
    return 1;
}
Hope that someone will help me with this thing.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)