SA-MP Forums Archive
Arguments. - 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: Arguments. (/showthread.php?tid=599949)



Arguments. - LSNKevin - 01.02.2016

I've tried to find an solution but failed. Any help?

warning 202: number of arguments does not match definition

pawn Код:
SendClientMessage(playerid, COLOR_LIGHTRED, "[SERVER]: Please login, %s.", GetName(playerid));
pawn Код:
stock GetName(playerid)
{
    new pName[MAX_PLAYER_NAME];
    GetPlayerName(playerid, pName, sizeof(pName));
    return pName;
}



Re: Arguments. - radiobizza - 01.02.2016

try with this
PHP код:
stock GetName(playerid)
{
    new
    
name[24];
    
GetPlayerName(playeridnamesizeof(name));
    
strreplace(name'_'' ');
    return 
name;




Re: Arguments. - Cypress - 01.02.2016

You need to use format instead of SendClientMessage which doesn't support any arguments.

pawn Код:
new string[ MAX_PLAYER_NAME + 50 ];
format( string, sizeof( string ), "[SERVER]: Please login, %s.", GetName( playerid ) );
SendClientMessage( playerid, COLOR_LIGHTRED, string );
And if you need more help you can always check the wiki

https://sampwiki.blast.hk/wiki/Format


Re: Arguments. - LSNKevin - 01.02.2016

Quote:
Originally Posted by Cypress
Посмотреть сообщение
You need to use format instead of SendClientMessage which doesn't support any arguments.

pawn Код:
new string[ MAX_PLAYER_NAME + 50 ];
format( string, sizeof( string ), "[SERVER]: Please login, %s.", GetName( playerid ) );
SendClientMessage( playerid, COLOR_LIGHTRED, string );
And if you need more help you can always check the wiki

https://sampwiki.blast.hk/wiki/Format
Thank you man!