Help with Teleport Messages and performing commands whilst dead
#1

Hello everyone, I've added teleport messages to my server for when a player teleports to a specific location. However, I've noticed in other servers, there is some kind of limit. This limit makes sure that if the command is repeated, the notification to show they have teleported doesn't always appear. I'm not entirely sure how this works but I have seen it in other servers and it is very helpful. Here's how my teleport messages look anyway:

PAWN Code:
Код:
GetPlayerName(playerid, name, sizeof(name));
format(string, sizeof(string), "(/sfb) %s teleported to San Fierro Beach", name);
The second thing I'm requesting help on in this topic, is how to disable commands whilst a player isn't spawned or isn't alive. As you can see in the picture below, I was still able to use the /sfb command and teleport there, even though I wasn't spawned.

Reply
#2

pawn Код:
CMD:sfb(playerid,params[])
{
    new usedtp[MAX_PLAYERS];
    if(gettime() - usedtp[playerid] > 120)
    {
        SendClientMessageToAll(-1, message);
        usedtp[playerid] = gettime();
    }
    return 1;
}
Something like this.
Reply
#3

I'm unsure what you meant by your first wish but I can help with second one.

First, you have to create a variable and change it when the player is dead. For example;

pawn Код:
new playerStatus[MAX_PLAYERS];

public OnPlayerDeath(playerid, killerid, reason)
{
         playerStatus[playerid] = 1;
}
And check if that variable equals 1 when the command is performed. If it is, simply deny the player by sending a client message that says "You are dead" or something like that.
Reply
#4

pawn Код:
CMD:sfb(playerid,params[])
{
  if (IsSpawned[playerid] == 0)
  }
     SendClientMessage(playerid,CHOOSE A COLOR,"You must be spawned in order to teleport."); //Would disable the player to teleport if he/she is dead/not spawned
     return 1;
/*REST OF YOUR DATA OVER HERE WITHOUT THE "/*"
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)