I need /givecash command!
#4

pawn Код:
if(strcmp(cmd, "/gc", true) == 0) {
  if(IsSpawned[playerid] == 0) {
    SendClientMessage(playerid, COLOR_ERROR, "You are dead. You cannot use this command");
  return 1;
  }
  if(cuffed[playerid] == 1) {
  SendClientMessage(playerid,COLOR_ERROR,"You are handcuffed. You cannot use this command");
  return 1;
  }
  tmp = strtok(cmdtext, idx);
  if(!strlen(tmp)) {
  SendClientMessage(playerid, COLOR_ERROR, "USAGE: /gc (id) (amount)");
  return 1;
  }
  if(!IsNumeric(tmp)) {
  SendClientMessage(playerid, COLOR_ERROR, "USAGE: /gc (id) (amount) ID Must be a number");
  return 1;
  }
  if(strval(tmp) == playerid) {
  SendClientMessage(playerid, COLOR_ERROR, "You cannot send cash to yourself");
  return 1;
  }
  giveplayerid = strval(tmp);
  if(!IsPlayerConnected(giveplayerid)) {
  format(string, sizeof(string), "ID (%d) is not an active player", giveplayerid);
  SendClientMessage(playerid, COLOR_ERROR, string);
  return 1;
  }
  new sendername[24];
  new receivername[24];
  GetPlayerName(playerid,sendername, 24);
    GetPlayerName(giveplayerid,receivername, 24);
  if(GetDistanceBetweenPlayers(playerid,giveplayerid) > 8) {
  format(string, sizeof(string), "%s(%d) Is not close enough. You cannot give cash to that player",receivername,giveplayerid);
  SendClientMessage(playerid, COLOR_ERROR, string);
  return 1;
  }
  tmp = strtok(cmdtext, idx);
  if(!strlen(tmp)) {
  SendClientMessage(playerid, COLOR_ERROR, "USAGE: /gc (id) (amount)");
  return 1;
  }
  if(!IsNumeric(tmp)) {
  SendClientMessage(playerid, COLOR_ERROR, "USAGE: /gc (id) (amount) Amount must be a number");
  return 1;
  }
  new cashsend = strval(tmp);
  if(cashsend <= 0 || cashsend >= 100001) {
  SendClientMessage(playerid, COLOR_ERROR, "USAGE: Minimum $1 / Maximum $100000");
  return 1;
  }
  if(GetPlayerMoney(giveplayerid) + cashsend >= 1000001) {
  SendClientMessage(playerid, 0xA9A9A9AA, "|_Cash Send Failed_|");
    format(string, sizeof(string), "%s(%d) Does not have enough pockets to carry that ammount of cash ",receivername,giveplayerid);
  SendClientMessage(playerid, 0x00C7FFAA, string);
  return 1;
  }
  if(GetPlayerMoney(playerid) >= cashsend) {
  GivePlayerMoney(playerid,-cashsend);
  GivePlayerMoney(giveplayerid,cashsend);
  SendClientMessage(playerid, 0xA9A9A9AA, "|_Cash Sent_|");
    format(string, sizeof(string), "You have sent $%d to %s(%d)",cashsend,receivername,giveplayerid);
  SendClientMessage(playerid, 0x00C7FFAA, string);
  SendClientMessage(giveplayerid, 0xA9A9A9AA, "|_Cash Received_|");
  SendClientMessage(giveplayerid, 0xA9A9A9AA, "If you think that this might be hacked cash then inform a Server Admin asap! /report (id) (reason)");
    format(string, sizeof(string), "%s(%d) Has sent you $%d",sendername,playerid,cashsend);
  SendClientMessage(giveplayerid, 0x00C7FFAA, string);
  format(string, sizeof(string), "Sender %s(%d) Has sent $%d to receiver %s(%d)",sendername,playerid,cashsend,receivername,giveplayerid);
  printf("%s",string);
  ircSay(EchoConnection, EchoChan,string);
    }
  else
  if(GetPlayerMoney(playerid) < cashsend) {
  SendClientMessage(playerid, 0xA9A9A9AA, "|_Cash Send Failed_|");
  format(string, sizeof(string), "You cannot afford to send $%d",cashsend);
  SendClientMessage(playerid, COLOR_ERROR, string);
  }

  return 1;
  }
This is taken straight from the lvrcr game mode.
Reply


Messages In This Thread
I need /givecash command! - by zerolight - 07.07.2009, 23:59
Re: I need /givecash command! - by ACERS - 08.07.2009, 00:02
Re: I need /givecash command! - by Correlli - 08.07.2009, 00:05
Re: I need /givecash command! - by Rhemsis - 08.07.2009, 04:30
Re: I need /givecash command! - by StrickenKid - 08.07.2009, 04:49
Re: I need /givecash command! - by troy52192 - 08.07.2009, 05:50
Re: I need /givecash command! - by Correlli - 08.07.2009, 05:51
Re: I need /givecash command! - by zerolight - 08.07.2009, 23:18
Re: I need /givecash command! - by Correlli - 08.07.2009, 23:29
Re: I need /givecash command! - by zerolight - 09.07.2009, 12:00

Forum Jump:


Users browsing this thread: 2 Guest(s)