Hit Contract
#1

Hey,

I was wondering how you can create a Hit Contract system where players can place hit contract on other players and if a Bounty Hunter/Assassin kills them, they receive the amount of money which the player put on the contract for.

How am I able to do this?

Thanks,

FunnyBear
Reply
#2

I got one in my server.

Xtremies Server. cmds : /hitman /bounties
Reply
#3

Код:
CMD:hitman(playerid, params[])
{
	new theScore, senderid;

	if(sscanf(params, "k<player_name>i", senderid, theScore)) return SCM(playerid, C_INFO, "/hitman [playerid] [score]");
	if(!IsPlayerConnected(senderid)) return playerMessage(playerid, C_RED, "Podano błędne id gracza!", "Invalid playerid!");
	if(theScore > pScore[playerid] || !(0 < theScore <= 500)) return playerMessage(playerid, C_RED, "Błędna ilość respektu [1 - 500]", "Invalid amount of score [1 - 500]");

	pHitman[senderid] += theScore;
	pScore[playerid] -= theScore;
	return serverMessageEx(-1, "%s "ORANGE"dał "WHITE"%d "ORANGE"expa za głowę gracza "WHITE"%s "ORANGE"- łącznie "WHITE"%d", "%s "ORANGE"gave "WHITE"%d "ORANGE"score for killing player "WHITE"%s "ORANGE"- together "WHITE"%d", pName[playerid], theScore, pName[senderid], pHitman[senderid]);
}

//OnPlayerDeath
if(pHitman[playerid])
	    {
	        serverMessageEx(-1, "%s "ORANGE"zdobył "WHITE"%d "ORANGE"pkt. respektu za zabуjstwo gracza "WHITE"%s", "%s "ORANGE"gained "WHITE"%d "ORANGE"score points for killing "WHITE"%s", pName[killerid], pHitman[playerid], pName[playerid]);
	        pScore[killerid] += pHitman[playerid];
	        pHitman[playerid] = 0;
		}
From my gamemode, you can edit it for yourself.
Reply
#4

This is what I would do:

- Create a global variable something like 'bool:PlayerIsWanted[MAX_PLAYERS]'.
- If the player is contracted, set PlayerIsWanted to true on that individual player.
- OnPlayerDeath, pay out the contract money to the killerid and set PlayerIsWanted to false on the player.
Reply
#5

Quote:
Originally Posted by jackx3rx
Посмотреть сообщение
This is what I would do:

- Create a global variable something like 'bool:PlayerIsWanted[MAX_PLAYERS]'.
- If the player is contracted, set PlayerIsWanted to true on that individual player.
- OnPlayerDeath, pay out the contract money to the killerid and set PlayerIsWanted to false on the player.
Ok but, how do I save the contract amount in a variable? As in, if I place a hit on someone for $7,000, then when they were killed how do I pay retrieve the amount to pay to the player?
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)