Player name Help :)
#1

Hello Guys
I have a problem in this command that TargetID name dont display in Client Message, here are codes

pawn Код:
CMD:accountdisable(playerid, params[])
{
        new TargetID;
        new Reason;
        if(pInfo[playerid][Adminlevel] < 5) return SendClientMessage(playerid, COLOR_RED, ""ERROR_MESSAGE"");
        if(sscanf(params, "us", TargetID, Reason)) return SendClientMessage(playerid, COLOR_RED, "USAGE: /accountdisable [id] [Reason (optional)]");
        if(TargetID == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_RED, "* Player Is Not Connected.");
       
        pInfo[TargetID][Adisable] =1;
        new str[128];
        new str1[128];
        new targetname[MAX_PLAYER_NAME];
        GetPlayerName(TargetID,targetname,sizeof(targetname));
        format(str,sizeof(str),"%s (%d) Has Been Disabled By An Admin. Reason: %s", targetname, TargetID, Reason);
        SendClientMessageToAll(COLOR_HOTPINK, str);
        format(str1,sizeof(str1),"**KICK: %s (%d) (ACCOUNT DISABLED) Account Disabled", targetname, TargetID);
        SendClientMessageToAll(COLOR_HOTPINK, str1);
        KickWithMessage(TargetID,"");
        return 1;
}
=)
Reply
#2

pawn Код:
CMD:accountdisable(playerid, params[])
{
        new TargetID;
        new Reason[128];
        if(pInfo[playerid][Adminlevel] < 5) return SendClientMessage(playerid, COLOR_RED, ""ERROR_MESSAGE"");
        if(sscanf(params, "is[128]", TargetID, Reason)) return SendClientMessage(playerid, COLOR_RED, "USAGE: /accountdisable [id] [Reason (optional)]");
        if(!IsPlayerConnected(TargetID)) return SendClientMessage(playerid, COLOR_RED, "* Player Is Not Connected.");
        pInfo[TargetID][Adisable] =1;
        new str[128];
        new str1[128];
        new targetname[MAX_PLAYER_NAME];
        GetPlayerName(TargetID,targetname,sizeof(targetname));
        format(str,sizeof(str),"%s(%d) has been disabled by an Admin. Reason: %s", targetname, TargetID, Reason);
        SendClientMessageToAll(COLOR_HOTPINK, str);
        format(str1,sizeof(str1),"**KICK:%s (%d) (ACCOUNT DISABLED) Account Disabled", targetname, TargetID);
        SendClientMessageToAll(COLOR_HOTPINK, str1);
        KickWithMessage(TargetID,"");
        return 1;
}
TBH, I only noticed a mistake, but it was related to the reason(wich you declared it wrong, I suposse the Reason must be a string right. Other than that, your code is correct, also, I changed INVALID_PLAYER_ID check to IsPlayerConnected, try it now.
Reply
#3

Now when ever i use this command i get "USAGE: /accountdisable [id] [Reason (optional)]" error IG
Reply
#4

must work dude
Код:
CMD:accountdisable(playerid, params[])
{
        new TargetID,Reason[64];
        if(pInfo[playerid][Adminlevel] < 5) return SendClientMessage(playerid, COLOR_RED, ""ERROR_MESSAGE"");
        if(sscanf(params, "us", TargetID, Reason)) return SendClientMessage(playerid, COLOR_RED, "USAGE: /accountdisable [id] [Reason (optional)]");
        if(TargetID == INVALID_PLAYER_ID || !IsPlayerConnected(TargetID )) return SendClientMessage(playerid, COLOR_RED, "* Player Is Not Connected.");
        else
        {
               pInfo[TargetID][Adisable] =1;
               new str[128],str1[128];
               new targetname[MAX_PLAYER_NAME];
               GetPlayerName(TargetID,targetname,24);
               format(str,sizeof(str),"%s (%d) Has Been Disabled By An Admin. Reason: %s", targetname, TargetID, Reason);
               SendClientMessageToAll(COLOR_HOTPINK, str);
               format(str1,sizeof(str1),"**KICK: %s (%d) (ACCOUNT DISABLED) Account Disabled", targetname, TargetID);
               SendClientMessageToAll(COLOR_HOTPINK, str1);
               KickWithMessage(TargetID,"");
        }
        return 1;
}
Reply
#5

Worked Thanks
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)