ClientMessage only once
#1

hi,
how to display a ClientMessage only once to a player? e.g. after he spawned?

regards.
Reply
#2

pawn Код:
public OnPlayerSpawn(playerid)
{
       SendClientMessage(playerid, 0xFFFFFFFF, "You have spawned!");
       return 1;
}
Reply
#3

haha,
i knew that before, but if this player dies he'll get this message again.
My question is how to show this message only once, on his first spawn only.
Reply
#4

pawn Код:
public OnPlayerRequestSpawn(playerid) // This is only when the player wants to spawn by clicking "SHIFT" at the skin selection screen.
{
       SendClientMessage(playerid, 0xFFFFFFFF, "You have spawned!");
       return 1;
}
Reply
#5

yeah,
but i have a cmd /class
This cmd allows u to change ur skin ingame, if u wish to change ur team for example
And then this message would appear again right?
Reply
#6

Quote:
Originally Posted by Biesmen
Посмотреть сообщение
pawn Код:
public OnPlayerRequestSpawn(playerid) // This is only when the player wants to spawn by clicking "SHIFT" at the skin selection screen.
{
       SendClientMessage(playerid, 0xFFFFFFFF, "You have spawned!");
       return 1;
}
That would send him a message even before he spawned. :P

Use PVars or variables
Reply
#7

yeah, i know that i have to do sth. with variables, but the problem is, i dont know how to do this
maybe u could give me a little example or a link to a thread or sth?

thx for ur answer btw
Reply
#8

Victious, if the spawn will succeed it will send this message at the same time he is spawning.

For BlackWolf, I tried to evade that variable idea.. But here you go.

At the top of your script:
pawn Код:
new IsSpawned[MAX_PLAYERS];
Then, at OnPlayerSpawn:
pawn Код:
public OnPlayerSpawn(playerid)
{
     if(IsSpawned[playerid] == 0)
     {
          SendClientMessage(playerid, COLOR_WHITE, "You have logged in!");
          IsSpawned[playerid] = 1;
          return 1;
      } else if(IsSpawned[playerid] == 1)
      {
          return 1;
      }
return 1;
}
at OnPlayerConnect:
pawn Код:
public OnPlayerConnect(playerid)
{
   IsLogged[playerid] = 0;
   return 1;
}
Reply
#9

Do it like this:

pawn Код:
#define GREEN   0x0000FFFF

OnPlayerSpawn(playerid)
{
    switch(GetPVarInt(playerid, "IsSpawned"))
    case 0:
    {
        SendClientMessage(playerid, GREEN, You have been succesfully spawned.);
        SetPVarInt(playerid, "IsSpawned", 1);
    }
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)