Help adminduty
#1

I want make this comand

-I want that qhen i write /adminduty, mi name change to STAFF_(name)

-When i write toher time /adminduty mi and im offduty mi name back to mi real name

-A comand /name (mi name), i choose the name i want put in STAFF_ (name). Example. I write /name Peter, when im adminduty mi name will be STAFF_Peter

-Mi gm use Mysql

thiis is mi comand of adminduty
pawn Код:
if(strcmp(cmd, "/adminduty", true) == 0)
{
if(PlayerInfo[playerid][pAdmin] >= 1 || IsPlayerAdmin(playerid))
{
if(PlayerInfo[playerid][pAdminDuty] == 0)
{
PlayerInfo[playerid][pAdminDuty] = 1;
GM_SetPlayerHealth(playerid,100000);
//   SetPlayerColor(playerid,0xD900D3C8);
//printf("ADMINLOG: %s now are admin duty.", pName(playerid));
SendClientMessage(playerid,AzulClaro,"* Now you are 'Admin Duty'");
}
else
{
PlayerInfo[playerid][pAdminDuty] = 0;
GM_SetPlayerHealth(playerid,100);
// SetPlayerColor(playerid,0xFFFFFF00);
//printf("ADMINLOG: %s  now are admin offduty.", pName(playerid));
SendClientMessage(playerid,AzulClaro,"* Now you are 'Admin OffDuty'");
}
}
else { SendClientMessage(playerid,Rojo,"* You arent menber of Staff!"); }
return 1;
}
Reply
#2

Up
Reply
#3

pawn Код:
if(strcmp(cmd, "/adminduty", true) == 0)
{
    if(PlayerInfo[playerid][pAdmin] >= 1 || IsPlayerAdmin(playerid))
    {
        if(PlayerInfo[playerid][pAdminDuty] == 0)
        {
            PlayerInfo[playerid][pAdminDuty] = 1;
            GM_SetPlayerHealth(playerid,100000);
            //   SetPlayerColor(playerid,0xD900D3C8);
            //printf("ADMINLOG: %s now are admin duty.", pName(playerid));
            SendClientMessage(playerid,AzulClaro,"* Now you are 'Admin Duty'");
           
            new playerName[MAX_PLAYER_NAME];
            GetPlayerName(playerid, playerName, sizeof(playerName));
            if(strlen(playerName)+strlen("STAFF_") > MAX_PLAYER_NAME) return SendClientMessage(playerid, 0xFF0000FF, "Unable to change your name, your name is too long.");
            strins(playerName, "STAFF_", 0);
            SetPlayerName(playerid, playerName);
        }
        else
        {
            PlayerInfo[playerid][pAdminDuty] = 0;
            GM_SetPlayerHealth(playerid,100);
            // SetPlayerColor(playerid,0xFFFFFF00);
            //printf("ADMINLOG: %s  now are admin offduty.", pName(playerid));
            SendClientMessage(playerid,AzulClaro,"* Now you are 'Admin OffDuty'");
           
            new playerName[MAX_PLAYER_NAME];
            GetPlayerName(playerid, playerName, sizeof(playerName));           
            if(strfind(playerName, "STAFF_", true) != -1){strdel(playerName, 0, strlen("STAFF_")); SetPlayerName(playerid, playerName);}
        }
    }
    else
    {
        SendClientMessage(playerid,Rojo,"* You arent menber of Staff!");
    }
    return 1;
}
Note: If player's name is larger than 18, the name can't be changed. (Max player name is 24)
Reply
#4

OK, thanks, this code run good, But i not want put STAFF_myname, y want that with comand /name (name i choose), and when i put /adminduty mi name changue to STAFF_( mi name choose with comand /name)

Example:
Mi name is Erik_McDonald, y write /name Peter, when i put /adminsuty mi name will be STAFF_Peter

Thanks for all
Reply
#5

Up
Reply
#6

Up
Reply
#7

Up
Reply
#8

Up
Reply
#9

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    dcmd(name,4,cmdtext);
    dcmd(adminduty,9,cmdtext);
    return 0;
}
dcmd_name(playerid,params[])
{
    if(!PlayerInfo[playerid][pAdmin] >= 1 && !IsPlayerAdmin(playerid)) return SendClientMessage(playerid,-1,"* You arent menber of Staff!");
    if(PlayerInfo[playerid][pAdminDuty] == 0) return SendClientMessage(playerid,-1,"* You must be on duty to use this command.");
    new name[MAX_PLAYER_NAME];
    if(sscanf(params,"s[15]",name)) return SendClientMessage(playerid,-1,"* USAGE : /name [NEW_NAME]!");
    new oldname[MAX_PLAYER_NAME];
    GetPlayerName(playerid,oldname,MAX_PLAYER_NAME);
    SetPVarString(playerid,"OldName",oldname);
    format(name,sizeof(name),"STAFF_%s",name);
    SetPlayerName(playerid,name);
    return 1;
}
dcmd_adminduty(playerid,params[])
{
    #pragma unused params
    if(!PlayerInfo[playerid][pAdmin] >= 1 && !IsPlayerAdmin(playerid)) return SendClientMessage(playerid,-1,"* You arent menber of Staff!");
    if(PlayerInfo[playerid][pAdminDuty] == 0)
    {
            PlayerInfo[playerid][pAdminDuty] = 1;
            GM_SetPlayerHealth(playerid,100000);
            //   SetPlayerColor(playerid,0xD900D3C8);
            //printf("ADMINLOG: %s now are admin duty.", pName(playerid));
            SendClientMessage(playerid,AzulClaro,"* Now you are 'Admin Duty'");

            new playerName[MAX_PLAYER_NAME];
            GetPlayerName(playerid, playerName, sizeof(playerName));
            SetPVarString(playerid,"OldName",playerName);
            if(strlen(playerName)+strlen("STAFF_") > MAX_PLAYER_NAME) return SendClientMessage(playerid, 0xFF0000FF, "Unable to change your name, your name is too long.");
            SetPlayerName(playerid, playerName);
    }
    else
    {
            PlayerInfo[playerid][pAdminDuty] = 0;
            GM_SetPlayerHealth(playerid,100);
            // SetPlayerColor(playerid,0xFFFFFF00);
            //printf("ADMINLOG: %s  now are admin offduty.", pName(playerid));
            SendClientMessage(playerid,AzulClaro,"* Now you are 'Admin OffDuty'");
            new name[MAX_PLAYER_NAME];
            GetPVarString(playerid,"OldName",name,MAX_PLAYER_NAME);
            SetPlayerName(playerid,name);
    }
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)