/admins and /me zcmd help
#1

Hey guys...
Can someone tell me how do i mmake a /admins cmd with zcmd?
My admin variable is: PlayerInfo[playerid][Adminlevel]

By the way, about the /me, i tryed but i only find it in strcmp and don't know make it myself coz i dont know how to get player text...

Thanks very much!
Reply
#2

Here is the /me:
pawn Код:
CMD:me(playerid, params[])
{
    if(sscanf(params, "s[50]", str)== 0) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /me [action]");
    new PlayerName[24];
    GetPlayerName(playerid, PlayerName, sizeof(PlayerName));
    format(str, sizeof(str), "* %s %s", PlayerName, params);
    ProxDetector(45.0,playerid,str,COLOR_YELLOW,COLOR_YELLOW,COLOR_YELLOW,COLOR_YELLOW,COLOR_YELLOW); //Change this to SendClientMessageToAll if you want it as a global me.
    return 1;
}
Reply
#3

strcmp /me:

pawn Код:
if(strcmp(cmdtext, "/me", true, 3)==0) {
        new pname1[24], string[256];
        GetPlayerName(playerid, pname1, 24);
        format(string, 256, "*%s (%d) %s", pname1, playerid, cmdtext[4]);
        SendClientMessageToAll(GetPlayerColor(playerid), string);
        return 1;
    }
Reply
#4

Quote:
Originally Posted by austin070
Посмотреть сообщение
Here is the /me:
pawn Код:
CMD:me(playerid, params[])
{
    if(sscanf(params, "s[50]", str)== 0) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /me [action]");
    new PlayerName[24];
    GetPlayerName(playerid, PlayerName, sizeof(PlayerName));
    format(str, sizeof(str), "* %s %s", PlayerName, params);
    ProxDetector(45.0,playerid,str,COLOR_YELLOW,COLOR_YELLOW,COLOR_YELLOW,COLOR_YELLOW,COLOR_YELLOW); //Change this to SendClientMessageToAll if you want it as a global me.
    return 1;
}
Your
pawn Код:
new PlayerName[24];
should be
pawn Код:
new PlayerName[MAX_PLAYER_NAME];
Reply
#5

Quote:
Originally Posted by Schurman
Посмотреть сообщение
Your
pawn Код:
new PlayerName[24];
should be
pawn Код:
new PlayerName[MAX_PLAYER_NAME];
Can work either way.
Reply
#6

Thanks austin...

And by the way, GrandTheftAuto, if i asked zcmd it is because i don't use strcmp... STRCMP i found on wiki...
Reply
#7

pawn Код:
COMMAND:admins(playerid, params[])
{
    new string[128];
    SendClientMessage(playerid, COLOR, "[Online Administrators]:");
    for(new i = 0; i < MAX_PLAYERS; i++) {
        if(PlayerInfo[playerid][AdminLevel] >= 1) {
            new player_Name[MAX_PLAYER_NAME];
            GetPlayerName(i, player_Name, sizeof(player_Name));
            format(string, sizeof(string), "[Level: %d] %s", PlayerInfo[i][AdminLevel], player_Name);
            SendClientMessage(playerid, COLOR, string); //Don't forget to replace "COLOR" with a valid color
        }
    }
    return 1;
}
Should work perfectly fine.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)