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



Small Help - MrFantasy - 07.06.2017

Code:
public OnPlayerCommandPerformed(cmdid, playerid, cmdtext[], success)
{
	if(!success) return SCM(playerid, COLOR_RED, ""COL_BLUE"[ERROR]: "COL_WHITE"/%s command is not found in our server database, use /help", cmdtext);
	return 1;
}
warning 202: number of arguments does not match definition, i used smartcmd.inc for this one.


Re: Small Help - Toroi - 07.06.2017

PHP Code:
SCM(playeridCOLOR_RED""COL_BLUE"[ERROR]: "COL_WHITE"/%s command is not found in our server database, use /help"cmdtext); 
I'll suppose SCM is just a #define SCM SendClientMessage and not a function, if that's the case, there's no formatting on SendClientMessage, which means you'll first have to use the format function and then send the formatted message.

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

Structurally it'd be like:

PHP Code:
public OnPlayerCommandPerformed(cmdidplayeridcmdtext[], success)
{
    if(!
success)
    {
        
create a string of a considerable size
        format the string with the message you want
        send the client message with the string 
as the message parameter
        
return the value you think you should
    
}
    return 
1;




Re: Small Help - MrFantasy - 07.06.2017

Quote:
Originally Posted by Toroi
View Post
PHP Code:
SCM(playeridCOLOR_RED""COL_BLUE"[ERROR]: "COL_WHITE"/%s command is not found in our server database, use /help"cmdtext); 
I'll suppose SCM is just a #define SCM SendClientMessage and not a function, if that's the case, there's no formatting on SendClientMessage, which means you'll first have to use the format function and then send the formatted message.

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

Structurally it'd be like:

PHP Code:
public OnPlayerCommandPerformed(cmdidplayeridcmdtext[], success)
{
    if(!
success)
    {
        
create a string of a considerable size
        format the string with the message you want
        send the client message with the string 
as the message parameter
        
return the value you think you should
    
}
    return 
1;

Oh yeah, totally forgot about that. Thanks!