SA-MP Forums Archive
[HELP]Connection - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: [HELP]Connection (/showthread.php?tid=277203)



[HELP]Connection - TheBluec0de - 16.08.2011

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



Re: [HELP]Connection - grand.Theft.Otto - 16.08.2011

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


Re: [HELP]Connection - TheBluec0de - 16.08.2011

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


Re: [HELP]Connection - Kush - 16.08.2011

[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;




Re: [HELP]Connection - grand.Theft.Otto - 16.08.2011

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.


Re: [HELP]Connection - Badger(new) - 17.08.2011

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


Re: [HELP]Connection - MadeMan - 17.08.2011

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