08.03.2014, 14:07
I have actually being experiencing some few bugs, which aren't even giving and errors in the script.
1. If I set a certain player as an admin and he left and another player joined with his ID, he gets his whole stats, SCORE, VIP , Adminship, etc.
2. If you login once, everything loads quick in the logging in textdraws, but if you login the second time, it takes a few seconds till the textdraws load. which is weird.
I'll show you the onplayerconnect and the onplayerdisconnect , script.
thanks to whoever can fix this.
1. If I set a certain player as an admin and he left and another player joined with his ID, he gets his whole stats, SCORE, VIP , Adminship, etc.
2. If you login once, everything loads quick in the logging in textdraws, but if you login the second time, it takes a few seconds till the textdraws load. which is weird.
I'll show you the onplayerconnect and the onplayerdisconnect , script.
Код:
public OnPlayerConnect(playerid) { SetTimerEx("PlayerStats", 1, true, "i", playerid); IsPlayerUsingAnims[playerid] = 0; IsPlayerAnimsPreloaded[playerid] = 0; if(fexist(Path_2(playerid))) { INI_ParseFile(Path_2(playerid),"LoadPostiondata_%s", .bExtra = true, .extra = playerid); } else { new INI:file = INI_Open(Path_2(playerid)); INI_SetTag(file,"Player Car-Saver Data"); INI_WriteFloat(file,"(1)Postion-PosX",0); INI_WriteFloat(file,"(1)Postion-PosY",0); INI_WriteFloat(file,"(1)Postion-PosZ",0); INI_WriteInt(file,"(1)Interior",0); INI_WriteFloat(file,"(2)Postion-PosX",0); INI_WriteFloat(file,"(2)Postion-PosY",0); INI_WriteFloat(file,"(2)Postion-PosZ",0); INI_WriteInt(file,"(2)Interior",0); INI_WriteFloat(file,"(3)Postion-PosX",0); INI_WriteFloat(file,"(3)Postion-PosY",0); INI_WriteFloat(file,"(3)Postion-PosZ",0); INI_WriteInt(file,"(3)Interior",0); INI_WriteFloat(file,"(4)Postion-PosX",0); INI_WriteFloat(file,"(4)Postion-PosY",0); INI_WriteFloat(file,"(4)Postion-PosZ",0); INI_WriteInt(file,"(4)Interior",0); INI_WriteFloat(file,"(5)Postion-PosX",0); INI_WriteFloat(file,"(5)Postion-PosY",0); INI_WriteFloat(file,"(5)Postion-PosZ",0); INI_WriteInt(file,"(5)Interior",0); INI_Close(file); } new pFile[35]; format(pFile, 35, Player_File, GetName(playerid)); if(fexist(pFile)) { new INI:UserFile = INI_Open(pFile); INI_WriteInt(UserFile, "Admin", 0); INI_WriteInt(UserFile, "Money", START_MONEY); INI_WriteInt(UserFile, "Score", 0); INI_WriteInt(UserFile, "Skin", SKIN_ID); INI_WriteInt(UserFile, "Warn", 0); INI_WriteInt(UserFile, "VIP", 0); INI_Close(UserFile); SetPVarInt(playerid, "Registered", 1); SetPVarInt(playerid, "Logged", 0); } else { INI_ParseFile(pFile, "LoadPlayerData", .bExtra = true, .extra = playerid); SetPVarInt(playerid, "Logged", 1); } SetPVarInt(playerid, "Join", 1); IsOnDuty[playerid]=0; pvehicleid[playerid] = GetPlayerVehicleID(playerid); pvehicleid[playerid] = 0; pmodelid[playerid] = 0; SetTimerEx("StartBurn", 30000, false, "i", playerid); SetTimerEx("StartFix", 30000, false, "i", playerid); SetTimerEx("StartHeal", 30000, false, "i", playerid); IsLogged[playerid]=0; Rank[playerid]=0; m_w1[playerid]=1; m_w2[playerid]=1; m_w3[playerid]=1; m_w4[playerid]=1; Attach3DTextLabelToPlayer(PlayerLabel[playerid], playerid, 0.0, 0.0, 0.7); IsPlayerCapturing[playerid][SNAKE] = 0; IsPlayerCapturing[playerid][BAY] = 0; IsPlayerCapturing[playerid][BIG] = 0; IsPlayerCapturing[playerid][ARMY] = 0; IsPlayerCapturing[playerid][PETROL] = 0; IsPlayerCapturing[playerid][OIL] = 0; IsPlayerCapturing[playerid][DESERT] = 0; IsPlayerCapturing[playerid][QUARRY] = 0; IsPlayerCapturing[playerid][GUEST] = 0; IsPlayerCapturing[playerid][EAR] = 0; CountVar[playerid][SNAKE] = 25; CountVar[playerid][BAY] = 25; CountVar[playerid][BIG] = 25; CountVar[playerid][PETROL] = 25; CountVar[playerid][ARMY] = 25; CountVar[playerid][DESERT] = 25; CountVar[playerid][OIL] = 25; CountVar[playerid][QUARRY] = 25; CountVar[playerid][GUEST] = 25; CountVar[playerid][EAR] = 25; if(tCP[SNAKE] == TEAM_NONE) GangZoneShowForAll(Zone[SNAKE], -66); else if(tCP[SNAKE] == ASIA) GangZoneShowForAll(Zone[SNAKE], ZONE_ASIA_COLOR); else if(tCP[SNAKE] == AFRICA) GangZoneShowForAll(Zone[SNAKE], ZONE_AFRICA_COLOR); else if(tCP[SNAKE] == EUROPE) GangZoneShowForAll(Zone[SNAKE], ZONE_EUROPE_COLOR); else if(tCP[SNAKE] == AUSTRALIA) GangZoneShowForAll(Zone[SNAKE], ZONE_AUSTRALIA_COLOR); else if(tCP[SNAKE] == AMERICA) GangZoneShowForAll(Zone[SNAKE], ZONE_AMERICA_COLOR); //------ if(tCP[BAY] == TEAM_NONE) GangZoneShowForAll(Zone[BAY], -66); else if(tCP[BAY] == ASIA) GangZoneShowForAll(Zone[BAY], ZONE_ASIA_COLOR); else if(tCP[BAY] == AFRICA) GangZoneShowForAll(Zone[BAY], ZONE_AFRICA_COLOR); else if(tCP[BAY] == EUROPE) GangZoneShowForAll(Zone[BAY], ZONE_EUROPE_COLOR); else if(tCP[BAY] == AUSTRALIA) GangZoneShowForAll(Zone[BAY], ZONE_AUSTRALIA_COLOR); else if(tCP[BAY] == AMERICA) GangZoneShowForAll(Zone[BAY], ZONE_AMERICA_COLOR); //------ if(tCP[BIG] == TEAM_NONE) GangZoneShowForAll(Zone[BIG], -66); else if(tCP[BIG] == ASIA) GangZoneShowForAll(Zone[BIG], ZONE_ASIA_COLOR); else if(tCP[BIG] == AFRICA) GangZoneShowForAll(Zone[BIG], ZONE_AFRICA_COLOR); else if(tCP[BIG] == EUROPE) GangZoneShowForAll(Zone[BIG], ZONE_EUROPE_COLOR); else if(tCP[BIG] == AUSTRALIA) GangZoneShowForAll(Zone[BIG], ZONE_AUSTRALIA_COLOR); else if(tCP[BIG] == AMERICA) GangZoneShowForAll(Zone[BIG], ZONE_AMERICA_COLOR); //------ if(tCP[ARMY] == TEAM_NONE) GangZoneShowForAll(Zone[ARMY], -66); else if(tCP[ARMY] == ASIA) GangZoneShowForAll(Zone[ARMY], ZONE_ASIA_COLOR); else if(tCP[ARMY] == AFRICA) GangZoneShowForAll(Zone[ARMY], ZONE_AFRICA_COLOR); else if(tCP[ARMY] == EUROPE) GangZoneShowForAll(Zone[ARMY], ZONE_EUROPE_COLOR); else if(tCP[ARMY] == AUSTRALIA) GangZoneShowForAll(Zone[ARMY], ZONE_AUSTRALIA_COLOR); else if(tCP[ARMY] == AMERICA) GangZoneShowForAll(Zone[ARMY], ZONE_AMERICA_COLOR); //------ if(tCP[PETROL] == TEAM_NONE) GangZoneShowForAll(Zone[PETROL], -66); else if(tCP[PETROL] == ASIA) GangZoneShowForAll(Zone[PETROL], ZONE_ASIA_COLOR); else if(tCP[PETROL] == AFRICA) GangZoneShowForAll(Zone[PETROL], ZONE_AFRICA_COLOR); else if(tCP[PETROL] == EUROPE) GangZoneShowForAll(Zone[PETROL], ZONE_EUROPE_COLOR); else if(tCP[PETROL] == AUSTRALIA) GangZoneShowForAll(Zone[PETROL], ZONE_AUSTRALIA_COLOR); else if(tCP[PETROL] == AMERICA) GangZoneShowForAll(Zone[PETROL], ZONE_AMERICA_COLOR); //------ if(tCP[OIL] == TEAM_NONE) GangZoneShowForAll(Zone[OIL], -66); else if(tCP[OIL] == ASIA) GangZoneShowForAll(Zone[OIL], ZONE_ASIA_COLOR); else if(tCP[OIL] == AFRICA) GangZoneShowForAll(Zone[OIL], ZONE_AFRICA_COLOR); else if(tCP[OIL] == EUROPE) GangZoneShowForAll(Zone[OIL], ZONE_EUROPE_COLOR); else if(tCP[OIL] == AUSTRALIA) GangZoneShowForAll(Zone[OIL], ZONE_AUSTRALIA_COLOR); else if(tCP[OIL] == AMERICA) GangZoneShowForAll(Zone[OIL], ZONE_AMERICA_COLOR); //------ if(tCP[DESERT] == TEAM_NONE) GangZoneShowForAll(Zone[DESERT], -66); else if(tCP[DESERT] == ASIA) GangZoneShowForAll(Zone[DESERT], ZONE_ASIA_COLOR); else if(tCP[DESERT] == AFRICA) GangZoneShowForAll(Zone[DESERT], ZONE_AFRICA_COLOR); else if(tCP[DESERT] == EUROPE) GangZoneShowForAll(Zone[DESERT], ZONE_EUROPE_COLOR); else if(tCP[DESERT] == AUSTRALIA) GangZoneShowForAll(Zone[DESERT], ZONE_AUSTRALIA_COLOR); else if(tCP[DESERT] == AMERICA) GangZoneShowForAll(Zone[DESERT], ZONE_AMERICA_COLOR); //------ if(tCP[QUARRY] == TEAM_NONE) GangZoneShowForAll(Zone[QUARRY], -66); else if(tCP[QUARRY] == ASIA) GangZoneShowForAll(Zone[QUARRY], ZONE_ASIA_COLOR); else if(tCP[QUARRY] == AFRICA) GangZoneShowForAll(Zone[QUARRY], ZONE_AFRICA_COLOR); else if(tCP[QUARRY] == EUROPE) GangZoneShowForAll(Zone[QUARRY], ZONE_EUROPE_COLOR); else if(tCP[QUARRY] == AUSTRALIA) GangZoneShowForAll(Zone[QUARRY], ZONE_AUSTRALIA_COLOR); else if(tCP[QUARRY] == AMERICA) GangZoneShowForAll(Zone[QUARRY], ZONE_AMERICA_COLOR); //------ if(tCP[GUEST] == TEAM_NONE) GangZoneShowForAll(Zone[GUEST], -66); else if(tCP[GUEST] == ASIA) GangZoneShowForAll(Zone[GUEST], ZONE_ASIA_COLOR); else if(tCP[GUEST] == AFRICA) GangZoneShowForAll(Zone[GUEST], ZONE_AFRICA_COLOR); else if(tCP[GUEST] == EUROPE) GangZoneShowForAll(Zone[GUEST], ZONE_EUROPE_COLOR); else if(tCP[GUEST] == AUSTRALIA) GangZoneShowForAll(Zone[GUEST], ZONE_AUSTRALIA_COLOR); else if(tCP[GUEST] == AMERICA) GangZoneShowForAll(Zone[GUEST], ZONE_AMERICA_COLOR); //------ if(tCP[EAR] == TEAM_NONE) GangZoneShowForAll(Zone[EAR], -66); else if(tCP[EAR] == ASIA) GangZoneShowForAll(Zone[EAR], ZONE_ASIA_COLOR); else if(tCP[EAR] == AFRICA) GangZoneShowForAll(Zone[EAR], ZONE_AFRICA_COLOR); else if(tCP[EAR] == EUROPE) GangZoneShowForAll(Zone[EAR], ZONE_EUROPE_COLOR); else if(tCP[EAR] == AUSTRALIA) GangZoneShowForAll(Zone[EAR], ZONE_AUSTRALIA_COLOR); else if(tCP[EAR] == AMERICA) GangZoneShowForAll(Zone[EAR], ZONE_AMERICA_COLOR); //----- UpdateTimer[playerid] = KillTimer(UpdateTimer[playerid]); if(Captured[playerid][SNAKE] == 0 && IsPlayerCapturing[playerid][SNAKE] == 1) { LeavingSnakeFarm(playerid); } if(Captured[playerid][BAY] == 0 && IsPlayerCapturing[playerid][BAY] == 1) { LeavingBay(playerid); } if(Captured[playerid][BIG] == 0 && IsPlayerCapturing[playerid][BIG] == 1) { LeavingEar(playerid); } if(Captured[playerid][ARMY] == 0 && IsPlayerCapturing[playerid][ARMY] == 1) { LeavingArmy(playerid); } if(Captured[playerid][PETROL] == 0 && IsPlayerCapturing[playerid][PETROL] == 1) { LeavingPetrol(playerid); } if(Captured[playerid][OIL] == 0 && IsPlayerCapturing[playerid][OIL] == 1) { LeavingOil(playerid); } if(Captured[playerid][DESERT] == 0 && IsPlayerCapturing[playerid][DESERT] == 1) { LeavingDesert(playerid); } if(Captured[playerid][QUARRY] == 0 && IsPlayerCapturing[playerid][QUARRY] == 1) { LeavingQuarry(playerid);} if(Captured[playerid][GUEST] == 0 && IsPlayerCapturing[playerid][GUEST] == 1) { LeavingGuest(playerid);} if(Captured[playerid][EAR] == 0 && IsPlayerCapturing[playerid][EAR] == 1) { LeavingEar(playerid); } first_connect[playerid]=1; return 1; }
Код:
public OnPlayerDisconnect(playerid, reason) { RemovePlayerAttachedObject(playerid, 0); 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_WriteInt(file,"Time-Seconds",pInfo[playerid][Seconds]); INI_WriteInt(file,"Time-Minutes",pInfo[playerid][Minutes]); INI_WriteInt(file,"Time-Hours",pInfo[playerid][Hours]); INI_WriteInt(file,"Banned",pInfo[playerid][Banned]); INI_WriteInt(file,"Warlord-I",pInfo[playerid][Warlord1]); INI_WriteInt(file,"Warlord-II",pInfo[playerid][Warlord2]); INI_WriteInt(file,"Warlord-III",pInfo[playerid][Warlord3]); INI_Close(file); } new pFile[35]; format(pFile, 35, Player_File, GetName(playerid)); new INI:UserFile = INI_Open(pFile); INI_WriteInt(UserFile, "Admin", P_Data[playerid][pAdmin]); INI_WriteInt(UserFile, "Money", GetPlayerMoney(playerid)); INI_WriteInt(UserFile, "Score", GetPlayerScore(playerid)); INI_WriteInt(UserFile, "Skin", P_Data[playerid][pSkin]); INI_WriteInt(UserFile, "Warn", P_Data[playerid][pWarn]); INI_Close(UserFile); if(fexist(Path_2(playerid))) { new INI:file = INI_Open(Path_2(playerid)); INI_SetTag(file,"Player Car-Saver Data"); INI_WriteFloat(file,"(1)Postion-PosX",PositionSaver[playerid][PosX1]); INI_WriteFloat(file,"(1)Postion-PosY",PositionSaver[playerid][PosY1]); INI_WriteFloat(file,"(1)Postion-PosZ",PositionSaver[playerid][PosZ1]); INI_WriteInt(file,"(1)Interior",PositionSaver[playerid][Interior1]); INI_WriteFloat(file,"(2)Postion-PosX",PositionSaver[playerid][PosX2]); INI_WriteFloat(file,"(2)Postion-PosY",PositionSaver[playerid][PosY2]); INI_WriteFloat(file,"(2)Postion-PosZ",PositionSaver[playerid][PosZ2]); INI_WriteInt(file,"(2)Interior",PositionSaver[playerid][Interior2]); INI_WriteFloat(file,"(3)Postion-PosX",PositionSaver[playerid][PosX3]); INI_WriteFloat(file,"(3)Postion-PosY",PositionSaver[playerid][PosY3]); INI_WriteFloat(file,"(3)Postion-PosZ",PositionSaver[playerid][PosZ3]); INI_WriteInt(file,"(3)Interior",PositionSaver[playerid][Interior3]); INI_WriteFloat(file,"(4)Postion-PosX",PositionSaver[playerid][PosX4]); INI_WriteFloat(file,"(4)Postion-PosY",PositionSaver[playerid][PosY4]); INI_WriteFloat(file,"(4)Postion-PosZ",PositionSaver[playerid][PosZ4]); INI_WriteInt(file,"(4)Interior",PositionSaver[playerid][Interior4]); INI_WriteFloat(file,"(5)Postion-PosX",PositionSaver[playerid][PosX5]); INI_WriteFloat(file,"(5)Postion-PosY",PositionSaver[playerid][PosY5]); INI_WriteFloat(file,"(5)Postion-PosZ",PositionSaver[playerid][PosZ5]); INI_WriteInt(file,"(5)Interior",PositionSaver[playerid][Interior5]); INI_Close(file); } return 1; }