Hitman
#1

Hello friends!
i have a big problem with my Hitman System if anyone can help me i'll give him +3Rep
it doesn't work when a hitman kill his contract

CMD /Contract
Код:
CMD:contract(playerid, params[])
{
	new string[128], playerb, amount, detail[62];
   	if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "First login.");
	if(sscanf(params, "uis[62]", playerb, amount, detail)) return SendClientMessage(playerid, COLOR_ALIREZA, "USAGE: /contract [playerid] [amount] [details]");
	if(IsAHitman(playerid)) return SendClientMessage(playerid, COLOR_GREY, "No  just no motherfucker!");
	if(PlayerInfo[playerid][pLevel] < 1) return SendClientMessage(playerid, COLOR_GREY, "You mus be at least level 1 to make a contract on someone.");
	if(amount < 3000 || amount > 50000) return SendClientMessage(playerid, COLOR_GREY, "Contracts are between $3000 and $50,000.");
	if(PlayerInfo[playerid][pMoney] < amount) return SendClientMessage(playerid, COLOR_GREY, "You don't have that much on you at the moment.");
	if(!IsPlayerLoggedIn(playerb)) return SendClientMessage(playerid, COLOR_GREY, "ID Bazikon Vared Shode Eshtebah Ast.");
	if(playerid == playerb) return SendClientMessage(playerid, COLOR_GREY, "You can't contract yourself.");
	if(PlayerInfo[playerb][pLevel] < 3) return SendClientMessage(playerid, COLOR_GREY, "You can't contract people under level 3.");
	//if(!strcmp(RPN(playerid), PlayerInfo[playerb][pContractBy], false)) return SendClientMessage(playerid, COLOR_GREY, "You have already placed a contract on this player.");
	if(PlayerInfo[playerb][pContract] >= 150000) return SendClientMessage(playerid, COLOR_GREY, "Player has the maximum contract amount on his head already.");
	PlayerInfo[playerb][pContract] += amount;
	format(PlayerInfo[playerb][pContractBy], 32, "%s", RPN(playerid));
	strmid(PlayerInfo[playerb][pContractDetail], detail, 0, strlen(detail), 32);
	GivePlayerMoney(playerid, -amount);
	format(string, sizeof(string), "HitmanWarn: %s has placed a contract on %s for $%d, Details: %s", RPN(playerid), RPN(playerb), amount, detail);
	SendHitmanMessage(COLOR_YELLOW, string);
	format(string, sizeof(string), "HitmanWarn: %s has placed a contract on %s for $%d, Details: %s", NORPN(playerid), NORPN(playerb), amount, detail);
	SendAdminMessage(COLOR_DARKRED, 3, string);
	Log("logs/contract.log", string);
	return 1;
}
and i put it under onplayerdeath
Код:
if(Hitman[killerid] == playerid)
					{
					    format(string, sizeof(string), " You have been critically injured by a hitman and lost $%d, the contrat on your head was cleared.", PlayerInfo[playerid][pContract]/2);
					    SendClientMessage(playerid, COLOR_YELLOW, string);
					    format(string, sizeof(string), "HitmanWarn: %s has fulfilled the contract on %s's head and collected $%d.", RPN(killerid), RPN(playerid), PlayerInfo[playerid][pContract]/2);
						SendHitmanMessage(COLOR_YELLOW, string);
						GivePlayerMoney(playerid, -PlayerInfo[playerid][pContract]/2);
						GivePlayerMoney(killerid, PlayerInfo[playerid][pContract]/2);
						PlayerInfo[playerid][pContract] = 0;
						format(PlayerInfo[playerid][pContract], 32, "");
						Hitman[killerid] = -1;
						PlayerInfo[killerid][pCSuccess] ++;
					}
					else if(Hitman[playerid] == killerid)
					{
					    format(string, sizeof(string), " You have critically injured a hitman and collected $%d, the contrat on your head was cleared.", PlayerInfo[killerid][pContract]);
					    SendClientMessage(killerid, COLOR_YELLOW, string);
					    format(string, sizeof(string), "HitmanWarn: %s has failed the contract on %s's head and lost $%d.", RPN(playerid), RPN(killerid), PlayerInfo[killerid][pContract]);
						SendHitmanMessage(COLOR_YELLOW, string);
						GivePlayerMoney(playerid, -PlayerInfo[killerid][pContract]);
						GivePlayerMoney(killerid, PlayerInfo[killerid][pContract]);
						PlayerInfo[killerid][pContract] = 0;
						format(PlayerInfo[killerid][pContract], 32, "");
						Hitman[playerid] = -1;
						PlayerInfo[playerid][pCFail] ++;
					}
