SA-MP Forums Archive
connect and exit command? - 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)
+--- Thread: connect and exit command? (/showthread.php?tid=459666)



connect and exit command? - Demon4511 - 24.08.2013

i want to know how to make a command that when a player connects it says "playerid just connected"
and "playerid just disconnected" but whenever i do this:

public OnPlayerConnect(playerid)
{
SendClientMessageToAll(0xFFFFFFFF, "playerid just connected!!!");
return 1;
}

public OnPlayerDisconnect(playerid, reason)
{
SendClientMessageToAll(0xFFFFFFFF, "playerid just disconnected!!!");
return 1;
}

it says "playerid" not there acctual id!!!
please help


Re: connect and exit command? - Tuntun - 24.08.2013

You have to use string and %s also %d


Re: connect and exit command? - Giroud12 - 24.08.2013

Which One?
pawn Код:
Player [ID] has connected
Or
pawn Код:
[Playername] has connected



Re: connect and exit command? - Demon4511 - 24.08.2013

Quote:
Originally Posted by Tuntun
Посмотреть сообщение
You have to use string and %s also %d
how would i do that? (sorry im not very good at this)

EDIT: how do i put code in box things?


Re: connect and exit command? - Giroud12 - 24.08.2013

pawn Код:
public OnPlayerConnect(playerid)
{
   new pname[MAX_PLAYER_NAME],str[128];
   GetPlayerName(playerid, pname, sizeof(pname));
   format(str,sizeof(str), "* %s just connected to the server *", pname);
   SendClientMessageToAll(/*yourcolourhere*/, str);
   return 1;
}



Re: connect and exit command? - Demon4511 - 24.08.2013

public OnPlayerConnect(playerid)
{
new pname[MAX_PLAYER_NAME],str[128];
GetPlayerName(playerid, pname, sizeof(pname));
format(str,sizeof(str), "* %s just connected to the server *", pname);
SendClientMessageToAll("00C940", str);
return 1;
}

public OnPlayerDisconnect(playerid, reason)
{
new pname[MAX_PLAYER_NAME],str[128];
GetPlayerName(playerid, pname, sizeof(pname));
format(str,sizeof(str), "* %s just disconnected to the server *", pname);
SendClientMessageToAll("00C940", str);
return 1;
}


this doesent work


Re: connect and exit command? - Giroud12 - 24.08.2013

pawn Код:
#include <a_samp>
#define BLUE  0x0000FFFF

public OnPlayerConnect(playerid)
{
new pname[MAX_PLAYER_NAME],str[128];
GetPlayerName(playerid, pname, sizeof(pname));
format(str,sizeof(str), "* %s just connected to the server *", pname);
SendClientMessageToAll(BLUE, str);
return 1;
}

public OnPlayerDisconnect(playerid, reason)
{
new pname[MAX_PLAYER_NAME],str[128];
GetPlayerName(playerid, pname, sizeof(pname));
format(str,sizeof(str), "* %s just disconnected to the server *", pname);
SendClientMessageToAll(BLUE, str);
return 1;
}



Re: connect and exit command? - Demon4511 - 24.08.2013

sorry to bother you again but i get

error 017: undefined symbol "BLUE"


Re: connect and exit command? - Demon4511 - 24.08.2013

and also would i be able to do the same when someone dies?


Re: connect and exit command? - Giroud12 - 24.08.2013

Yup