Join messages
#1

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.
Reply
#2

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.
Reply
#3

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..
Reply
#4

https://sampwiki.blast.hk/wiki/Creating_...Leave_Messages
Reply
#5

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.
Reply
#6

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;
}
Reply
#7

Yea, thanks, I'll be starting now, testing it
Reply
#8

Ok np i did just edit it because i got it round the wrong way
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)