[REP+]gadmin all level 1 at connect...
#1

hey guys,

i have downloaded the Gadmin script, cuz its EPICCC anyways i have a bugg that when a player connects to the server or spawns, i dont know excactly when it happens but at the connect or spawn the player gets level 1 admin... i already checked the connect code and requestspawn AND onplayerspawn callbacks but all dont work.

anyways here are the codes:
onplayerconnect:
pawn Код:
public OnPlayerConnect(playerid)
{
    if(IsPlayerNPC(playerid)) return 0;
    new
        i,
        sAliasEntry[ALIAS_ENTRY_LEN],
        IP[16],
        x[128],
        ThePlayer[MAX_PLAYER_NAME];
    ResetPlayerFlag(playerid);
    PlayerInfo[playerid][Deaths] = 0;
    PlayerInfo[playerid][Kills] = 0;
    PlayerInfo[playerid][PingWarnings] = 0;
    PlayerInfo[playerid][WrongPW] = 0;
    PlayerInfo[playerid][AdminLevel] = 0;
    PlayerInfo[playerid][iSpamRelease] = -1;
    #if _SAMP_VERSION >= 0300
    PlayerInfo[playerid][iDialogID] = -1;
    #endif
    #if !defined NO_JAIL_COUNT
    PlayerInfo[playerid][JailCount] = -1;
    #endif
    PlayerInfo[playerid][DisconnectReason] = -1;
    SetDefaultPlayerLanguageID(playerid,def_printlanguage);      // Default Language English
    #if defined EXTRA_COMMANDS
    PlayerInfo[playerid][BankMoney] = 0;
    #endif
    PlayerInfo[playerid][LameCounter] = 0;
    PlayerInfo[playerid][SpawnCount] = 0;
    #if defined SPECTATE_MODE
    PlayerInfo[playerid][Spec]=FREE_SPEC_ID;
    #endif
    PlayerInfo[playerid][BadWordCount] = 0;
    PlayerInfo[playerid][ExMenu] = 0;
    #if defined ANTI_FLOOD
    PlayerInfo[playerid][SpamCount] = 0;
    PlayerInfo[playerid][WrongRCON] = 0;
    PlayerInfo[playerid][TickLastSpamCheck]=GetTickCount();
    #endif
    #if defined DISPLAY_MODE
    PlayerInfo[playerid][speedo_type]=KMH_MODE;       // Default SpeedoType
    if(g_Display != 0) {
        AddPlayerFlag(playerid,PLAYER_FLAG_SPEEDO);
    }
    #if defined DISPLAY_MODE_TD
        CreatePlayerDraw(playerid);
        TextDrawHideForPlayer(playerid,PlayerInfo[playerid][td_PlayerDraw]);
    #endif
    #endif
    #if defined PMBIND_INCLUDE
    BindPlayerPM(playerid,INVALID_PLAYER_ID);
    #endif
    //Vote System
    for( i = 0  ; i < g_Max_Players ; i++) {
        ResetPlayerExtraFlag(playerid,i);
    }
    PlayerInfo[playerid][VKickCount] = 0;
    PlayerInfo[playerid][VBanCount] = 0;
    for( i = 0 ; i < 6 ; i++) {
        PlayerInfo[i][fSave][i] = 0.0;
    }
    //
    GetPlayerIp(playerid,IP,sizeof(IP));
    GetPlayerName(playerid,ThePlayer,sizeof(ThePlayer));
    WriteAliasListEntry(playerid,ThePlayer,IP);
    format(x,sizeof(x),"{FFFF00}Player {FF0000}%s (Id:%d) {FFFF00}has Joined {FF0000}Galaxy FreeRoam",ThePlayer, playerid);
    format(s,sizeof(s),"%s [IP:%s]",x,IP);
    format(sAliasEntry,sizeof(sAliasEntry),GetAliasEntry( IP, ThePlayer ));
    for( i=0 ; i < g_Max_Players ; i++) {
        if(IsPlayerConnected(i)) {
            if(PlayerInfo[i][AdminLevel]>=2) {
                SendClientMessage(i,COLOR_LIGHTBLUE,s);
            }
            if(g_bShow_EnterLeave && 2 > PlayerInfo[i][AdminLevel]) {
                SendClientMessage(i,COLOR_GREY,x);
            }
            if(PlayerInfo[i][AdminLevel] >= g_Level[lgetalias]) {
                SendClientMessage(i,COLOR_YELLOW,sAliasEntry);
            }
        }
    }
    WriteLog(clearlog,sAliasEntry);
    WriteLog(clearlog,x);
    #if defined IRC
        format(x,sizeof(x),"3%s",x);
        IRC_Say(EchoBot, EchoChan, x);
    #endif

    if(g_bWhiteStatus) {
        ReadWhiteList(playerid, ThePlayer);
    }
    if(g_bBlackListStatus) {
        ReadBlacklist(playerid, ThePlayer);
    }
    if(g_bClangBlackListStatus) {
        ReadClanBlacklist(playerid, ThePlayer);
    }
    ReadIPBans(playerid, IP);

    for( i = 0 ; i < 9 ; i++) { // Clear Chat
        SendClientMessage(playerid,COLOR_DARKRED," \n");
    }
    #if defined LOCK_MODE
    for( i = 0 ; i < MAX_VEHICLES ; i++) { //We need to lock locked vehicles for this player too
        if(IsVehicleFlag(i,VEHICLE_FLAG_LOCK)) {
            SetVehicleParamsForPlayer(i,playerid,0,true);
        }
    }
    #endif
    // Automatic Login
    #if defined MYSQL
    if(gSQL_ExistUser(ThePlayer)) {
    #else
    if(udb_Exists(ThePlayer)) {
    #endif
        // Trusted -1 means Banned
        #if defined MYSQL
        if(gSQL_GetUserVarAsInteger(ThePlayer,"Trusted") == -1 ) {
        #else
        if(dUserINT(ThePlayer).("Trusted") == -1 ) {
        #endif
            BanEx2(playerid,13);
        }
        if(g_bIPComp) {
            #if defined MYSQL
            if(!strcmp(IP,gSQL_GetUserVar(ThePlayer,"IP"),true,sizeof(IP))) {
            #else
            if(!strcmp(IP,dUser(ThePlayer).("IP"),true,sizeof(IP))) {
            #endif
                OnPlayerLogin(playerid,LOGIN_AUTOIP);
            }
            else {
                SendClientLanguageMessage(playerid,COLOR_RED2,"txt_userexists",#CMD_LOGIN);
                #if defined LOGIN_PANEL
                if(g_bForceDialog) {
                    PlayerInfo[playerid][tLoginPanel] = SetTimerEx("ShowLoginDialog",MS_LOGIN_DIALOG,false,"d",playerid);
                }
                #endif
            }
        }
        /*
            If IPComparing is false and he doesnt get
            logged in,
            he needs to know that this profile exists
        */

        else {
            SendClientLanguageMessage(playerid,COLOR_RED2,"txt_userexists",#CMD_LOGIN);
            SendClientLanguageMessage(playerid,COLOR_GREEN,"txt_selectlanguage");
            #if defined LOGIN_PANEL
            if(g_bForceDialog) {
                PlayerInfo[playerid][tLoginPanel] = SetTimerEx("ShowLoginDialog",MS_LOGIN_DIALOG,false,"d",playerid);
            }
            #endif
        }
    }
    else {
        PlayerInfo[playerid][tickConnect] = GetTickCount();
        if(g_bRegisterSpawn) {
            SendClientLanguageMessage(playerid,COLOR_WHITE,"txt_registerspawn1");
        }
        else {
            SendClientLanguageMessage(playerid,COLOR_RED2,"txt_register7",#CMD_REGISTER);
        }
    }
    SendClientMessage(playerid,COLOR_WHITE,"_____________________");
    SendClientMessage(playerid,COLOR_ORANGE,g_sAdvertise);
    SendClientLanguageMessage(playerid,COLOR_ORANGE,"txt_welcome",ThePlayer,#CMD_COMMANDS);
    SendClientMessage(playerid,COLOR_WHITE,"_____________________");
    //CheckTimers();
    #if defined gDebug
    printf("disconnect reason connect = %d",PlayerInfo[playerid][DisconnectReason]);
    #endif
    return 1;
}
onplayerspawn:
pawn Код:
public OnPlayerSpawn(playerid)
{
    if(IsPlayerFlag(playerid,PLAYER_FLAG_JAIL)) {
        SetJail(playerid,true);
        return 1;
    }
    PlayerInfo[playerid][SpawnCount]++;
    if(IsPlayerFlag(playerid,PLAYER_FLAG_FREEZE)) {
        TogglePlayerControllable(playerid,false);
        return 1;
    }
    if(!IsPlayerFlag(playerid,PLAYER_FLAG_LOGINCHECK)){
        if(g_MAX_LOGIN_TIME!=-1) {
            if(!IsPlayerFlag(playerid,PLAYER_FLAG_LOGGEDIN)) {
                #if defined MYSQL
                if(gSQL_ExistUser(PlayerName(playerid))) {
                #else
                if(udb_Exists(PlayerName(playerid))) {
                #endif
                    KillTimer(PlayerInfo[playerid][tLogin]); // If there might be still a timer,destroy it!
                    SendClientLanguageMessage(playerid,COLOR_ORANGE,"txt_LoginSpawn",g_MAX_LOGIN_TIME);
                    PlayerInfo[playerid][tLogin] = SetTimerEx("Login",g_MAX_LOGIN_TIME*1000,0,"i",playerid);
                    AddPlayerFlag(playerid,PLAYER_FLAG_LOGINCHECK);
                    return 1;
                }
            }
        }
    }
    return 1;
}
requestspawn:
pawn Код:
public OnPlayerRequestSpawn(playerid)
{
    if(g_bRegisterSpawn) {
        #if defined LOGIN_PANEL
        if(IsPlayerFlag(playerid,PLAYER_FLAG_LOGINPANEL)) {
            return 0;
        }
        #endif
        if(!IsPlayerFlag(playerid,PLAYER_FLAG_LOGGEDIN)) {
            #if defined MYSQL
            if(!gSQL_ExistUser(PlayerName(playerid))) {
            #else
            if(!udb_Exists(PlayerName(playerid))) {
            #endif
                GameTextForPlayer(playerid,GetLanguageString(GetPlayerLanguageID(playerid),"txt_registerspawn2"),3*1000,5);
                PlayerPlaySound(playerid,1055 ,0.0,0.0,0.0);
                if(GetTickCount() > (PlayerInfo[playerid][TickRegMsg] + REGMSG_DELAY) ) {
                    DeletePlayerFlag(playerid,PLAYER_FLAG_REGISTERMSG);
                }
                if(!IsPlayerFlag(playerid,PLAYER_FLAG_REGISTERMSG)) {
                    SendClientLanguageMessage(playerid,COLOR_RED2,"txt_registerspawn3",#CMD_REGISTER);
                    PlayerInfo[playerid][TickRegMsg]=GetTickCount();
                    AddPlayerFlag(playerid,PLAYER_FLAG_REGISTERMSG);
                }
                return 0;
            }
            else { // Force to login!
                GameTextForPlayer(playerid,GetLanguageString(GetPlayerLanguageID(playerid),"txt_registerspawn5"),3*1000,5);
                PlayerPlaySound(playerid,1055 ,0.0,0.0,0.0);
                if(GetTickCount() > (PlayerInfo[playerid][TickRegMsg] + REGMSG_DELAY) ) {
                    DeletePlayerFlag(playerid,PLAYER_FLAG_REGISTERMSG);
                }
                if(!IsPlayerFlag(playerid,PLAYER_FLAG_REGISTERMSG)) {
                    SendClientLanguageMessage(playerid,COLOR_RED2,"txt_registerspawn6",#CMD_LOGIN);
                    PlayerInfo[playerid][TickRegMsg]=GetTickCount();
                    AddPlayerFlag(playerid,PLAYER_FLAG_REGISTERMSG);
                }
                return 0;

            }
        }
    }
    return 1;
}
pls help, i really want this admin system and i want to fix this stupid bugg

the one who helps me gets REP+
Reply
#2

Try to put the following line under "OnPlayerSpawn":

pawn Код:
PlayerInfo[playerid][AdminLevel] = 0;
Reply
#3

Quote:
Originally Posted by Twisted_Insane
Посмотреть сообщение
Try to put the following line under "OnPlayerSpawn":

pawn Код:
PlayerInfo[playerid][AdminLevel] = 0;

I think this should be under
OnPlayerConnect callback ?
Reply
#4

as first, when placing it under onplayerspawn, and a player SHOULD be admin, so at previous disconnect he was for example lvl 3, and then when spawning again he gets level 0? i dont know if thats right but i rthink that will happen, but i will try it, and second, PlayerInfo[playerid][AdminLevel] = 0; is ALREADY under onplayerconnect...

anyways i will try it but i dont think it will fix it, but i will try

also any other options??
Reply
#5

Yeah, try to remove the line under "OnPlayerConnect", otherwise, the adminlevel would NEVER save! It's a redundant line...
Reply
#6

so you mean i have to remove the PlayerInfo[playerid][AdminLevel] = 0; from onplayerconnect?

EDIT: also when placing it under onplayerspawn it gives me lvl 0, but i am lvl 5... so aint working
Reply
#7

Yeah, delete it! I mean, the adminlevel will get saved, right? So why the hell setting it to '0' again when connecting?
Reply
#8

cuz at requestclass they FIRST have to login... so when the connect they arent logged in and they have to be level 0...

and then when at requestclass and selecting skin and then when pressing the button SPAWN then they first have to login...

any options? cuz removing it also Dont works
Reply
#9

bump?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)