and i put this under onplayershootplayer
Код:
	if(GetPlayerWeapon(Shooter) == 34 && PlayerInfo[Shooter][pScope] && Hitman[Shooter] == Target)
	{
		SetPlayerHealth(Target, 0);
		SetPlayerArmour(Target, 0);
		if(Hitman[Shooter] == Target)
		{
		    format(string, sizeof(string), " You have been critically injured by a hitman and lost $%d, the contrat on your head was cleared.", PlayerInfo[Target][pContract]/2);
		    SendClientMessage(Target, COLOR_YELLOW, string);
		    format(string, sizeof(string), "HitmanWarn: %s has fulfilled the contract on %s's head and collected $%d.", RPN(Shooter), RPN(Target), PlayerInfo[Target][pContract]/2);
			SendHitmanMessage(COLOR_YELLOW, string);
			GivePlayerMoney(Target, -PlayerInfo[Target][pContract]/2);
			GivePlayerMoney(Shooter, PlayerInfo[Target][pContract]/2);
			PlayerInfo[Target][pContract] = 0;
			format(PlayerInfo[Target][pContract], 32, "");
			Hitman[Shooter] = -1;
			PlayerInfo[Shooter][pCSuccess] ++;
		}
		PlayerInfo[Shooter][pScope] --;
	}
Where is the problem?
Pleas Help!!!
Reply
#2

I can't see that you set Hitman[playerid] anywhere in your script, where do you set it?
Reply
#3

sorry i forgot
set in it
Код:
CMD:givehit(playerid, params[])
{
	if(IsAHitman(playerid))
	{
		new string[128], playerb, hitman;
   		if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "Aval Bayad login Koni Ghabl Az inke Az CMD Ha Estefade Koni.");
	    if(sscanf(params, "uu", hitman, playerb)) return SendClientMessage(playerid, COLOR_ALIREZA, "USAGE: /givehit [hitmanid] [contractid]");
		if(!PlayerInfo[playerb][pContract]) return SendClientMessage(playerid, COLOR_GREY, "Invalid contract id.");
		if(!IsAHitman(hitman)) return SendClientMessage(playerid, COLOR_GREY, "Player is not a hitman.");
		if(Hitman[hitman] != -1) return SendClientMessage(playerid, COLOR_GREY, "Hitman is already assigned to a contract.");
		Hitman[hitman] = playerb;
		format(string, sizeof(string), "HitmanWarn: %s has assigned %s to the contract on %s's head.", NORPN(playerid), NORPN(hitman), NORPN(playerb));
		SendHitmanMessage(COLOR_YELLOW, string);
		SendClientMessage(playerid, COLOR_ALIREZA, " You can cancel the contract using '/cancel contract)'.");
	}
	return 1;
}
Reply
#4

I suggest you to put printf or SendClientMessageToAll to understand if the script is fully processed. This will give you an huge help to find where errors ARE
Reply
#5

Quote:
Originally Posted by ReshiramZekrom
Посмотреть сообщение
I suggest you to put printf or SendClientMessageToAll to understand if the script is fully processed. This will give you an huge help to find where errors ARE
i test it but it doesn't work again
Reply
#6

anyone can't help me?
Reply
#7

Quote:

This will give you an huge help to find where errors ARE
Use print to find the errors, it wont solve your problems just yet, but you can atleast locate it, and then focus on that.
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)