Help me, Please
#1

Hello, I am confused, Could someone help me change this /slap command so that it also shows the Reason

Example: %s was slapped by %s, Reason: %s


pawn Код:
if(strcmp(cmd, "/slap", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            tmp = strtok(cmdtext, idx);
            if(!strlen(tmp))
            {
                SendClientMessage(playerid, COLOR_WHITE, "USAGE: /slap [PlayerID/PartOfName]");
                return 1;
            }
            new playa;
            new Float:slx, Float:sly, Float:slz;
            playa = ReturnUser(tmp);
            if(PlayerInfo[playerid][pAdmin] >=2)
            {
                if(IsPlayerConnected(playa))
                {
                    if(playa != INVALID_PLAYER_ID)
                    {
                        GetPlayerName(playa, giveplayer, sizeof(giveplayer));
                        GetPlayerName(playerid, sendername, sizeof(sendername));
                        if(PlayerInfo[playa][pAdmin] > PlayerInfo[playerid][pAdmin])
                        {
                            format(string, sizeof(string), "Server: %s was {FFAF00}Slapped {C77D87}by Mr_Dick, reason: Attempting to slap a higher admin.", sendername);
                            ABroadCast(COLOR_LIGHTRED, string, 1);
                            GetPlayerPos(playerid, slx, sly, slz);
                            SetPlayerPos(playerid, slx, sly, slz+5);
                            PlayerPlaySound(playerid, 1130, slx, sly, slz+5);
                            return 1;
                        }
                        GetPlayerPos(playa, slx, sly, slz);
                        SetPlayerPos(playa, slx, sly, slz+5);
                        PlayerPlaySound(playa, 1130, slx, sly, slz+5);
                        format(string, sizeof(string), "Server: %s was {FFAF00}Slapped {C77D87}by %s.",giveplayer ,sendername);
                        ABroadCast(COLOR_LIGHTRED,string,1);
                    }
                }
            }
            else
            {
                SendClientMessage(playerid, COLOR_GRAD1, "You are not authorized to use that command!");
            }
        }
        return 1;
    }
Reply
#2

pawn Код:
if(strcmp(cmd, "/slap", true) == 0)
{
    if(IsPlayerConnected(playerid))
    {
        new tmp2[256]; tmp2 = strtok(cmdtext, idx);
        tmp = strtok(cmdtext, idx);
        if(!strlen(tmp))
        {
            SendClientMessage(playerid, COLOR_WHITE, "USAGE: /slap [PlayerID/PartOfName][Reason]");
            return 1;
        }
        if(!strlen(tmp2)) tmp2 = "No Reason";
        new playa;
        new Float:slx, Float:sly, Float:slz;
        playa = ReturnUser(tmp);
        if(PlayerInfo[playerid][pAdmin] >=2)
        {
            if(IsPlayerConnected(playa))
            {
                if(playa != INVALID_PLAYER_ID)
                {
                    GetPlayerName(playa, giveplayer, sizeof(giveplayer));
                    GetPlayerName(playerid, sendername, sizeof(sendername));
                    if(PlayerInfo[playa][pAdmin] > PlayerInfo[playerid][pAdmin])
                    {
                        format(string, sizeof(string), "Server: %s was {FFAF00}Slapped {C77D87}by Mr_Dick, reason: Attempting to slap a higher admin.", sendername);
                        ABroadCast(COLOR_LIGHTRED, string, 1);
                        GetPlayerPos(playerid, slx, sly, slz);
                        SetPlayerPos(playerid, slx, sly, slz+5);
                        PlayerPlaySound(playerid, 1130, slx, sly, slz+5);
                        return 1;
                    }
                    GetPlayerPos(playa, slx, sly, slz);
                    SetPlayerPos(playa, slx, sly, slz+5);
                    PlayerPlaySound(playa, 1130, slx, sly, slz+5);
                    format(string, sizeof(string), "Server: %s was {FFAF00}Slapped {C77D87}by %s Reason: %s.",giveplayer ,sendername, tmp2);
                    ABroadCast(COLOR_LIGHTRED,string,1);
                }
            }
        }
        else
        {
            SendClientMessage(playerid, COLOR_GRAD1, "You are not authorized to use that command!");
        }
    }
    return 1;
}
Reply
#3

Thanks, your the BEST, Have a Rep+
Reply
#4

If it doesn't work, try this:
pawn Код:
if(strcmp(cmd, "/slap", true) == 0)
{
    if(IsPlayerConnected(playerid))
    {
        new tmp2[256];
        tmp = strtok(cmdtext, idx);
        tmp2 = strtok(cmdtext, idx);
        if(!strlen(tmp))
        {
            SendClientMessage(playerid, COLOR_WHITE, "USAGE: /slap [PlayerID/PartOfName][Reason]");
            return 1;
        }
        if(!strlen(tmp2)) tmp2 = "No Reason";
        new playa;
        new Float:slx, Float:sly, Float:slz;
        playa = ReturnUser(tmp);
        if(PlayerInfo[playerid][pAdmin] >=2)
        {
            if(IsPlayerConnected(playa))
            {
                if(playa != INVALID_PLAYER_ID)
                {
                    GetPlayerName(playa, giveplayer, sizeof(giveplayer));
                    GetPlayerName(playerid, sendername, sizeof(sendername));
                    if(PlayerInfo[playa][pAdmin] > PlayerInfo[playerid][pAdmin])
                    {
                        format(string, sizeof(string), "Server: %s was {FFAF00}Slapped {C77D87}by Mr_Dick, reason: Attempting to slap a higher admin.", sendername);
                        ABroadCast(COLOR_LIGHTRED, string, 1);
                        GetPlayerPos(playerid, slx, sly, slz);
                        SetPlayerPos(playerid, slx, sly, slz+5);
                        PlayerPlaySound(playerid, 1130, slx, sly, slz+5);
                        return 1;
                    }
                    GetPlayerPos(playa, slx, sly, slz);
                    SetPlayerPos(playa, slx, sly, slz+5);
                    PlayerPlaySound(playa, 1130, slx, sly, slz+5);
                    format(string, sizeof(string), "Server: %s was {FFAF00}Slapped {C77D87}by %s Reason: %s.",giveplayer ,sendername, tmp2);
                    ABroadCast(COLOR_LIGHTRED,string,1);
                }
            }
        }
        else
        {
            SendClientMessage(playerid, COLOR_GRAD1, "You are not authorized to use that command!");
        }
    }
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)