need help with params
#1

Hello.
This MOTD command, shows only the first word, I mean, If i type "/motd Hello guys" it will show only "Hello".
Someone fix it please:

PHP Code:
CMD:motd(playerid,params[])
{
    new 
string[128];
    if(
AdminLevel[playerid] < 4) return SCM(playerid,COLOR_WHITE,"{AFAFAF}[Error]: {FFFFFF}You do not have the correct admin level for this command.");
    
     if(
sscanf(params, "string[128]", params)) return SendClientMessage(playerid,COLOR_WHITE, ""COL_USAGE"[SYNTAX] {FFFFFF}/motd [MESSAGE]");
     
format(string,sizeof(string),"%s",params);
      
TextDrawSetString(MOTD, params);
       
format(string,sizeof(string),"%s(%d) has updated the MOTD",PlayerName(playerid),playerid);
      return 
1;
} 
Reply
#2

PHP Code:
CMD:motd(playerid,params[]) 
{ 
    new 
string[128], message[128]; 
    if(
AdminLevel[playerid] < 4) return SCM(playerid,COLOR_WHITE,"{AFAFAF}[Error]: {FFFFFF}You do not have the correct admin level for this command."); 
     
     if(
sscanf(params, "s[128]", message)) return SendClientMessage(playerid,COLOR_WHITE, ""COL_USAGE"[SYNTAX] {FFFFFF}/motd [MESSAGE]"); 
     
format(string,sizeof(string),"%s",message); 
      
TextDrawSetString(MOTD, message); 
       
format(string,sizeof(string),"%s(%d) has updated the MOTD",PlayerName(playerid),playerid); 
      return 
1; 
} 
Reply
#3

Quote:
Originally Posted by Y_Less
View Post
"s", not "string" for sscanf:

https://github.com/Y-Less/sscanf/wiki
Ohh, Okay
And thanks ATGOggy for fixing.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)