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



Need help - JoeyDeBlob - 26.12.2011

I'm trying to script a admin duty command, and I have some errors. Those are the errors:

PHP код:
C:\Users\User\Desktop\Premium Roleplay\gamemodes\mysql.pwn(85732) : error 035argument type mismatch (argument 2)
C:\Users\User\Desktop\Premium Roleplay\gamemodes\mysql.pwn(85732) : error 029invalid expressionassumed zero 
there are some warnings, but they do not effect anything.

This is the script

PHP код:
(58732)SendClientMessageToAll(playeridCOLOR_YELLOW"Administrator %s is now on duty. (/report for assistance.")); GetPlayerNameEx(playerid); 
If you want any other line, please reply.

Thank you for your help.


AW: Need help - jack3 - 26.12.2011

Quote:

(58732)SendClientMessageToAll(playerid, COLOR_YELLOW, "Administrator %s is now on duty. (/report for assistance.")); GetPlayerNameEx(playerid);

Why do you put a "playerid" in ClientMessageTOALL? I think you should remove it

//edit:
oh wait, you have to format the string, too.

//edit 2:
PHP код:
new string[128];
    new 
AdminName[28];
    
    
GetPlayerName(playeridAdminNamesizeof(AdminName));
    
    
format(stringsizeof(string), "Administrator %s is now on duty. (/report for assistance."AdminName);
    
SendClientMessageToAll(COLOR_YELLOWstring); 



Re: Need help - JoeyDeBlob - 26.12.2011

PHP код:
CMD:adduty(playeridparams[])
{
    new 
string[256];
        new 
AdminName[28];
        
GetPlayerName(playeridAdminNamesizeof(AdminName));
        
format(stringsizeof(string), "Administrator %s is now on duty. (/report for assistance)."AdminName;

    if(
PlayerInfo[playerid][pAdmin] < 2) return SendClientMessage(playeridCOLOR_GREY,"You are not authorized to use that command.");
    else
    {
        {
            
SetPlayerColor(playeridCOLOR_BLACK);
            
SetPlayerHealth(playerid99999);
            
SetPlayerArmour(playerid99999);
            {
            
SendClientMessage(playeridCOLOR_LIGHTBLUE"You are now administrator On duty .");

            
SendClientMessageToAll(COLOR_YELLOWstring);
            }

        }
    }
    return 
1;

This is what I wrote now

and I get the error, "Excepted token "," but found ";"


Re: Need help - rinori - 26.12.2011

pawn Код:
CMD:adduty(playerid, params[])
{
    new string[256], AdminName[28];
    if(PlayerInfo[playerid][pAdmin] < 2) return SendClientMessage(playerid, COLOR_GREY,"You are not authorized to use that command.");
    else
    {
        GetPlayerName(playerid, AdminName, sizeof(AdminName));
        format(string, sizeof(string), "Administrator %s is now on duty. (/report for assistance).", AdminName);
        SendClientMessageToAll(COLOR_YELLOW, string);
        SetPlayerColor(playerid, COLOR_BLACK);
        SetPlayerHealth(playerid, 99999);
        SetPlayerArmour(playerid, 99999);
        SendClientMessage(playerid, COLOR_LIGHTBLUE, "You are now administrator On duty .");
    }
    return 1;
}
Use this.


Re: Need help - JoeyDeBlob - 26.12.2011

Thanks!