connect and exit command?
#1

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

You have to use string and %s also %d
Reply
#3

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

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?
Reply
#5

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

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

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

sorry to bother you again but i get

error 017: undefined symbol "BLUE"
Reply
#9

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

Yup
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)