27.03.2013, 16:12
Hi, i am having a problem of when i do my /restart cmd, it will just reset everyones data.(So far it resets skins, position(x,y,z) and facing angle).
I thought that the following loop would save everyones data before the actual gmx is called. Should it?
Restart function (#Restart)
pInfo enum(PlayerInfo)
Thanks to anyone who can help
I thought that the following loop would save everyones data before the actual gmx is called. Should it?
pawn Код:
CMD:restart(playerid)
{
if(PlayerInfo[playerid][pAdmin] < 1) return SCM(playerid,COLOR_WHITE,"You are not authorized to do that!");
if(PlayerInfo[playerid][pAdmin] <4) return SCM(playerid,COLOR_WHITE,"You need to be a higher level administrator!");
if(PlayerInfo[playerid][pAdmin] >=1337 || IsPlayerAdmin(playerid))
foreach(Player, i)
{
SCM(i,COLOR_RED, "Server will restart!");
PlayerInfo[i][pGod] = 0;
new skinid, Float: X, Float: Y, Float: Z, Float: hp, Float: armour, Float:angle;
GetPlayerPos(i,X,Y,Z);
GetPlayerFacingAngle(i, angle);
GetPlayerHealth(i, hp);
GetPlayerArmour(i, armour);
skinid = GetPlayerSkin(i);
if(IsPlayerConnected(i))
{
PlayerInfo[i][pLastX] = X;
PlayerInfo[i][pLastY] = Y;
PlayerInfo[i][pLastZ] = Z;
PlayerInfo[i][pFacingAngle] = angle;
PlayerInfo[i][pHealth] = hp;
PlayerInfo[i][pArmour] = armour;
PlayerInfo[i][pSkin] = skinid ;
SaveAccountInfo(i);
}
}
SetTimer(#Restart, 1 * 1000, 0);
return 1;
}
pawn Код:
forward Restart();
public Restart()
{
SendRconCommand(#gmx);
}
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,
BizID
}
new PlayerInfo[MAX_PLAYERS][pInfo];