SA-MP Forums Archive
help fast please! - 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: help fast please! (/showthread.php?tid=560600)



help fast please! - aCloudy - 29.01.2015

Hello.
When i use /asay, It shows: [ADMIN] y, But it should show what i typed, Not "y"
And i think the problem is from the "if(sscanf(params,"u",params))" line ..

PHP Code:
CMD:asay(playerid,params[])
{
    new 
string[128];
    if(
AdminLevel[playerid] < 1) return SCM(playerid,COLOR_WHITE,"{AFAFAF}[Error]: {FFFFFF}You do not have the correct admin level for this command.");
    if(
sscanf(params,"u",params))
    {
        
SendClientMessage(playerid,COLOR_WHITE""COL_USAGE"[SYNTAX] {FFFFFF}/asay [MESSAGE]");
        return 
1;
    }
     
format(string,sizeof(string),""COL_ADMIN"[ADMIN] {FFFFFF}%s",params);
      
SendClientMessageToAll(COLOR_WHITE,string);
       
format(string,sizeof(string),"%s(%d) has used /asay",PlayerName(playerid),playerid);
     
SendALogMessage(string);
      return 
1;




Re: help fast please! - aCloudy - 29.01.2015

Sorry for Bump, but help me fast!


Re: help fast please! - ATGOggy - 29.01.2015

Try this:
PHP Code:
CMD:asay(playerid,params[]) 

    new 
string[128], message[128]; 
    if(
AdminLevel[playerid] < 1) return SCM(playerid,COLOR_WHITE,"{AFAFAF}[Error]: {FFFFFF}You do not have the correct admin level for this command."); 
    if(
sscanf(params,"s[128]",id,message)) 
    { 
        
SendClientMessage(playerid,COLOR_WHITE""COL_USAGE"[SYNTAX] {FFFFFF}/asay [MESSAGE]"); 
        return 
1
    } 
     
format(string,sizeof(string),""COL_ADMIN"[ADMIN] {FFFFFF}%s",message); 
      
SendClientMessageToAll(COLOR_WHITE,string); 
       
format(string,sizeof(string),"%s(%d) has used /asay",PlayerName(playerid),playerid); 
     
SendALogMessage(string); 
      return 
1




Re: help fast please! - KayJ - 29.01.2015

Try This(self correction):
pawn Code:
CMD:asay(playerid, params[])
{
    new str[128];
    if(pInfo[playerid][Admin] >= 1)
    {
        if(sscanf(params, "s[128]", params)) return SendClientMessage(playerid,COLOR_WHITE, ""COL_USAGE"[SYNTAX] {FFFFFF}/asay [MESSAGE]");
        format(str, sizeof(str), ""COL_ADMIN"[ADMIN] {FFFFFF}%s", GetName(playerid), params);
        SendClientMessageToAll(COL_WHITE, str);
        format(str, sizeof(str), "%s(%d) has used /asay", params);
        SendALogMessage(string);
    }
    else return SCM(playerid,COLOR_WHITE,"{AFAFAF}[Error]: {FFFFFF}You do not have the correct admin level for this command.");
    return 1;
}