SA-MP Forums Archive
[HELP]Can't make myself admin! - 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: [HELP]Can't make myself admin! (/showthread.php?tid=355171)



[HELP]Can't make myself admin! - anito - 29.06.2012

Hello guys. I have login/register using this tutorial link and he had AdminLevel. But, when i tried /kick, /ban command its says that i'm not admin. I change AdminLevel from 0 to 5 but still not recognizing me as admin. But when i type /rcon login pw it's working. I want (i'd like to) that those command are available to smaller level admins not just to RCONs! Thank you in advance.
Sincerely,
anito


Re: [HELP]Can't make myself admin! - leonardo1434 - 29.06.2012

Instead of use this.
pawn Код:
IsPlayerAdmin(playerid)
You should use this:
pawn Код:
if(Adminlevel <= 5 && !IsPlayerAdmin(playerid) return 0;// For levels below 5 and different of Rcon will return 0.



Re: [HELP]Can't make myself admin! - anito - 29.06.2012

Quote:
Originally Posted by leonardo1434
Посмотреть сообщение
Instead of use this.
pawn Код:
IsPlayerAdmin(playerid)
You should use this:
pawn Код:
if(Adminlevel <= 5 && !IsPlayerAdmin(playerid) return 0;// For levels below 5 and different of Rcon will return 0.
I knew it was something with it! Last 5 minutes i tried /makeadmin and it's working, i can kick and ban, but when i reconnect, i'm still non admin! I think I need to add Write_INI and it will add AdminLevel, but again it will not load adminlevel as I said before.


Re: [HELP]Can't make myself admin! - newbienoob - 29.06.2012

Let me see your OnPlayerDisconnect..


Re: [HELP]Can't make myself admin! - anito - 29.06.2012

Quote:
Originally Posted by newbienoob
Посмотреть сообщение
Let me see your OnPlayerDisconnect..
Sir, here it is!
Код:
{
    
    if(fexist(Path(playerid)))
    {
        new INI:file = INI_Open(Path(playerid));
        INI_SetTag(file,"Player's Data");
        INI_WriteInt(file,"AdminLevel",pInfo[playerid][Adminlevel]);
        INI_WriteInt(file,"VIPLevel",pInfo[playerid][VIPlevel]);
        INI_WriteInt(file,"Money",GetPlayerMoney(playerid));
        INI_WriteInt(file,"Scores",GetPlayerScore(playerid));
        INI_WriteInt(file,"Kills",pInfo[playerid][Kills]);
        INI_WriteInt(file,"Deaths",pInfo[playerid][Deaths]);
        INI_Close(file);
        return 1;
    }
    return 1;
}



Re: [HELP]Can't make myself admin! - newbienoob - 29.06.2012

Nothing is wrong there. Maybe a problem with your /makeadmin command. Try this
pawn Код:
CMD:makeadmin(playerid,params[])
{
    if(IsPlayerAdmin(playerid) || pInfo[playerid][AdminLevel] >= 4)
    {
        new tid, tname[MAX_PLAYER_NAME], name[MAX_PLAYER_NAME], str[128], level;
        if(sscanf(params,"ui",tid,level)) return SendClientMessage(playerid,-1,"[USAGE] /makeadmin [ID] [level 1 - 5]");
        if(tid == INVALID_PLAYER_ID) return SendClientMessage(playerid,-1,"Player is not online!");
        if(level > 5) return SendClientMessage(playerid,-1,"Only level 1 - 5 only");
        GetPlayerName(playerid,name,sizeof(name));
        GetPlayerName(tid,tname,sizeof(tname));
        format(str,sizeof(str),"`` Admin %s has made %s(%d) as an admin level %i",name,tname,tid,level);
        pInfo[tid][Admin] = level;
        SendClientMessageToAll(-1,str);
        return 1;
    }
    return 1;
}



Re: [HELP]Can't make myself admin! - anito - 29.06.2012

Quote:
Originally Posted by newbienoob
Посмотреть сообщение
Nothing is wrong there. Maybe a problem with your /makeadmin command. Try this
pawn Код:
CMD:makeadmin(playerid,params[])
{
    if(IsPlayerAdmin(playerid) || pInfo[playerid][AdminLevel] >= 4)
    {
        new tid, tname[MAX_PLAYER_NAME], name[MAX_PLAYER_NAME], str[128], level;
        if(sscanf(params,"ui",tid,level)) return SendClientMessage(playerid,-1,"[USAGE] /makeadmin [ID] [level 1 - 5]");
        if(tid == INVALID_PLAYER_ID) return SendClientMessage(playerid,-1,"Player is not online!");
        if(level > 5) return SendClientMessage(playerid,COLOR_RED,"Only level 1 - 5 only");
        GetPlayerName(playerid,name,sizeof(name));
        GetPlayerName(tid,tname,sizeof(tname));
        format(str,sizeof(str),"`` Admin %s has made %s(%d) as an admin level %i",name,tname,tid,level);
        pInfo[tid][Admin] = level;
        SendClientMessageToAll(-1,str);
        return 1;
    }
    return 1;
}
Ok, i'll try it sir. I made my /makeadmin using this tutorial on SA-MP Wiki link


Re: [HELP]Can't make myself admin! - anito - 29.06.2012

Quote:
Originally Posted by newbienoob
Посмотреть сообщение
Nothing is wrong there. Maybe a problem with your /makeadmin command. Try this
pawn Код:
CMD:makeadmin(playerid,params[])
{
    if(IsPlayerAdmin(playerid) || pInfo[playerid][AdminLevel] >= 4)
    {
        new tid, tname[MAX_PLAYER_NAME], name[MAX_PLAYER_NAME], str[128], level;
        if(sscanf(params,"ui",tid,level)) return SendClientMessage(playerid,-1,"[USAGE] /makeadmin [ID] [level 1 - 5]");
        if(tid == INVALID_PLAYER_ID) return SendClientMessage(playerid,-1,"Player is not online!");
        if(level > 5) return SendClientMessage(playerid,-1,"Only level 1 - 5 only");
        GetPlayerName(playerid,name,sizeof(name));
        GetPlayerName(tid,tname,sizeof(tname));
        format(str,sizeof(str),"`` Admin %s has made %s(%d) as an admin level %i",name,tname,tid,level);
        pInfo[tid][Admin] = level;
        SendClientMessageToAll(-1,str);
        return 1;
    }
    return 1;
}
OK, i tried it. It changes players admin level but still "You are not admin!". Maybe it's something wrong with admin commands. Can you please find some admin commands that will working with my code. +REP


Re: [HELP]Can't make myself admin! - newbienoob - 29.06.2012

Quote:
Originally Posted by anito
Посмотреть сообщение
Ok, i'll try it sir. I made my /makeadmin using this tutorial on SA-MP Wiki link
Under OnPlayerConnect, remove PlayerInfo[playerid][AdminLevel] = 0;


Re: [HELP]Can't make myself admin! - anito - 29.06.2012

Quote:
Originally Posted by newbienoob
Посмотреть сообщение
Under OnPlayerConnect, remove PlayerInfo[playerid][AdminLevel] = 0;
There is no PlayerInfo[playerid][AdminLevel] = 0; in my script!