27.03.2013, 01:20
Hi, I have been having two major bugs that are really annoying.
Im not sure if it's suppose to do this but apparently it's not so im wondering if anyone could let me know how to fix it.
1) When ever I do a gmx restart, players skins, xPos, yPos and zPos do not save and it's really annoying. I have no idea why it's happening as i am definitely saving the account info on OnPlayerDisconnect
2) When a player connects and logins, they get the 'spawn' option(which i want to remove too) and if they click it; they die.
What I need help with: GMX resetting some pInfo, and death on spawn.
If anyone could help me out that would be awesome
Thanks alot to anyone who replies.
Heres my pInfo enum
Heres my SaveAccountInfo function:
OnPlayerConnect
Heres my OnPlayerDisconnect()
Im not sure if it's suppose to do this but apparently it's not so im wondering if anyone could let me know how to fix it.
1) When ever I do a gmx restart, players skins, xPos, yPos and zPos do not save and it's really annoying. I have no idea why it's happening as i am definitely saving the account info on OnPlayerDisconnect

2) When a player connects and logins, they get the 'spawn' option(which i want to remove too) and if they click it; they die.
What I need help with: GMX resetting some pInfo, and death on spawn.
If anyone could help me out that would be awesome
Thanks alot to anyone who replies.
Heres my pInfo enum
pawn Код:
enum pInfo
{
pName[24],
pPass,
pCash,
pSkin,
pLevel,
pVipLevel,
pInt,
pVW,
pAdmin,
aName[24],
bool:HasSetAdminName,
OnDuty,
pSecKey,
pKills,
pDeaths,
pGod,
Float:pFacingAngle,
Float:pHealth,
Float:pArmour,
Float:pLastX,
Float:pLastY,
Float:pLastZ,
pFaction,
pFRank
}
pawn Код:
public SaveAccountInfo(playerid)
{
new cash = GetPlayerMoney(playerid);
new skin = GetPlayerSkin(playerid);
new level = GetPlayerScore(playerid);
new inter = GetPlayerInterior(playerid);
new vw = GetPlayerVirtualWorld(playerid);
PlayerInfo[playerid][OnDuty] = false;
new Float:X, Float:Y, Float:Z;
new Float:facingangle;
new Float:health, Float:armour;
new faction, rank;
faction = PlayerInfo[playerid][pFaction];
rank = PlayerInfo[playerid][pFRank];
GetPlayerHealth(playerid, health);
GetPlayerArmour(playerid, armour);
GetPlayerFacingAngle(playerid, facingangle);
GetPlayerPos(playerid, X, Y, Z);
new INI:File = INI_Open(UserPath(playerid));
INI_SetTag(File,"data");
INI_WriteString(File,"pName", PlayerInfo[playerid][pName]);
INI_WriteInt(File,"Cash",cash);
INI_WriteInt(File,"Skin",skin);
INI_WriteInt(File,"Level",level);
INI_WriteInt(File,"Vip", PlayerInfo[playerid][pVipLevel]);
INI_WriteInt(File,"Int",inter);
INI_WriteInt(File,"VW",vw);
INI_WriteInt(File,"Admin",PlayerInfo[playerid][pAdmin]);
INI_WriteString(File,"AdminName", PlayerInfo[playerid][aName]);
INI_WriteBool(File,"HasSetAdminName", PlayerInfo[playerid][HasSetAdminName]);
INI_WriteInt(File,"SecKey",PlayerInfo[playerid][pSecKey]);
INI_WriteInt(File,"OnDuty",PlayerInfo[playerid][OnDuty]);
//INI_WriteInt(File,"Kills",PlayerInfo[playerid][pKills]);
//INI_WriteInt(File,"Deaths",PlayerInfo[playerid][pDeaths]);
INI_WriteFloat(File, "Health", health);
INI_WriteFloat(File, "Armour", armour);
INI_WriteFloat(File, "FacingAngle", facingangle);
INI_WriteFloat(File, "LastX", X);
INI_WriteFloat(File, "LastY", Y);
INI_WriteFloat(File, "LastZ", Z);
INI_WriteInt(File, "Faction", faction);
INI_WriteInt(File, "Rank", rank);
INI_Close(File);
return 1;
}
pawn Код:
public OnPlayerConnect(playerid)
{
SetPlayerCameraPos(playerid, 260.9846, -2048.4597, 99.0365);
SetPlayerCameraLookAt(playerid, 261.6099, -2047.6786, 98.8322);
SendClientMessage(playerid, COLOR_BLUE, "Current version: "SERVER_VERSION"");
SendClientMessage(playerid, COLOR_LIGHTBLUE, "Type /(h)elp for a list of helpful commands!");
SetPlayerColor(playerid, COLOR_WHITE);
PlayerInfo[playerid][OnDuty] = false;
PlayerInfo[playerid][pGod] = 0;
//Anti Dual Wield.
SetPlayerSkillLevel(playerid, WEAPONSKILL_PISTOL, 0);
SetPlayerSkillLevel(playerid, WEAPONSKILL_SAWNOFF_SHOTGUN, 0);
SetPlayerSkillLevel(playerid, WEAPONSKILL_MICRO_UZI, 0);
gPlayerLogged[playerid] = 0;
Seatbelt[playerid] = 0;
new string[128];
if(fexist(UserPath(playerid)))
{
INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
ShowPlayerDialog(playerid,2,DIALOG_STYLE_PASSWORD,"Login","Welcome back to Emerald Isle Roleplay.\n\nThat name is registered. Please enter your password below.","Login","Quit"); //login
format(string, sizeof(string), ""COL_WHITE"Welcome back to "COL_WHITE"Emerald Isle Roleplay, "COL_WHITE"%s!", GetPlayerFirstName(playerid));
SendClientMessage(playerid, -1, string);
}
else
{
ShowPlayerDialog(playerid,1,DIALOG_STYLE_PASSWORD,"Register","Welcome to Emerald Isle Roleplay.\n\nPlease register your account by typing the password below.","Register","Quit");
format(string, sizeof(string), ""COL_WHITE"Welcome to "COL_WHITE"Emerald Isle Roleplay, "COL_WHITE"%s!", GetPlayerFirstName(playerid));
SendClientMessage(playerid, -1, string);
}
if(!IsValidName(playerid) && !IsPlayerNPC(playerid) && PlayerInfo[playerid][pAdmin] < 2)
{
format(string, sizeof(string), "AdmCmd: %s has been kicked by NameChecker, reason: Invalid name format.", GetName(playerid));
SendClientMessage(playerid, COLOR_LIGHTRED, "You've been kicked by NameChecker, reason: Invalid name format. (Firstname_Lastname)");
Kick(playerid);
}
SetPlayerInterior(playerid,0);
TogglePlayerSpectating(playerid, 0);
gPlayerLogged[playerid] = 1;
return 1;
}
pawn Код:
public OnPlayerDisconnect(playerid, reason)
{
PlayerInfo[playerid][pGod] = 0;
new discstring[128];
switch(reason)
{
case 0: format(discstring, sizeof(discstring), "* %s has left the server. (Timeout)", GetName(playerid));
case 1: format(discstring, sizeof(discstring), "* %s has left the server. (Leaving)", GetName(playerid));
case 2: format(discstring, sizeof(discstring), "* %s has left the server. (Kicked)", GetName(playerid));
}
ProxDetector(20.0, playerid, discstring, COLOR_YELLOW, COLOR_YELLOW, COLOR_YELLOW, COLOR_YELLOW, COLOR_YELLOW);
PlayerInfo[playerid][OnDuty] = false;
SaveAccountInfo(playerid);
return 1;
}

