26.11.2010, 23:24
How can i make the persons gun save when server restarts ,because i ready made it so it saves in OnPlayerDisconnect,but i can't make it save for somer eason when server restarts please tell me how.
public OnPlayerDisconnect(playerid,reason)
{
/*new mtext[20];
new year, month,day;
getdate(year, month, day);
if(month == 1) { mtext = "January"; }
else if(month == 2) { mtext = "February"; }
else if(month == 3) { mtext = "March"; }
else if(month == 4) { mtext = "April"; }
else if(month == 5) { mtext = "May"; }
else if(month == 6) { mtext = "June"; }
else if(month == 7) { mtext = "July"; }
else if(month == 8) { mtext = "August"; }
else if(month == 9) { mtext = "September"; }
else if(month == 10) { mtext = "October"; }
else if(month == 11) { mtext = "November"; }
else if(month == 12) { mtext = "December"; }
new hour,minuite,second;
gettime(hour,minuite,second);
FixHour(hour);
hour = shifthour;
new string[128];
format(string, sizeof(string), "%d / %s / %d at %d:%d:%d",year,mtext,day,hour,minuite,second)
strmid(PlayerInfo[playerid][pLogOutTime], string, 0, strlen(string), 255);*/
new string[128];
new sendername[MAX_PLAYER_NAME];
new Float:armour;
KillTimer(BlinkTime[playerid]);
new Float:health;
GetPlayerName(playerid, sendername, sizeof(sendername));
if(gPlayerLogged[playerid] == 1) {
for(new slot = 0; slot != 12; slot++)
{
new wep, ammo;
GetPlayerWeaponData(playerid, slot, wep, ammo);
if(wep != 0 && ammo != 0)
{
if(PlayerInfo[playerid][pGun1] == 0) { PlayerInfo[playerid][pGun1] = wep; PlayerInfo[playerid][pAmmo1] = ammo; }
else if(PlayerInfo[playerid][pGun2] == 0) { PlayerInfo[playerid][pGun2] = wep; PlayerInfo[playerid][pAmmo2] = ammo; }
else if(PlayerInfo[playerid][pGun3] == 0) { PlayerInfo[playerid][pGun3] = wep; PlayerInfo[playerid][pAmmo3] = ammo; }
else if(PlayerInfo[playerid][pGun4] == 0) { PlayerInfo[playerid][pGun4] = wep; PlayerInfo[playerid][pAmmo4] = ammo; }
}
}
public SetPlayerWeapons(playerid)
{
if(IsPlayerConnected(playerid))
{
if(PlayerInfo[playerid][pJailed] == 0)
{
if (PlayerInfo[playerid][pGun1] > 0)
{
GivePlayerWeaponEx(playerid, PlayerInfo[playerid][pGun1], PlayerInfo[playerid][pAmmo1]);
PlayerInfo[playerid][pGun1] = 0; PlayerInfo[playerid][pAmmo1] = 0;
}
if (PlayerInfo[playerid][pGun2] > 0)
{
GivePlayerWeaponEx(playerid, PlayerInfo[playerid][pGun2], PlayerInfo[playerid][pAmmo2]);
PlayerInfo[playerid][pGun2] = 0; PlayerInfo[playerid][pAmmo2] = 0;
}
if (PlayerInfo[playerid][pGun3] > 0)
{
GivePlayerWeaponEx(playerid, PlayerInfo[playerid][pGun3], PlayerInfo[playerid][pAmmo3]);
PlayerInfo[playerid][pGun3] = 0; PlayerInfo[playerid][pAmmo3] = 0;
}
if (PlayerInfo[playerid][pGun4] > 0)
{
GivePlayerWeaponEx(playerid, PlayerInfo[playerid][pGun4], PlayerInfo[playerid][pAmmo4]);
PlayerInfo[playerid][pGun4] = 0; PlayerInfo[playerid][pAmmo4] = 0;
}
}
}
}