02.04.2013, 02:07
I Have a Problem With The Command GMX , If I use /q PlayerDisconnect Gets Called Saves My Stats But If I use GMX It Doesn't Save And Sets X Y Z Players Enum To 0 How Can I Fix This Help Please Thanks
PHP код:
enum pInfo
{
pUserName[128],
pRegistrationDate,
pPass,
pPassString,
pAge,
pOrgin,
pSex,
pSexShown,
pIP[16],
pEmail[256],
pLogOnAttempt,
pLastLogin,
pChangeView,
pChangeView2,
pAdmin,
pVIP,
pMoney,
pScore,
pKills,
pDeaths,
pTeam,
pRank,
pJob,
pSkin,
pHairStyle,
pMood,
pMoodSpawn,
pHasSTDs,
pCancer,
pHealth,
pArmour,
pDuty,
pFrozen,
pMute,
pWarning,
pBanned,
pPhoneBook,
pPhoneNumber,
pMarried,
pMarriedTo[128],
pSpectating,
pBalloonPlayer,
pUavControl,
pFightingStyle,
pBoxingSkill,
pBoxingWins,
pBoxinLosses,
pWantedLevel,
pCrimes,
pArrested,
pJailCount,
pJailed,
pJailTime,
pFishLicense,
pFishSkill,
pFishTool,
pBiggestFish,
pFishes,
pFishCaughtCount,
//---[Shopping]
pSeatBelt,
pCDMP3Player,
pWatch,
pAttachments,
pPlaneTickets,
pHorseShoes,
pHelmet,
pCigarettes,
pSmoked,
pLighter,
pBeers,
//--[Pos]
Float:X,
Float:Y,
Float:Z,
Float:Angle,
Interior,
World,
};
public LoadUserAccounts(playerid,name[],value[])
{
INI_Int("Admin",PlayerInfo[playerid][pAdmin]);
INI_Int("Password",PlayerInfo[playerid][pPass]);
INI_Float("X",PlayerInfo[playerid][X]);
INI_Float("Y",PlayerInfo[playerid][Y]);
INI_Float("Z",PlayerInfo[playerid][Z]);
INI_Float("Angle",PlayerInfo[playerid][Angle]);
INI_Int("Interior",PlayerInfo[playerid][Interior]);
INI_Int("World",PlayerInfo[playerid][World]);
INI_Int("Age",PlayerInfo[playerid][pAge]);
INI_Int("Orgin",PlayerInfo[playerid][pOrgin]);
INI_Int("Sex",PlayerInfo[playerid][pSex]);
INI_Int("SexShown",PlayerInfo[playerid][pSexShown]);
INI_Int("MoodSpawn",PlayerInfo[playerid][pMoodSpawn]);
INI_Int("Money",PlayerInfo[playerid][pMoney]);
INI_Int("CD-Player",PlayerInfo[playerid][pCDMP3Player]);
INI_Int("Watch",PlayerInfo[playerid][pWatch]);
INI_Int("Beers",PlayerInfo[playerid][pBeers]);
INI_Int("Cigs",PlayerInfo[playerid][pCigarettes]);
INI_Int("Lighter",PlayerInfo[playerid][pLighter]);
INI_Int("Smoked",PlayerInfo[playerid][pSmoked]);
INI_Int("HorseShoes",PlayerInfo[playerid][pHorseShoes]);
INI_Int("Helmet",PlayerInfo[playerid][pHelmet]);
return 1;
}
public OnPlayerDisconnect(playerid, reason)
{
SendDeathMessage(INVALID_PLAYER_ID, playerid, 201);
new string[128],Float:Xz,Float:Yz,Float:Zz,Float:zAngle;
GetPlayerPos(playerid,Xz,Yz,Zz);
GetPlayerFacingAngle(playerid,zAngle);
PlayerInfo[playerid][X] = Xz;
PlayerInfo[playerid][Y] = Yz;
PlayerInfo[playerid][Z] = Zz;
PlayerInfo[playerid][Angle] = zAngle;
PlayerInfo[playerid][Interior] = GetPlayerInterior(playerid);
PlayerInfo[playerid][World] = GetPlayerVirtualWorld(playerid);
if(fexist(UserPath(playerid)))
{
new INI:File = INI_Open(UserPath(playerid));
INI_SetTag(File,"Player-Data");
INI_WriteString(File,"UserName",GetName(playerid));
INI_WriteInt(File,"LogOnAttempt",0);
INI_WriteFloat(File,"X",PlayerInfo[playerid][X]);
INI_WriteFloat(File,"Y",PlayerInfo[playerid][Y]);
INI_WriteFloat(File,"Z",PlayerInfo[playerid][Z]);
INI_WriteFloat(File,"Angle",PlayerInfo[playerid][Angle]);
INI_WriteInt(File,"Interior",PlayerInfo[playerid][Interior]);
INI_WriteInt(File,"World",PlayerInfo[playerid][World]);
INI_WriteInt(File,"HorseShoes",PlayerInfo[playerid][pHorseShoes]);
INI_WriteString(File,"Mood",PlayerInfo[playerid][pMood]);
INI_WriteInt(File,"MoodSpawn",0);
INI_WriteInt(File,"Sex",PlayerInfo[playerid][pSex]);
INI_WriteInt(File,"SexShown",PlayerInfo[playerid][pSexShown]);
INI_WriteInt(File,"Helmet",PlayerInfo[playerid][pHelmet]);
INI_WriteInt(File,"SeatBelt",PlayerInfo[playerid][pSeatBelt]);
INI_WriteInt(File,"CD-Player",PlayerInfo[playerid][pCDMP3Player]);
INI_WriteInt(File,"Watch",PlayerInfo[playerid][pWatch]);
INI_WriteInt(File,"Admin",PlayerInfo[playerid][pAdmin]);
INI_WriteInt(File,"VIP",PlayerInfo[playerid][pVIP]);
INI_WriteInt(File,"Skin",PlayerInfo[playerid][pSkin]);
INI_WriteInt(File,"WantedLevel",PlayerInfo[playerid][pWantedLevel]);
INI_WriteInt(File,"Money",GetPlayerMoney(playerid));
INI_WriteInt(File,"Kills",PlayerInfo[playerid][pKills]);
INI_WriteInt(File,"Deaths",PlayerInfo[playerid][pDeaths]);
INI_WriteInt(File,"Score",PlayerInfo[playerid][pScore]);
INI_WriteInt(File,"Warn",PlayerInfo[playerid][pWarning]);
INI_WriteInt(File,"STD'S",PlayerInfo[playerid][pHasSTDs]);
INI_WriteInt(File,"Beers",PlayerInfo[playerid][pBeers]);
INI_WriteInt(File,"Cigs",PlayerInfo[playerid][pCigarettes]);
INI_WriteInt(File,"Lighter",PlayerInfo[playerid][pLighter]);
INI_WriteInt(File,"Smoked",PlayerInfo[playerid][pSmoked]);
INI_WriteInt(File,"Cancer",PlayerInfo[playerid][pCancer]);
INI_Close(File);
}
format(string, sizeof(string),COLOR_ORANGE"%s"COLOR_WHITE" Player-Data Has Now Been Updated !!", GetName(playerid));
SendClientMessageToAll(-1, string);
printf("%s Player-Data Has Now Been Saved And Updated !!", GetName(playerid));
switch(reason)
{
case 0: format(string, sizeof(string),COLOR_ORANGE"%s"COLOR_WHITE" Has Lost Connection To Server !!", GetName(playerid));
case 1: format(string, sizeof(string),COLOR_ORANGE"%s"COLOR_WHITE" Is Leaving The Server !!", GetName(playerid));
case 2: format(string, sizeof(string),COLOR_ORANGE"%s"COLOR_WHITE" Has Been Kicked/Banned To The Server !!", GetName(playerid));
}
SendClientMessageToAll(-1, string);
return 1;
}
public OnPlayerSpawn(playerid)
{
INI_ParseFile(UserPath(playerid),"LoadUserAccounts", .bExtra = true, .extra = playerid);
if(fexist(UserPath(playerid)))
{
SetPlayerPos(playerid,PlayerInfo[playerid][X],PlayerInfo[playerid][Y],PlayerInfo[playerid][Z]);
SetPlayerFacingAngle(playerid,PlayerInfo[playerid][Angle]);
SetPlayerInterior(playerid,PlayerInfo[playerid][Interior]);
SetPlayerVirtualWorld(playerid,PlayerInfo[playerid][World]);
}
return 1;
}
YCMD:gmx(playerid, params[], help)//LVL5
{
if(PlayerInfo[playerid][pAdmin] < 5) return SendClientMessage(playerid,-1,""COLOR_RED"<<Error>>"COLOR_WHITE" You Need To Be"COLOR_RED" Admin Level 5"COLOR_WHITE" To Use This Command!");
new string[128];
if(PlayerInfo[playerid][pAdmin] == 5)
{
new Float:aX, Float:aY, Float:aZ;
if(IsPlayerConnected(playerid))
{
GetPlayerPos(playerid, aX, aY, aZ);
PlayerInfo[playerid][X] = aX;
PlayerInfo[playerid][Y] = aY;
PlayerInfo[playerid][Z] = aZ;
}
}
format(string,sizeof(string),""COLOR_RED"<<Admin>>"COLOR_ORANGE" %s"COLOR_WHITE" Has Restarted The Server !!",GetName(playerid));
SendClientMessageToAll(-1,string);
SendRconCommand("gmx");
}
return 1;
}