31.01.2012, 21:13
Hey,
I have a system on OnPlayerDisconnect that should cancel the players hit:
However when I come back and type /hitlist it shows me on there with a hit of 999. Any ideas?
There is the Hit command.
I have a system on OnPlayerDisconnect that should cancel the players hit:
pawn Код:
new hitme = beinghit[playerid];
if(ammount[hitme] != 0 && beinghit[playerid] != 999)
{
format(msg, sizeof(msg), "***(HIT CONTRACT)*** The hit contract on %s[%d] has been cancelled. - Disconnected",GetPlayerNameEx(hitme),hitme);
SendClientMessage(playerid, lightblue, msg);
beinghit[playerid] = 999;
ammount[playerid] = 999;
hitting[playerid] = 999;
}
if(ammount[playerid] != 0)
{
format(msg, sizeof(msg), "***(HIT CONTRACT)*** The hit contact on %s[%d] has been cancelled. - Disconnected",GetPlayerNameEx(playerid), playerid);
SendClientMessage(playerid, lightblue, msg);
beinghit[playerid] = 999;
ammount[playerid] = 999;
hitting[playerid] = 999;
}
pawn Код:
CMD:hit(playerid, params[])
{
new user, price, string[128]=0;
if(sscanf(params, "ud", user, price)) return SendClientMessage(playerid, -1, "USAGE: /hit [playerid/partofname] [price]");
if(!UserConnected(user)) return SendClientMessage(playerid, red, "That member is not connected.");
if(gTeam[playerid] != CLASS_CIV) return SendClientMessage(playerid, red, "You must be a Civilian to place a hit on someone.");
if(user == playerid) return SendClientMessage(playerid, red, "You can't place a hit on yourself.");
if(PlayerInfo[playerid][pCash] < price) return SendClientMessage(playerid, red, "You can't afford to place a hit of that amount.");
if(recenthit[playerid] == 1) return SendClientMessage(playerid, red, "You have recently placed a hit, please wait.");
if(beinghit[user] != 999) return SendClientMessage(playerid, red, "That member currently has a hit placed on them.");
if(hitting[playerid] != 999) return SendClientMessage(playerid, red, "You have already placed a hit, wait until it is complete.");
if(price > 500000) return SendClientMessage(playerid, red, "ERROR: The maximum hit amount is $500,000."); if(price < 10000) return SendClientMessage(playerid, red, "ERROR: The minimum hit amount is $10,000");
recenthit[playerid] = 1;
//
hitting[playerid] = user;
beinghit[user] = playerid;
ammount[user] = price;
//
PlayerInfo[playerid][pCash]=PlayerInfo[playerid][pCash]-price;
recently[playerid] = SetTimerEx("hitr",120000,false,"i",playerid);
format(string, sizeof(string), "[HIT] %s has placed a hit on %s for $%d", PlayerName(playerid), PlayerName(user), price);
SendClientMessageToAll(grey, string);
SendClientMessage(playerid, green, "Hit placed!");
lottery_jackpot=lottery_jackpot+price;
return 1;
}