SA-MP Forums Archive
How do i make setlevel command? - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: How do i make setlevel command? (/showthread.php?tid=559217)



How do i make setlevel command? - Glossy42O - 21.01.2015

Hello,

I made admin commands but,

I wonder how do i make a setlevel command, I have tried to search a little bit but i couldn't find.

Could anyone help me? If you need to see my ban/kick or any of my other commands i'll show.


Re: How do i make setlevel command? - astanalol - 21.01.2015

Quote:
Originally Posted by Stuun23
Посмотреть сообщение
Hello,

I made admin commands but,

I wonder how do i make a setlevel command, I have tried to search a little bit but i couldn't find.

Could anyone help me? If you need to see my ban/kick or any of my other commands i'll show.
hi are u use y_ini ?
if u use it i can help u


Re: How do i make setlevel command? - Glossy42O - 21.01.2015

Quote:
Originally Posted by astanalol
Посмотреть сообщение
hi are u use y_ini ?
if u use it i can help u
Yes, I use it.


Re: How do i make setlevel command? - astanalol - 21.01.2015

give me this from your admins save
Quote:

public LoadUser_data(playerid,name[],value[])

Quote:

INI_Int("Admins",PlayerInfo[playerid][pAdmins]);




Re: How do i make setlevel command? - CprYseeR - 21.01.2015

Stuun23 We need thats astanalol said to make it


Re: How do i make setlevel command? - nogh445 - 21.01.2015

Quote:
Originally Posted by Stuun23
Посмотреть сообщение
Hello,

I made admin commands but,

I wonder how do i make a setlevel command, I have tried to search a little bit but i couldn't find.

Could anyone help me? If you need to see my ban/kick or any of my other commands i'll show.
What kind of level? Like a players score or a players admin level?


Re: How do i make setlevel command? - Glossy42O - 21.01.2015

Quote:
Originally Posted by CprYseeR
Посмотреть сообщение
PHP код:
CMDsetlevel(playeridparams[])
{
    new 
levelaname[MAX_PLAYER_NAME];
    if(
PlayerInfo[playerid][AdminLevel] != 10) return SendClientMessage(playeridCOLOR_RED"You must be a Lvl 10 Admin to use this command!");
    new 
targetid;
    if(
sscanf(params"ui"targetidlevel)) return SendClientMessage(playeridCOLOR_YELLOW"Correct Usage: /setlevel [PlayerID][Level]");
    if(!
IsPlayerConnected(targetid)) return SendClientMessage(playerid, -1"That player is not connected to the server");
    if(
level || level 10) return SendClientMessage(playeridCOLOR_RED"Admin Level Range Is From 0 To 10");
    if(
targetid != INVALID_PLAYER_ID)
    {
        new 
string1[90], tname[MAX_PLAYER_NAME], string2[90], file[300];
        
PlayerInfo[targetid][AdminLevel]=level;
           
GetPlayerName(targetidtnamesizeof(tname));
        
format(file,sizeof(file),"nAdmin/Users/%s.ini",tname);
        
dini_IntSet(file,"AdminLevel",level);
        
GetPlayerName(playeridanamesizeof(aname));
        
format(string1sizeof(string1), "Admin %s has set your Admin level to %i"anamelevel);
        
SendClientMessage(targetidCOLOR_GREENstring1);
        
GameTextForPlayer(targetid"Promoted!"20005);
        
format(string2sizeof(string1), "{00FF00}Admin %s has set %s's Admin level to %i"anametnamelevel);
        
SendClientMessageToAll(COLOR_YELLOWstring2);
        
SendCommandToAdmins(playerid,"/setlevel");
        
format(string1sizeof(string1), "%s has set %s's Admin Level to %d"anametnamelevel);
        
SaveIn("SetLevelLog",string1);
    }
    else return 
SendClientMessage(playeridCOLOR_RED"ERROR: invalid playerid");
    return 
1;

This Is A Setlevel command you can fix your command see this
That's DINI.

Edit: Nogh, Admin level.


Re: How do i make setlevel command? - nogh445 - 21.01.2015

pawn Код:
CMD:makeadmin(playerid, params[])
{
    if(PlayerInfo[playerid][Admin] == 6 || IsPlayerAdmin(playerid))
    {
        new string[128], pID, slvl;
        if(sscanf(params, "ud", pID,slvl)) return SendClientMessage(playerid, COLOR_RED, "USAGE: /makeadmin [id] [level]");
        if(slvl > 6) return SendClientMessage(playerid, COLOR_RED, "Must be level 0-6");
        format(string, sizeof(string), "Your admin level has been set to %d.", slvl);
        SendClientMessage(pID, COLOR_GREEN, string);

        PlayerInfo[pID][Admin] = slvl;

        format(string, sizeof(string), "You have made %s admin level %d",pName(pID),slvl);
        SendClientMessage(playerid, COLOR_GREEN, string);
    }
    else
    {
        SendClientMessage(playerid, COLOR_RED, "Only certain levels of Administration have access to this command.");
    }
    return 1;
}



Re: How do i make setlevel command? - astanalol - 21.01.2015

try this
u only basic your y_ini > admins
example
Quote:

INI_Int("ARank",PlayerInfo[playerid][pRank]);

and here you go with your admin pAdmins Or idk why u made it
PHP код:
CMD:setrank(playeridparams[])
{
    new 
str[128], ARanklookupid;
    if(
PlayerInfo[playerid][pRank] >= || IsPlayerAdmin(playerid))
    {
        if(
sscanf(params"ui"lookupidARank)) return SendClientMessage(playeridCOLOR_GREEN"Usage: /setrank <PlayerID/PlayerName> <Rank>");
        
format(strsizeof(str), "Admin %s (ID:%d) has setted %s (ID:%d) Rank to (%d)",GetName(playerid), playeridGetName(lookupid), lookupidARank);
        
SendClientMessageToAll(COLOR_LIGHTREDstr);
        
PlayerInfo[lookupid][pRank] = ARank;
    }
    else 
SendClientMessage(playeridCOLOR_RED"you are not Owner");
    return 
1;

only u will change it pRank And ARank > to your name admins and your rank need it here
Quote:

if(PlayerInfo[playerid][pRank] >= 8

its in CMD


Re: How do i make setlevel command? - Glossy42O - 21.01.2015

Quote:
Originally Posted by nogh445
Посмотреть сообщение
pawn Код:
CMD:makeadmin(playerid, params[])
{
    if(PlayerInfo[playerid][Admin] == 6 || IsPlayerAdmin(playerid))
    {
        new string[128], pID, slvl;
        if(sscanf(params, "ud", pID,slvl)) return SendClientMessage(playerid, COLOR_RED, "USAGE: /makeadmin [id] [level]");
        if(slvl > 6) return SendClientMessage(playerid, COLOR_RED, "Must be level 0-6");
        format(string, sizeof(string), "Your admin level has been set to %d.", slvl);
        SendClientMessage(pID, COLOR_GREEN, string);

        PlayerInfo[pID][Admin] = slvl;

        format(string, sizeof(string), "You have made %s admin level %d",pName(pID),slvl);
        SendClientMessage(playerid, COLOR_GREEN, string);
    }
    else
    {
        SendClientMessage(playerid, COLOR_RED, "Only certain levels of Administration have access to this command.");
    }
    return 1;
}
I edited it little bit, But i still can use /ban /kick even if i am not administrator.