/warn Commmand
#5

Quote:
Originally Posted by Super_Panda
Посмотреть сообщение
Try this

pawn Код:
if(strcmp(cmd, "/warn", true) == 0)
    {
 new string[128];
        if(IsPlayerConnected(playerid))
        {
            tmp = strtok(cmdtext, idx);
            if(!strlen(tmp))
            {
                SendClientMessage(playerid, YOURCOLOR, "USAGE: /warn [playerid/PartOfName] [reason]");
                return 1;
            }
            giveplayerid = ReturnUser(tmp);
            if (PlayerInfo[playerid][pAdmin] >= 1)
            {
                if(IsPlayerConnected(giveplayerid))
                {
                    if(giveplayerid != INVALID_PLAYER_ID)
                    {
                        GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
                        GetPlayerName(playerid, sendername, sizeof(sendername));
                        new length = strlen(cmdtext);
                        while ((idx < length) && (cmdtext[idx] <= ' '))
                        {
                            idx++;
                        }
                        new offset = idx;
                        new result[64];
                        while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
                        {
                            result[idx - offset] = cmdtext[idx];
                            idx++;
                        }
                        result[idx - offset] = EOS;
                        if(!strlen(result))
                        {
                            SendClientMessage(playerid, YOURCOLOR, "USAGE: /warn [playerid/PartOfName] [reason]");
                            return 1;
                        }
                        new year, month,day;
                        getdate(year, month, day);
                        format(string, sizeof(string), "You warned %s, reason: %s", giveplayer, (result));
                        SendClientMessage(playerid, COLOR_YOURCOLOR, string);
                        format(string, sizeof(string), "You were warned by %s, reason: %s", sendername, (result));
                        SendClientMessage(giveplayerid, COLOR_YOURCOLOR, string);
                        format(string, sizeof(string), "AdmCmd: %s was warned by %s, reason: %s", giveplayer, sendername, (result));
                        SendClientMessageToAll(0xE42217FF, string);
                        format(string, sizeof(string), "AdmCmd: %s was warned by %s, reason: %s (%d-%d-%d)", giveplayer, sendername, (result),month,day,year);
                        return 1;
                    }
                }//not connected
            }
            else
            {
                format(string, sizeof(string), "   %d is not an active player.", giveplayerid);
                SendClientMessage(playerid, YOURCOLOR, string);
            }
        }
        return 1;
    }
Hmm, so you expect the topic starter to already have this enumeration:

PlayerInfo[playerid][pAdmin]

in his script ?

Stop copying and pasting stuff without explaining.
Reply


Messages In This Thread
/warn Commmand - by V_LOPE - 30.09.2011, 17:58
Re: /warn Commmand - by V_LOPE - 01.10.2011, 02:43
Re: /warn Commmand - by Yamoo - 01.10.2011, 02:44
Re: /warn Commmand - by Super_Panda - 01.10.2011, 03:02
Re: /warn Commmand - by grand.Theft.Otto - 01.10.2011, 04:12
Re: /warn Commmand - by V_LOPE - 01.10.2011, 04:26
Re: /warn Commmand - by Cjgogo - 01.10.2011, 06:23
Re: /warn Commmand - by V_LOPE - 01.10.2011, 07:42
Re: /warn Commmand - by Jafet_Macario - 01.10.2011, 07:46
Re: /warn Commmand - by V_LOPE - 01.10.2011, 08:31

Forum Jump:


Users browsing this thread: 2 Guest(s)