Connorlolz

Untitled

Apr 12th, 2012
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //my first real command, ;3
  2.  
  3. CMD:contract(playerid, params[])
  4. {
  5.     new
  6.         targeted[MAX_PLAYER_NAME],
  7.         targetid,
  8.         amount,
  9.         contracter[MAX_PLAYER_NAME],
  10.         txt[128],
  11.         reason[128];
  12.     if(sscanf(params, "u", targetid, amount, reason)) return SendClientMessage(playerid, COLOR_GREY, "Syntax: /contract [playerid] [price] [reason]");
  13.  
  14.     else if(playerVariables[playerid][pMoney] < amount)
  15.     {
  16.     return SendClientMessage(playerid, COLOR_WHITE, "Not enough money!");
  17.     }
  18.     else if (playerVariables[playerid][pMoney >= amount)
  19.     {
  20.     GetPlayerName(playerid, contracter, sizeof contracter);
  21.     GetPlayerName(targetid, targeted, sizeof targeted);
  22.     format(txt, sizeof(txt), "[SYSTEM] You contracted %s for $%i. Reason: %s"), targeted, amount, reason);
  23.     SendClientMessage(playerid, COLOR_WHITE, txt);
  24.     playerVariables[playerid][pMoney] -= amount;
  25.     playerVariables[targetid][pBeenContracted] = 1;
  26.     playerVariables[targetid][pPriceHit] = amount;
  27.     foreach(Player, x)
  28.     {
  29.     if(playerVariables[playerid][pGroup] == 5)
  30.     format txt, sizeof(txt), "[SYSTEM] %s has been contracted by %s for $%i. ", targeted, contracter, playerVariables[playerid][pHitPrice]);
  31.     SendClientMessage(x, COLOR_WHITE, txt);
  32.     }
  33.     return 1;
  34. }
Advertisement
Add Comment
Please, Sign In to add comment