[HELP]Connection
#1

What we do wrong?

undefinied symbol pname...

Код:
public OnPlayerConnect(playerid)
{
    format(string, sizeof(string), "%s (ID: %d) has joined the server!", playerid, Pname);
    SendClientMessageToAll(-1, string);
    
    SendDeathMessage(INVALID_PLAYER_ID, playerid, 200);
	return 1;
}
Код:
stock PlayerName(playerid)
{
	new Pname[24];
	GetPlayerName(playerid, Pname, 24);
	return Pname;
}
Reply
#2

In the format line, change Pname to PlayerName, because your stock gets people's names, Pname gets the name for PlayerName, which is the name of your stock. Sorry if I made it confusing
Reply
#3

error 076: syntax error in the expression, or invalid function call
Reply
#4

[QUOTE=TheBluec0de;1351532]What we do wrong?

undefinied symbol pname...

PHP код:
public OnPlayerConnect(playerid)
{
    new 
Pname[MAX_PLAYER_NAME];
    
format(stringsizeof(string), "%s (ID: %d) has joined the server!"playeridPname);
    
SendClientMessageToAll(-1string);
    
SendDeathMessage(INVALID_PLAYER_IDplayerid200);
    return 
1;

Reply
#5

Yes but he wanted to use the stock.

Anyway, its much more easier to do this:

pawn Код:
new pname[24];
GetPlayerName(playerid,pname,24);
Even though it is in-efficient and takes up more time.
Reply
#6

Try:
pawn Код:
public OnPlayerConnect(playerid)
{
    new string[128];
    format(string, sizeof(string), "%s (ID: %d) has joined the server!", GetPlayerName(playerid),playerid);
    SendClientMessageToAll(-1, string);

    SendDeathMessage(INVALID_PLAYER_ID, playerid, 200);
    return 1;
}
You used "pname" instead of GetPlayerName(playerid) in the format
You didn't declare "string" as a variable (from the code I saw)
#Edit And you put the values playerid and the player's name the wrong way around
Reply
#7

pawn Код:
public OnPlayerConnect(playerid)
{
    format(string, sizeof(string), "%s (ID: %d) has joined the server!", PlayerName(playerid), playerid);
    SendClientMessageToAll(-1, string);
   
    SendDeathMessage(INVALID_PLAYER_ID, playerid, 200);
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 5 Guest(s)