I have this code....
#1

pawn Код:
// This is a comment
// uncomment the line below if you want to write a filterscript
#define FILTERSCRIPT

#include <a_samp>

public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp(cmdtext, "/adm", true) == 0)
    {
    new name[MAX_PLAYER_NAME];
    for( new i=0; i<MAX_PLAYERS; i++ )
    {
    if( IsPlayerConnected(i) && !IsPlayerNPC(i) )
    {
        GetPlayerName (i, name, sizeof(name) );
        if(!strcmp(name, "Alex_Obando", true)) return
        SendClientMessage(playerid, -1, "____|CoD:SaMp Online Administrators|____");
        SendClientMessage(playerid, -1, "Alex_Obando (Owner Administrator).");
    }
        else
        {
        SendClientMessage(playerid, -1, "No admins Online.");
        return 1;
        }
    }
}
    return 1;
}
But how I can add a new administrator like "Jackson" if 2 admins online xD?
pawn Код:
SendClientMessage(playerid, -1, "____|CoD:SaMp Online Administrators|____");
        SendClientMessage(playerid, -1, "Alex_Obando (Owner Administrator).");
        SendClientMessage(playerid, -1, "Jackson Level 1.");
Reply
#2

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp(cmdtext, "/adm", true) == 0)
    {
        new nadms, name[MAX_PLAYER_NAME];
        SendClientMessage(playerid, -1, "____|CoD:SaMp Online Administrators|____");
       
        for( new i=0; i<MAX_PLAYERS; i++ )
        {
            if( IsPlayerConnected(i) && !IsPlayerNPC(i) )
            {
                GetPlayerName (i, name, sizeof(name) );
                if(!strcmp(name, "Alex_Obando", false)) {
                    SendClientMessage(playerid, -1, "Alex_Obando (Owner Administrator).");
                    nadms++;
                }
                if(!strcmp(name, "Jackson", false)) {
                    SendClientMessage(playerid, -1, "Jackson Level 1.");
                    nadms++;
                }
            }
        }
        if(nadms == 0) SendClientMessage(playerid, -1, "No Administrators are online.");
    }
    return 1;
}
untested, modified in a minute.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)