#1

hey got this from a tut :
pawn Код:
CMD:setadmin(playerid, params[])
{
    if(!IsPlayerAdmin(playerid))return 0; //This command only works for rcon
    if(sscanf(params,"ui",ID,levels)) return SendClientMessage(playerid,0xFF9900AA, "USAGE: /setadmin [ID] [Level 1-4]");//it will show this if you dont use the format properly
    if(levels > 6) return SendClientMessage(playerid,0xFF0000FF,"LEVELS AVAILABLE 1-6!");//Available levels
    if(!IsPlayerConnected(ID))return SendClientMessage(playerid,-1,"That user is not connected.");//Detect if the id/partofname is connected
    if(PlayerData[ID][AdminLevel] == levels) return SendClientMessage(playerid,0xFF0000FF, "ERROR: That person is already this admin level!");//Detect if the guy is already the level you setted
    GetPlayerName(playerid,Nam, MAX_PLAYER_NAME);//define the playerid name
    GetPlayerName(ID,pname,MAX_PLAYER_NAME);//define the other person name
    if(levels == 0)
    {
        format(str, sizeof(str),"%s has your Admin level to %d on the server",Nam,levels);
        SendClientMessage(ID,0xFF9900AA,str);
        format(str, sizeof(str),"You had set %s Admin level to %d!",pname,levels);
        SendClientMessage(playerid,0xFF9900AA,str);
        PlayerData[ID][AdminLevel] = levels;//this sets the player level
        return 1;
    }
    format(str, sizeof(str),"%s has your Admin level to %d on the server.",Nam,levels);
    SendClientMessage(ID,0xFF9900AA,str);
    format(str, sizeof(str),"You had set %s Admin level to %d!",pname,levels);
    SendClientMessage(playerid,0xFF9900AA,str);
    PlayerData[ID][AdminLevel] = levels;
    return 1;
}
i understand it fully but this is first time i have tried to save in dini file etc but have no clue how :/ any help?
Reply
#2

Try reading some tutorials about DINI
https://sampforum.blast.hk/showthread.php?tid=308390
Reply
#3

is there an easy way? ii dont want dialogs i just want that it saves their name and admin lvl
i know how to do enums etc and make commands with only lvl 6 admin can do etc etc but dunno how to write dini files etc
Reply
#4

Search it I am busy right now.
Reply
#5

Well You Need dini_IntSet(filepath,"admin",level); and all that so it sets the level of the player to what u haved typed in /setadmin [id] [level] .... Then it will set ur admin to 1 in the file of the player in scriptfiles and ur admin file
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)