SA-MP Forums Archive
help some errors - 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 some errors (/showthread.php?tid=610777)



help some errors - JuzDoiT - 28.06.2016

PHP код:
error 035argument type mismatch (argument 2
PHP код:
error 035argument type mismatch (argument 2
PHP код:
COMMAND:ban(playeridparams[])
{
    new 
TargetIDstring[256], Reason[256];
    if(
PlayerInfo[playerid][pSpawned] == 1)
    {
    if(
PlayerInfo[playerid][pAdminlevel] > 0)
    {
    if(
sscanf(params"u"TargetID))
    {
    
SendClientMessage(playeridCOLOR_ERROR"USAGE: /ban (Name - ID) (Reason)");
    return 
1;
    }
    
sscanf(params"us[256]"TargetIDReason);
    if(!
IsPlayerConnected(TargetID) || TargetID == INVALID_PLAYER_ID)
    {
    
SendClientMessage(playeridCOLOR_ERROR"That Player Is Not Connected.");
    return 
1;
    }
    if(
IsPlayerNPC(TargetID))
    {
    
SendClientMessage(playerid,COLOR_ERROR,"You Cannot Ban a BOT.");
    return 
1;
    }
    if(!
strlen(Reason))
    {
    
Reason "No Reason Given.";
    }
    
SetPlayerPosEx(TargetID,264.90570077.6140821001.039062269.327789,6,0);
    
SendClientMessage(playerid"You Have Been Banned By An Admin. Reason: %s"Reason);
    
format(string,sizeof(string),"**BAN: %s (%d) (ADMIN BAN) Has Been Banned."PlayerInfo[TargetID][pName], TargetID);
    
SendClientMessageToOthers(COLOR_ADMINstring);
    
BanPlayer(TargetID);
    }else{
    
SendClientMessage(playerid,COLOR_ERROR,""ERROR_MSG"");
    }
    }else{
    
SendClientMessage(playerid,COLOR_ERROR,"You Cannot Use This Command While You're Dead.");
    }
    return 
1;




Re: help some errors - Sjn - 28.06.2016

Код:
SendClientMessage(playerid, "You Have Been Banned By An Admin. Reason: %s", Reason);
You need to format this message before sending. Also, you are missing the color argument here. SendClientMessage has 3 arguments; playerid, color, string.