Data twice
#9

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_SetTag(File"PlayerData"); //THIS IS THE FIX.. 
    //You have forgotten this line in other commands too.. Like /setvip /setmechanic or w.e
    
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

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)