Data twice
#7

PHP код:
CMD:setadmin(playeridparams[])
{
    if(!
IsPlayerAdmin(playerid)) return 0;
    new 
targetplayerstring[150], Level;
    if(
sscanf(params"ui"targetplayerLevel)) return SendClientMessage(playeridCOLOR_ORANGE"Usage: /setadmin [ID] [Level 1-5]");
    if(
Level || Level 5) return SendClientMessage(playeridCOLOR_RED"Error: Available admin levels [1 - 5]");
    if(!
IsPlayerConnected(targetplayer)) return SendClientMessage(playeridCOLOR_RED"Error: Player is not connected!");
    if(
PlayerInfo[targetplayer][AdminLevel] == Level) return SendClientMessage(playeridCOLOR_RED"Error: The player is already this admin level.");
    new 
INI:File INI_Open(UserPath(targetplayer));
    
INI_WriteInt(File"Admin"Level);
    
INI_Close(File);
    if(
Level == 1)
    {
        
format(stringsizeof string"You have been set to a Trial Moderator by %s."PlayerName(playerid));
        
SendClientMessage(targetplayerCOLOR_LIGHTBLUEstring);
        
format(stringsizeof string"You have set %s as a Trial Moderator."PlayerName(targetplayer));
        
SendClientMessage(playeridCOLOR_LIGHTBLUEstring);
    }
    if(
Level == 2)
    {
         
format(stringsizeof string"You have been set to a Moderator by %s."PlayerName(playerid));
        
SendClientMessage(targetplayerCOLOR_YELLOWstring);
        
format(stringsizeof string"You have set %s as a Moderator."PlayerName(targetplayer));
        
SendClientMessage(playeridCOLOR_YELLOWstring);
    }
    if(
Level == 3)
     {
          
format(stringsizeof string"You have been set to a General Administrator by %s."PlayerName(playerid));
        
SendClientMessage(targetplayerCOLOR_GREENstring);
        
format(stringsizeof string"You have set %s as a General Administrator."PlayerName(targetplayer));
        
SendClientMessage(playeridCOLOR_GREENstring);
      }
    if(
Level == 4)
     {
          
format(stringsizeof string"You have been set to a Co-Owner by %s."PlayerName(playerid));
        
SendClientMessage(targetplayerCOLOR_ORANGEstring);
        
format(stringsizeof string"You have set %s as a Co-Owner."PlayerName(targetplayer));
        
SendClientMessage(playeridCOLOR_ORANGEstring);
    }
    if(
Level == 5)
    {
        
format(stringsizeof string"You have been set to the server Owner by %s."PlayerName(playerid));
        
SendClientMessage(targetplayerCOLOR_LEMONstring);
        
format(stringsizeof string"You have set %s to the server Owner."PlayerName(targetplayer));
        
SendClientMessage(playeridCOLOR_LEMONstring);
    }
    
printf("[SETADMIN] %s has set %s as an admin ( %i )"PlayerName(playerid), PlayerName(targetplayer), Level);
    
PlayerInfo[targetplayer][AdminLevel] = Level;
    return 
1;

NOTE:When I set lets say ID 13 as an admin, the next player with ID 13 gets the same admin level... what Should I do?
Reply


Messages In This Thread
Data twice - by saffierr - 02.01.2016, 12:49
Re: Data twice - by Mic_H - 02.01.2016, 13:13
Re: Data twice - by fuckingcruse - 02.01.2016, 13:16
Re: Data twice - by saffierr - 02.01.2016, 13:21
Re: Data twice - by Mic_H - 02.01.2016, 13:35
Re: Data twice - by Mic_H - 02.01.2016, 13:39
Re: Data twice - by saffierr - 02.01.2016, 13:48
Re: Data twice - by saffierr - 02.01.2016, 22:20
Re: Data twice - by Mic_H - 03.01.2016, 05:19

Forum Jump:


Users browsing this thread: 1 Guest(s)