06.04.2012, 14:43
So, I've been using this code for a while now, and it's been working fine, but I updated my script a few days ago and ever since, it does this:
http://imgur.com/RAmRy,gAWN4
This is the code for /contract:
and the code for /recievehit:
http://imgur.com/RAmRy,gAWN4
This is the code for /contract:
pawn Код:
CMD:contract(playerid, params[]) {
new
target[MAX_PLAYER_NAME],
targetid,
price,
contracter[MAX_PLAYER_NAME],
msg[128],
reason[128];
if(sscanf(params, "uds", targetid, price, reason)) return SendClientMessage(playerid, COLOR_GREY, "USAGE: /contract [playerid] [price] [reason]");
else if(price < 50000 || price > 1000000) {
return SendClientMessage(playerid, COLOR_GREY, "Invalid price specified!");
}
else if(playerVariables[playerid][pMoney] < price) {
return SendClientMessage(playerid, COLOR_GREY, "Not enough money!");
}
else if(playerVariables[targetid][pContracted] == 1) {
return SendClientMessage(playerid, COLOR_GREY, "Unable to submit a contract at this time!");
}
else if(price >= 50000 && price < 1000000 && playerVariables[playerid][pMoney] >= price) {
GetPlayerName(playerid, contracter, sizeof contracter);
GetPlayerName(targetid, target, sizeof target);
format(msg, sizeof(msg), "[CONTRACT] You have contracted %s for $%i. (Reason: %s)", target, price, reason);
SendClientMessage(playerid, COLOR_SMS, msg);
playerVariables[playerid][pMoney] -= price;
playerVariables[targetid][pContracted] = 1;
playerVariables[targetid][pHitPrice] = price;
foreach(Player, x) {
if(playerVariables[x][pGroup] == 5) {
new
assigner[MAX_PLAYER_NAME];
GetPlayerName(playerid, assigner, sizeof assigner);
format(msg, sizeof(msg), "[CONTRACT] %s has contracted %s for $%i. || /recievehit [id]", assigner, playerVariables[targetid][pHitPrice]);
SendClientMessage(x, COLOR_SMS, msg);
}
}
}
return 1;
}
pawn Код:
CMD:recievehit(playerid, params[]) {
new
target[MAX_PLAYER_NAME],
targetid,
msg[128],
name[MAX_PLAYER_NAME];
if(playerVariables[playerid][pGroup] == 5) {
if(sscanf(params, "u", targetid)) return SendClientMessage(playerid, COLOR_GREY, "USAGE: /recievehit [id]");
else if(playerVariables[targetid][pContracted] == 0) {
return SendClientMessage(playerid, COLOR_GREY, "That user does not have a contract on them at this time!");
}
else if(playerVariables[targetid][pContracted] == 1)
{
GetPlayerName(targetid, target, sizeof target);
GetPlayerName(playerid, name, sizeof name);
format(msg, sizeof(msg), "[CONTRACT]"EMBED_WHITE" You have taken the contract on %s.", target);
SendClientMessage(playerid, COLOR_LIGHTRED, msg);
playerVariables[playerid][pAssignedTo] = targetid;
playerVariables[targetid][pToDie] = 1;
foreach(Player, x) {
if(playerVariables[x][pGroup] == 5) {
format(msg, sizeof(msg), "[HIT RECIEVED] Hitman %s has taken the hit on %s!", name, target);
SendClientMessage(x, COLOR_LIGHTRED, msg);
}
}
}
}
return 1;
}