Join messages -
Kudoz - 24.01.2013
Hello again! I need help with some SendClientMessage on OnPlayerConnect and OnPlayerSpawn.
I have it like this, when a player is connecting to my server ( OnPlayerConnect )
Код:
.: ( Kudoz ) has Joined the server ( Joining ) :.
and like this, when a player spawns for the first time, ( OnPlayerSpawn )
Код:
.: ( Kudoz ) has Connected to the server ( Connected ) :.
The problem is that when a player dies, it says he's connected to the server again.. thats kinda obvious, cuz its although under OnPlayerSpawn. Anyways, how can I make it that it only says blah blah (connected ) when the player is actually connected, and not respawning? ..
Sincerely, Kudoz.
Re: Join messages -
B-Matt - 24.01.2013
pawn Код:
new string[64], name[MAX_PLAYER_NAME+1];
GetPlayerName(playerid, name, sizeof(name));
format(string, sizeof(string), ".: ( %s) has Joined the server ( Connected ) :.", name);
SendClientMessageToAll(-1, string);
- OnPlayerConnect
This will show message when player connect to the server.
Re: Join messages -
Kudoz - 24.01.2013
Alright, I think I have a clue. I have a dialog system, which is called OnPlayerConnect. What if I add the SCMToAll there? On the dialog respond or something?
EDIT: Post above:
Yea, I know how to make Join/leave messages, but I want it two ways, like when a player connects to the server, and when he's spawning. Thats why I'm thinking of trying to add it under the dialog respond thing..
Re: Join messages -
Glad2BeHere - 24.01.2013
https://sampwiki.blast.hk/wiki/Creating_...Leave_Messages
Re: Join messages -
Kudoz - 24.01.2013
That didn't help much. It doesn't say anything there about what I neep atm. Lemme check if it works first, then I'll come back to this thread.
Re: Join messages -
fubar - 24.01.2013
This is just a rough guess of my head,so it wont work,but it will give you an idea
Код:
public OnPlayerSpawn(playerid)
{
if (playerstate(playerid) == 1))//do a player enum,then if player has already spawned then it will bypass 'has Joined the server'
{
new string[64], name[MAX_PLAYER_NAME+1];
GetPlayerName(playerid, name, sizeof(name));
format(string, sizeof(string), ".: ( %s) has joined the server ( Connected ) :.", name);
SendClientMessageToAll(-1, string);
playerstate = 1;//sets the player state as spawned so it will bypass the connected message for next spawn
//blah
//blah
//do something important
}
else
//do spawny stuff here
return 1;
}
Re: Join messages -
Kudoz - 24.01.2013
Yea, thanks, I'll be starting now, testing it
Re: Join messages -
fubar - 24.01.2013
Ok np i did just edit it because i got it round the wrong way