24.08.2017, 06:28
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;
}


