05.11.2011, 12:37
Hey,
I'm having a problem everytime I send a GMX the server...
I'm not sure what happens but heres my command
As you can see it saves everything, all of the data about the player and OnPlayerConnect it should refund him his data
Everything works fine when a player normally disconnects then connects, he gets fully refunded but when i GMX it writes the data correctly except for the floats, it writes them as 0.000 everytime i GMX so a player spawns after a GMX dead and at 0,0,0 coords..
Heres an example of the results after a GMX
As you can see above, it successfully store a correct data only if it's integer but when it comes to Float it stores it as 0
I do not know how to solve that, hope someone in here does know.
Thanks in advance.
I'm having a problem everytime I send a GMX the server...
I'm not sure what happens but heres my command
pawn Код:
CMD:gmx(playerid,o[])
{
if(PlayerInfo[playerid][pAdmin]<3) return SCM(playerid,COLOR_LIGHTBLUE,"You are not authorized to use this command!");
else
{
for(new i = 0; i<MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
new pname[MAX_PLAYER_NAME],str[230];
GetPlayerName(playerid,pname,sizeof(pname));
format(str,sizeof(str),"Administrator %s has "#CDGREEN"restarted"#CRED" the server.",pname);
SendClientMessageToAll(COLOR_RED,str);
new Float:x,Float:y,Float:z,w[3],a[3],Float:h,Float:ar,Float:ang;
GetPlayerPos(i, x, y, z);
GetPlayerWeaponData(i,1,w[0],a[0]);
GetPlayerWeaponData(i,2,w[1],a[1]);
GetPlayerWeaponData(i,3,w[2],a[2]);
GetPlayerHealth(i,h);
GetPlayerArmour(i,ar);
GetPlayerFacingAngle(i,ang);
new INI:File = INI_Open(UserPath(i));
INI_SetTag(File,"data");
INI_WriteInt(File,"Admin",PlayerInfo[i][pAdmin]);
INI_WriteInt(File,"Cash",GetPlayerMoney(i));
INI_WriteInt(File,"Bank",PlayerInfo[i][pBank]);
INI_WriteInt(File,"Kills",PlayerInfo[i][pKills]);
INI_WriteInt(File,"Deaths",PlayerInfo[i][pDeaths]);
INI_WriteInt(File,"Skin",GetPlayerSkin(i));
INI_WriteFloat(File,"PosX",x);
INI_WriteFloat(File,"PosY",y);
INI_WriteFloat(File,"PosZ",z);
INI_WriteFloat(File,"Angle",ang);
INI_WriteInt(File,"Int",GetPlayerInterior(i));
INI_WriteInt(File,"Weapon1",w[0]);
INI_WriteInt(File,"Ammo1",a[0]);
INI_WriteInt(File,"Weapon2",w[1]);
INI_WriteInt(File,"Ammo2",a[1]);
INI_WriteInt(File,"Weapon3",w[2]);
INI_WriteInt(File,"Ammo3",a[2]);
INI_WriteInt(File,"Phone",PlayerInfo[i][pPhone]);
INI_WriteInt(File,"PhoneBook",PlayerInfo[i][pPBook]);
INI_WriteFloat(File,"Health",h);
INI_WriteFloat(File,"Armor",ar);
INI_WriteInt(File,"Cookie",PlayerInfo[i][pCookie]);
INI_WriteInt(File,"Exp",PlayerInfo[i][pExp]);
INI_WriteInt(File,"Time",PlayerInfo[i][pTime]);
INI_WriteInt(File,"Hour",PlayerInfo[i][pHour]);
INI_WriteInt(File,"Level",PlayerInfo[i][pLevel]);
INI_Close(File);
SetTimer("GMX",5000,0);
}
}
}
return 1;
}
Everything works fine when a player normally disconnects then connects, he gets fully refunded but when i GMX it writes the data correctly except for the floats, it writes them as 0.000 everytime i GMX so a player spawns after a GMX dead and at 0,0,0 coords..
Heres an example of the results after a GMX
Код:
Cash = 350 Bank = 11000 Kills = 0 Deaths = 27 Skin = 0 PosX = 0.000000 PosY = 0.000000 PosZ = 0.000000 Weapon1 = 0 Ammo1 = 0 Weapon2 = 0 Ammo2 = 0 Weapon3 = 0 Ammo3 = 0 Phone = 90 PhoneBook = 1 Int = 0 Health = 0.000000 Armor = 0.000000 Angle = 0.000000 Cookie = 0 Exp = 2
I do not know how to solve that, hope someone in here does know.
Thanks in advance.