Help me please, thanks..
#1

After completing the contract, I want the killer to get the price amount he entered in /setcontract [ID] [Price]

Код:
hitmanOnPlayerDeath(playerid, killerid, reason) {
	#pragma unused reason
	new faction = GetPVarInt(killerid, "Faction");
	if(getFactionType(faction) == EFactionType_Hitman && GetPVarInt(playerid, "Contract") != 0) {
		new msg[128];
        format(msg, sizeof(msg), "* You killed %s",GetPlayerNameEx(playerid, ENameType_RPName_NoMask));
		SendClientMessage(killerid, X11_YELLOW, msg);
		format(msg, sizeof(msg), "* A hit contract was completed on you");
		SendClientMessage(playerid, X11_YELLOW, msg);
		format(msg, sizeof(msg), "%s completed the contract on %s",GetPlayerNameEx(killerid, ENameType_RPName_NoMask),GetPlayerNameEx(playerid, ENameType_RPName_NoMask));
		HitmanMessage(X11_YELLOW, msg);
		DeletePVar(playerid, "Contract");
	}
	return 1;
}
YCMD:setcontract(playerid, params[], help) {
	new user, price;
	new faction = GetPVarInt(playerid, "Faction");
    if(getFactionType(faction) != EFactionType_Hitman || GetPVarInt(playerid, "Rank") < 2) {
		SendClientMessage(playerid, X11_TOMATO_2, "You aren't a member of hitman!");
		return 1;
	}
	if(!sscanf(params, "k<playerLookup>d",user,price)) {
		if(!IsPlayerConnectEx(user)) {
			SendClientMessage(playerid, X11_TOMATO_2, "User not found");
			return 1;
		}
        if(price > 50000) return SendClientMessage(playerid, X11_TOMATO_2, "You can't enter an amount higher than $50,000.");
		SetPVarInt(user, "Contract", price);
		if(price != 0) {
			SendClientMessage(playerid, COLOR_LIGHTBLUE, "* Contract Updated!");
		} else {
			SendClientMessage(playerid, COLOR_LIGHTBLUE, "* Contract Removed!");
		}
	} else {
		SendClientMessage(playerid, X11_WHITE, "USAGE: /setcontract [ID] [Price ($1 - $50,000)]");
	}
	return 1;
}
Reply
#2

just add:
pawn Код:
GivePlayerMoney(playerid, GetPVarInt(playerid, price));
DeletePVar(playerid, price);
If i'm correct about pVar, i never really used it
Reply
#3

Quote:
Originally Posted by thegamer355
Посмотреть сообщение
just add:
pawn Код:
GivePlayerMoney(playerid, GetPVarInt(playerid, price));
DeletePVar(playerid, price);
If i'm correct about pVar, i never really used it
Код:
.pwn(73) : error 017: undefined symbol "price"
Adding this under hitmanonplayerdeath and it gives me undefined symbol.. I tried adding similar GiveMoneyEx before and got same error and tried adding new price; it compiled but in game it didnt givemoney
Reply
#4

Right, my mistake, read the explanations about pVar and i get it now

pawn Код:
GivePlayerMoney(killerid, GetPVarInt(playerid, "Contract")); // give it to killerid, as that's the one who killed the player
This should do the trick, just make sure the giveplayermoney part is above the deletepvar part
Reply
#5

@thegamer was close, you need to get your "Contract", i.e
pawn Код:
GivePlayerMoney(playerid, GetPVarInt(playerid, "Contract"));
DeletePVar(playerid, "Contract");
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)