Gamemode help - 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: Gamemode help (
/showthread.php?tid=403948)
Gamemode help -
geohareas - 01.01.2013
Hello guys,
Recently i added an VIP system,but it wasnt saving the VIP levels when we log off,so i thought that the VIP system has problem.Today,i realised that my gamemode is not saving the data..
Here is the code:
Код:
//==============================================================================
public OnPlayerDisconnect(playerid, reason)
{
if(IsPlayerNPC(playerid))
{
IsSpawned[playerid] =0;
return 1;
}
if(afktag[playerid] == 1)
{
new pname[16];
GetPlayerName(playerid,pname,16);
strdel(pname, strlen(pname)-5, strlen(pname));
afktag[playerid] =0;
SetPlayerName(playerid,pname);
}
new string[128];
new pname[24];
GetPlayerName(playerid,pname,sizeof(pname));
//Save Wanted Level && Jailtime
SavedWantedLevel[playerid] =GetPlayerWantedLevel(playerid);
SavedJailTime[playerid] =JailTime[playerid];
if(PLAYERLIST_authed[playerid] == 1)
{
dUserSetINT(PlayerName(playerid)).("Bankcash",BankCash[playerid]);
dUserSetINT(PlayerName(playerid)).("Cash",GetPlayerMoney(playerid));
dUserSetINT(PlayerName(playerid)).("Score",GetPlayerScore(playerid));
dUserSetINT(PlayerName(playerid)).("Adminlevel",AdminLevel[playerid]);
dUserSetINT(PlayerName(playerid)).("Army",CanUseArmy[playerid]);
dUserSetINT(PlayerName(playerid)).("CIA",CanUseCIA[playerid]);
dUserSetINT(PlayerName(playerid)).("RegularPlayer",IsRegularPlayer[playerid]);
dUserSetINT(PlayerName(playerid)).("DrugHouseOwner",DrugHouseOwner[playerid]);
dUserSetINT(PlayerName(playerid)).("OttoOwner",OttoOwner[playerid]);
dUserSetINT(PlayerName(playerid)).("TSkill",TerroristSkill[playerid]);
dUserSetINT(PlayerName(playerid)).("RobSkill",RobSkill[playerid]);
dUserSetINT(PlayerName(playerid)).("HasPackC4",HasPackC4[playerid]);
dUserSetINT(PlayerName(playerid)).("HasPackRope",HasPackRope[playerid]);
dUserSetINT(PlayerName(playerid)).("HasPackMoney",HasPackMoney[playerid]);
dUserSetINT(PlayerName(playerid)).("SavedWantedLevel",SavedWantedLevel[playerid]);
dUserSetINT(PlayerName(playerid)).("SavedJailTime",SavedJailTime[playerid]);
}
//Do things to the playerid
ResetVariables(playerid);
TextDrawHideForPlayer(playerid,VersionTD);
TextDrawHideForPlayer(playerid,WebsiteTD);
TextDrawDestroy(MessageTD[playerid]);
TextDrawDestroy(JailTimer[playerid]);
TextDrawDestroy(LocationTD[playerid]);
if (PlayerInfo[playerid][pRoadblock] != 0)
{
RemoveRoadblock(playerid);
}
for(new i = 0; i < sizeof(Objects); i++) ////Xobj
{
if(Player[playerid][view][i])
{
Player[playerid][view][i] = false;
DestroyPlayerObject(playerid,Player[playerid][objid][i]);
}
}
format(string,sizeof(string),"%s Has just left the server! (%s)",pname,aDisconnectNames[reason]);
SendClientMessageToAll(COLOR_VIOLETBLUE,string);
format(string,sizeof(string),"1%s Has just left the server! (%s)",pname,aDisconnectNames[reason]);
IRC_Say(gGroupID,IRC_CHANNEL,string);
return 1;
}
//==============================================================================
Can you help me fix it?Thanks in advance!
Sincerely,
George
PS: Check out my VIP code if possible,to see if there is something wrong there with the code:
Код:
public OnPlayerConnect(playerid)
{
new string[200];
format(string, sizeof(string), " Welcome Back %s your VIP Level is: %d", PlayerName(playerid), Vip[playerid] );
SendClientMessage(playerid ,COLOR_RED, string);
tune[playerid] = 0;
asked1[playerid] = 0;
asked[playerid] = 0;
ship[playerid] = 0;
INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
new INI:File = INI_Open(UserPath(playerid));
INI_SetTag(File,"data");
INI_WriteInt(File,"VIP",0);
INI_Close(File);
return 1;
}
public OnPlayerDisconnect(playerid, reason)
{
if(IsBeingSpeced[playerid] == 1)
{
foreach(Player,i)
{
if(spectatorid[i] == playerid)
{
TogglePlayerSpectating(i,false);
}
}
}
new INI:File = INI_Open(UserPath(playerid));
INI_SetTag(File,"data");
INI_WriteInt(File,"VIP",Vip[playerid]);
INI_Close(File);
if(IsPlayerConnected(playerid)) {
IsLogged[playerid] = false;
}
return 1;
}
forward LoadUser_data(playerid,name[],value[]);
public LoadUser_data(playerid,name[],value[])
{
INI_Int("VIP",PlayerInfo[playerid][pVIP]);
return 1;
}
stock UserPath(playerid)
{
new string[128],playername[MAX_PLAYER_NAME];
GetPlayerName(playerid,playername,sizeof(playername));
format(string,sizeof(string),PATH,playername);
return string;
}
Re: Gamemode help -
geohareas - 01.01.2013
none?