SA-MP Forums Archive
bounties saving - 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: bounties saving (/showthread.php?tid=91236)



bounties saving - klavins - 13.08.2009

hello. I need that so bounties would save, and to do that I must make some new commands (to make it easier). I know how to save it, but dont know how to make those extra thing. this is all I came up with yet
Код:
GetPlayerHitman(playerid)
{
	bounty[giveplayerid]+=moneys;
}
and I need GetPlayerHitman and SetPlayerHitman.
P.S - I`m using SananMoneyGroup 0.5 hitman script, and this bounties script that I use now (I`ll edit it later) Pastebin



Re: bounties saving - RaFsTar - 13.08.2009

Код:
new Hitman[MAX_PLAYERS];

public OnPlayerConnect(playerid)
{
  Hitman[playerid]=0; // This is very important to prevent bugs !
}

public OnPlayerDisconnect(playerid, reason)
{
  dUserSetINT(PlayerName(playerid)).("Hitman",GetPlayerHitman(playerid));
}

stock GivePlayerHitman(playerid, hitman)
{
	Hitman[playerid] = Hitman[playerid] + hitman;
	return Hitman[playerid];
}

stock GetPlayerHitman(playerid)
{
	return Hitman[playerid];
}
This is an example how would i do.
I use this for everything, but you should make it like jobs, or you will have more work !

Best Regards !


Re: bounties saving - klavins - 13.08.2009

that on onplayerconnect resets bountie or what?
P.S - thanx


Re: bounties saving - RaFsTar - 13.08.2009

No, it's just prevents bugs.

Then you have to add (to make the player hitman again) :

Код:
 
GivePlayerHitman(playerid,dUserINT(PlayerName(playerid)).("Hitman")-GetPlayerhitman(playerid));
And use dudb.inc !


Re: bounties saving - klavins - 13.08.2009

ok thanx


Re: bounties saving - RaFsTar - 13.08.2009

btw you need this too :

Код:
stock PlayerName(playerid) 
{
new name[255];
GetPlayerName(playerid, name, 255);
return name;
}
Sorry i am always making mistakes


Re: bounties saving - Correlli - 13.08.2009

You don't need 255, it's too long, MAX_PLAYER_NAME is enough.

pawn Код:
stock PlayerName(playerid)
{
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
return name;
}