SA-MP Forums Archive
Player registers with value of 0 in variable - 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: Player registers with value of 0 in variable (/showthread.php?tid=399473)



Player registers with value of 0 in variable - Lz - 14.12.2012

Hey, when ever someone connects to my server for some reason their pLSPD variable is set to value of 5..

my code here should set them to 0 when they first register and then after they login it loads what it was (Wont be changed unless invited to lspd faction)

pawn Код:
if (!response) return Kick(playerid);
            if(response)
            {
                if(!strlen(inputtext)) return ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT, ""COL_WHITE"Registering...",""COL_RED"You have entered an invalid password.\n"COL_WHITE"Type your password below to register a new account.","Register","Quit");
                new INI:File = INI_Open(UserPath(playerid));
                INI_SetTag(File,"data");
                INI_WriteInt(File,"Password",udb_hash(inputtext));
                INI_WriteInt(File,"Cash",0);
                INI_WriteInt(File,"Admin",0);
                INI_WriteInt(File,"LSPD",0);
                INI_WriteInt(File,"Kills",0);
                INI_WriteInt(File,"Deaths",0);
                INI_Close(File);
                ShowPlayerDialog(playerid, DIALOG_SUCCESS_1, DIALOG_STYLE_MSGBOX,""COL_GREEN"Success!","Your account is now registered!\n You have been automatically logged in."COL_GREEN"","Ok","");
                TogglePlayerSpectating(playerid, 0);
                                                         PlayerInfo[playerid][pAdmin] = 0;
                SetSpawnInfo(playerid, 0, 0,1958.3783, 1343.1572, 15.3746,0,0,0,0,0,0,0);
                SpawnPlayer(playerid);
            }
        }
I made the variable loose so you can easily identify it, Thanks


Re: Player registers with value of 0 in variable - Randy More - 14.12.2012

You make them save with the value of 5, but not actually setting them. So basically replace those with their variables' names that way..

pawn Код:
Cash[playerid] = 0;
LSPD[playerid] = 0;