SA-MP Forums Archive
SendClientMessage only once - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: SendClientMessage only once (/showthread.php?tid=264073)



SendClientMessage only once - Tachibana - 24.06.2011

Hey guys I got a question, when player registers I want to do a SendClientMessage ONLY once when he registers and he is spawned so for sure it will be placed in OnPlayerSpawn I think, so I got something like this


pawn Код:
SendClientMessage(playerid, COLOR_YELLOW, "You have received a phone from SoftBank type /myphonenumber to check your number!");
Is it possible to make it show only once when player registers and gets spawned and when he relogs it wont show again?


Re: SendClientMessage only once - undeR. - 24.06.2011

Try under OnPlayerRegister to set that? :P


Re: SendClientMessage only once - Kitten - 24.06.2011

pawn Код:
new Herro = 0;
forward BukLao ( ) ;
public OnPlayerSpawn(playerid) {
     Herro = 1;
     if(Herro == 1 ) {
         SendClientMessage(playerid, COLOR_YELLOW, "You have received a phone from SoftBank type /myphonenumber to check your number!");
     }
     SetTimer("BukLao",1000,false);
     return 1;
}
public BukLao ( ) {
    Herro = 0;
}

EDIT: Fixed code



Re: SendClientMessage only once - Tachibana - 24.06.2011

Quote:
Originally Posted by Kitten
Посмотреть сообщение
pawn Код:
new Herro = 0;
forward BukLao ( ) ;
public OnPlayerSpawn(playerid) {
     Herro = 1;
     if(Herro == 1 ) {
         SendClientMessage(playerid, COLOR_YELLOW, "You have received a phone from SoftBank type /myphonenumber to check your number!");
     }
     SetTimer("BukLao",1000,false);
     return 1;
}
public BukLao ( ) {
    Herro = 0;
}

EDIT: Fixed code
It still sends the message to players when they relog but what I ment is it will send to them on a first spawn then it wont anymore (I bet u know that anyways ^^.)


Re: SendClientMessage only once - =WoR=Varth - 24.06.2011

Make a bool if they're already registered.


Re: SendClientMessage only once - Tachibana - 24.06.2011

I got it tho it shows a message when player does register in dialog it sends a message.

So he gets the message before he logs in... (which is not what I wanetd but I think I gotta go with it)