SA-MP Forums Archive
Saving duty when disconnecting (you'll return on duty if you were on duty) - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Saving duty when disconnecting (you'll return on duty if you were on duty) (/showthread.php?tid=125493)



Saving duty when disconnecting (you'll return on duty if you were on duty) - Chivava - 04.02.2010

Hello i want it like it saves your duty position, etc if duty is 1 (on) when you disconnected you will return on duty, can anyone help me as it doesnt seems like it worked the thing i tried out..

Код:
public OnPlayerDisconnect(playerid, reason)
{
	gActivePlayers[playerid]--;
	numplayers--;
	if(reason == 0)
	{
	  PlayerInfo[playerid][pCrashed] = 1;
	}
	if(OnDuty[playerid]==1)
	{
	OnDuty[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; }
    	}
 	}



Re: Saving duty when disconnecting (you'll return on duty if you were on duty) - Torran - 04.02.2010

Use dudb or something like that...


Re: Saving duty when disconnecting (you'll return on duty if you were on duty) - Chivava - 04.02.2010

Quote:
Originally Posted by Torran
Use dudb or something like that...
Okay.. but wouldn't it be better to just have it here ?


Re: Saving duty when disconnecting (you'll return on duty if you were on duty) - Torran - 04.02.2010

Use dudb or dini to save it to a file, And then load it when they reconnect


Re: Saving duty when disconnecting (you'll return on duty if you were on duty) - Chivava - 04.02.2010

Quote:
Originally Posted by Torran
Use dudb or dini to save it to a file, And then load it when they reconnect
Okay, but still can you then help me out with how to do that then ?


Re: Saving duty when disconnecting (you'll return on duty if you were on duty) - Torran - 04.02.2010

Use wiki, Theres 2/3 tutorials on there


Re: Saving duty when disconnecting (you'll return on duty if you were on duty) - Niixie - 04.02.2010

Set his duty to on in his user file with dini or dudb.

dini_IntSet(file, "pDuty", 1);




Re: Saving duty when disconnecting (you'll return on duty if you were on duty) - Chivava - 04.02.2010

Quote:
Originally Posted by Niixie
Set his duty to on in his user file with dini or dudb.

dini_IntSet(file, "pDuty", 1);

I'll try that.