help some errors
#1

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;

Reply
#2

Код:
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.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)