22.03.2012, 20:21
I've re-coded my hitman agency, and I've done /contract.
http://i.imgur.com/d5Yk4.png - Code
http://i.imgur.com/alZvk.png - Errors
Please ignore the bit about the pAfterLife, just a little bug with the LSFMD I fixed.
The actual code.
http://i.imgur.com/d5Yk4.png - Code
http://i.imgur.com/alZvk.png - Errors
Please ignore the bit about the pAfterLife, just a little bug with the LSFMD I fixed.
The actual code.
pawn Код:
CMD:contract(playerid, params[]) {
new
id[MAX_PLAYER_NAME],
price,
contract[128],
toHitmen[128];
if(sscanf(params, "us", id, price))
{
return SendClientMessage(playerid, COLOR_WHITE, SYNTAX_MESSAGE, "/contract [playerid] [price]");
}
if(playerVariables[id][pContracted] == 1) {
return SendClientMessage(playerid, COLOR_GREY, "You are unable to contract this player at this time.");
}
if(IsPlayerConnected(id))
{
GetPlayerName(id, id, sizeof(id));
format(contract, sizeof(contract), "You have requested a contract on %s for $%s.", id, price); // Message confirming the hit.
SendClientMessage(playerid, COLOR_WHITE, contract);
format(toHitmen, sizeof(toHitmen), "Somebody has requested a hit on %s for %s. If you wish to take this hit, use /accepthit [id]", id, price);
playerVariables[id][pContracted] = 1;
playerVariables[id][pHitPrice] = price; //Send to Hitmen so they can choose to accept it.
foreach(Player, x)
{
if (playerVariables[x][pGroup] == 12 && playerVariables[x][pGroupRank] >= 1) {
SendClientMessage(x, 0xF0F8FFFF, toHitmen);
}
}
}
return 1;
}