SA-MP Forums Archive
Going /aod [Admin on Duty] - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Going /aod [Admin on Duty] (/showthread.php?tid=52994)



Going /aod [Admin on Duty] - haraki255 - 13.10.2008

Hey guys im looking for a filter script that has a cmd, that when you type /aod it Say [My Name] Is now On Duty As An Admin!
Please Guys?!

Thanks


Re: Going /aod [Admin on Duty] - Vladis - 13.10.2008

pawn Код:
#include <a_samp>

public OnPlayerCommandText(playerid, cmdtext[])
{
  new cmd[256];
  new idx;
  cmd = strtok(cmdtext, idx);
 
    if (strcmp(cmd, "/aod", true) == 0)
    {
    if (!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, 0xFFFFFFAA, "[SERVER]: You are not logged as an administrator!");
    {
    new pName[MAX_PLAYER_NAME];
    new string[256];
  GetPlayerName(playerid, pName, sizeof(pName));
    format(string, sizeof(string), "[%s]: Is now On Duty As An Admin!", pName);
    SendClientMessageToAll(0xFFFF00AA, string);
    }
    return 1;
    }
    return 0;
}

strtok(const string[], &index)
{
    new length = strlen(string);
    while ((index < length) && (string[index] <= ' '))
    {
        index++;
    }

    new offset = index;
    new result[20];
    while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))
    {
        result[index - offset] = string[index];
        index++;
    }
    result[index - offset] = EOS;
    return result;
}



Re: Going /aod [Admin on Duty] - James_Bauer - 15.08.2009

You didnt search too much i search too much and i findd all i need!