Help with vip system -
1fret - 29.03.2017
So i made this vip system but it keeps giving out free vips to everyplayer that comes online
The code i use to save the player stats below:
PHP код:
forward SaveChar(playerid);
public SaveChar(playerid)
{
new str[60],year,month,day,hour,mins,sec;
getdate(year, month, day);
gettime(hour,mins,sec);
format(str, 60,"%d/%d/%d at %d:%d:%d", day,month,year,hour,mins,sec);
if(!IsPlayerConnected(playerid)) return 1;
new INI:ACCOUNT = INI_Open(UserPath(playerid));
INI_SetTag(ACCOUNT,"data");
INI_WriteInt(ACCOUNT,"Level",pInfo[playerid][Admin]);
INI_WriteInt(ACCOUNT,"Cash",GetPlayerCash(playerid));
INI_WriteInt(ACCOUNT,"Kills",pInfo[playerid][Kills]);
INI_WriteInt(ACCOUNT,"Deaths",pInfo[playerid][Deaths]);
INI_WriteInt(ACCOUNT, "Score",GetPlayerScore(playerid));
INI_WriteInt(ACCOUNT, "Banned",pInfo[playerid][Banned]);
INI_WriteInt(ACCOUNT, "VIP",pInfo[playerid][VIP]);
INI_WriteInt(ACCOUNT, "VIPDay", pInfo[playerid][VIPDay]);
INI_WriteInt(ACCOUNT, "VIPMonth",pInfo[playerid][VIPMonth]);
INI_WriteInt(ACCOUNT, "VIPHour", pInfo[playerid][VIPHour]);
INI_WriteInt(ACCOUNT, "VIPTemp", pInfo[playerid][VIPTemp]);
INI_WriteInt(ACCOUNT,"Hours",pInfo[playerid][Hours]);
INI_WriteInt(ACCOUNT,"Minutes",pInfo[playerid][Minutes]);
INI_WriteInt(ACCOUNT, "pMuted", pInfo[playerid][pMuted]);
INI_WriteString(ACCOUNT, "LastSeen", str);
INI_Close(ACCOUNT);
new string[100];
format(string, 100, "%s's character has saved successfully.", GetName(playerid));
print(string);
return 1;
}
Re: Help with vip system -
AidanRO - 29.03.2017
Can you show us how accounts are loaded / created?
Also, search for pInfo[playerid][VIP] in your script and see if something sets it to 1 (or true) at any point after registration.
Re: Help with vip system -
1fret - 29.03.2017
PHP код:
forward LoadUser_data(playerid,name[],value[]);
public LoadUser_data(playerid,name[],value[])
{
INI_Int("Password",pInfo[playerid][Pass]);
INI_Int("Cash",pInfo[playerid][Cash]);
INI_Int("Level",pInfo[playerid][Admin]);
INI_Int("Kills",pInfo[playerid][Kills]);
INI_Int("Deaths",pInfo[playerid][Deaths]);
INI_Int("Score", pInfo[playerid][Score]);
INI_Int("Banned", pInfo[playerid][Banned]);
INI_Int("VIP", pInfo[playerid][VIP]);
INI_Int("VIPDay", pInfo[playerid][VIPDay]);
INI_Int("VIPMonth", pInfo[playerid][VIPMonth]);
INI_Int("VIPHour", pInfo[playerid][VIPHour]);
INI_Int("VIPTemp", pInfo[playerid][VIPTemp]);
INI_Int("Hours",pInfo[playerid][Hours]);
INI_Int("Minutes",pInfo[playerid][Minutes]);
INI_Int("pMuted",pInfo[playerid][pMuted]);
return 1;
}
PHP код:
switch( dialogid )
{
case DIALOG_REGISTER:
{
if (!response) return Kick(playerid);
if(response)
{
new pIP[16],year,month,day,hour,mins,sec,string[40],str[60];
getdate(year, month, day);
gettime(hour,mins,sec);
format(string, 40,"%d/%d/%d at %d:%d:%d", day,month,year,hour,mins,sec);
format(str, 60,"%d/%d/%d at %d:%d:%d", day,month,year,hour,mins,sec);
GetPlayerIp(playerid,pIP,16);
if(!strlen(inputtext)) return ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT, ""COL_WHITE"Registration Process Error",""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,"Kills",0);
INI_WriteInt(File,"Deaths",0);
INI_WriteInt(File,"Hours",0);
INI_WriteInt(File,"Minutes",0);
INI_WriteString(File, "RegisteredOn", string);
INI_WriteString(File, "RegisteredIP", pIP);
INI_WriteString(File, "LastLoggedIP", pIP);
INI_Close(File);
pInfo[playerid][Hours] =0;
pInfo[playerid][Minutes] =0;
Logged[playerid] = 1;
SetPlayerPos(playerid,1918.1643,1175.7311,18.2846);
SetPlayerCameraLookAt(playerid,1918.1643,1175.7311,18.2846);
SetPlayerCameraPos(playerid,1908.1575,1175.7079,18.2846);
SetPlayerFacingAngle(playerid,91.2061);
SetTimerEx("pTime", 1000, true, "i", playerid);
ShowPlayerDialog(playerid, DIALOG_SUCCESS_1, DIALOG_STYLE_MSGBOX,""COL_WHITE"Success!",""COL_GREEN"Youv'e successfully registered this account in our Database","Ok","");
format(astring, 125, "Your Username has been created in our Database | UserName: %s | Password: %s", GetName(playerid), inputtext);
return SendClientMessage(playerid,green,astring);
}
}
Re: Help with vip system -
AidanRO - 29.03.2017
What is the default value for pVip under enum pInfo?
Also, did you look for any instance that may change pVip's value?
Re: Help with vip system -
1fret - 29.03.2017
PHP код:
enum PlayerInfo
{
Pass,
Cash,
Admin,
Kills,
Deaths,
Score,
Banned,
OnDuty,
Playing,
Hidden,
Spawned,
MaxRcon,
LastSpawnedCar,
dCars[MAX_CAR_SPAWNS],
dSpawnedCars,
LoginAttempts,
Spec,
Warns,
Frozen,
cTime,
Hours,
Minutes,
Muted,
pMuted,
pHouse,
pVHouse,
pSpawnFreeze,
VIP,
VIPDay,
VIPMonth,
VIPHour,
VIPTemp
}
I dont found nothing else
Re: Help with vip system -
1fret - 30.03.2017
bump