Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //my first real command, ;3
- CMD:contract(playerid, params[])
- {
- new
- targeted[MAX_PLAYER_NAME],
- targetid,
- amount,
- contracter[MAX_PLAYER_NAME],
- txt[128],
- reason[128];
- if(sscanf(params, "u", targetid, amount, reason)) return SendClientMessage(playerid, COLOR_GREY, "Syntax: /contract [playerid] [price] [reason]");
- else if(playerVariables[playerid][pMoney] < amount)
- {
- return SendClientMessage(playerid, COLOR_WHITE, "Not enough money!");
- }
- else if (playerVariables[playerid][pMoney >= amount)
- {
- GetPlayerName(playerid, contracter, sizeof contracter);
- GetPlayerName(targetid, targeted, sizeof targeted);
- format(txt, sizeof(txt), "[SYSTEM] You contracted %s for $%i. Reason: %s"), targeted, amount, reason);
- SendClientMessage(playerid, COLOR_WHITE, txt);
- playerVariables[playerid][pMoney] -= amount;
- playerVariables[targetid][pBeenContracted] = 1;
- playerVariables[targetid][pPriceHit] = amount;
- foreach(Player, x)
- {
- if(playerVariables[playerid][pGroup] == 5)
- format txt, sizeof(txt), "[SYSTEM] %s has been contracted by %s for $%i. ", targeted, contracter, playerVariables[playerid][pHitPrice]);
- SendClientMessage(x, COLOR_WHITE, txt);
- }
- return 1;
- }
Add Comment
Please, Sign In to add comment