I need /givecash command!
#1

can someone please make the /givecahs command? so the player actualy gives it to his buddy, like he loses the money and the other player gets it, i am not using dcmd_ either so plz use /strtok or w/e it is, TY!
Reply
#2

You should ask at Script Request Thread for someone to make a command for you
Reply
#3

http://forum.sa-mp.com/index.php?action=search
And if i'm not wrong, then you can find this command in lvdm.pwn file.
Reply
#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
#5

next time search, i found a give cash command by using search and it took me 5 seconds.
Reply
#6

Код:
#define dcmd(%1,%2,%3) if ((strcmp((%3)[1], #%1, true, (%2)) == 0) && ((((%3)[(%2) + 1] == 0) && (dcmd_%1(playerid, "")))||(((%3)[(%2) + 1] == 32) && (dcmd_%1(playerid, (%3)[(%2) + 2]))))) return 1

dcmd(setcash,7,cmdtext);

dcmd_setcash(playerid,params[]) {
	if(PlayerInfo[playerid][Level] >= 3) {
	  new tmp[256], tmp2[256], Index; tmp = strtok(params,Index), tmp2 = strtok(params,Index);
	  if(!strlen(tmp) || !strlen(tmp2) || !IsNumeric(tmp2)) return SendClientMessage(playerid, red, "USAGE: /setcash [playerid] [amount]");
		new player1 = strval(tmp), cash = strval(tmp2), string[128];
		if(PlayerInfo[player1][Level] == ServerInfo[MaxAdminLevel] && PlayerInfo[playerid][Level] != ServerInfo[MaxAdminLevel]) return SendClientMessage(playerid,red,"ERROR: You cannot use this command on this admin");
    if(IsPlayerConnected(player1) && player1 != INVALID_PLAYER_ID) {
			CMDMessageToAdmins(playerid,"SETCASH");
			format(string, sizeof(string), "You have set \"%s's\" cash to '$%d", pName(player1), cash); SendClientMessage(playerid,blue,string);
			if(player1 != playerid) { format(string,sizeof(string),"Administrator \"%s\" has set your cash to '$%d'", pName(playerid), cash); SendClientMessage(player1,blue,string); }
			ResetPlayerMoney(player1);
  			return GivePlayerMoney(player1, cash);
	  } else return SendClientMessage(playerid,red,"ERROR: Player is not connected");
	} else return SendClientMessage(playerid,red,"ERROR: You are not a high enough level to use this command");
}
Reply
#7

@troy52192: You're not helpful to him if you copy command from other gamemode.
Reply
#8

both don't work
Reply
#9

Quote:
Originally Posted by zerolight
both don't work
Just download lvdm.pwn and take /givecash command from there.
Reply
#10

The one from LVDM doesnt work, i tried it, it has something a different gamemode does not, can someone please just give me the simple command?

Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)