SA-MP Forums Archive
i need one command - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: i need one command (/showthread.php?tid=135364)



i need one command - DarkPower - 20.03.2010

How to make /givecash [PlayerId] [Price] to give player money? can anybody help me?


Re: i need one command - ray187 - 20.03.2010

Using "fast commands" or strcmp?


Re: i need one command - Correlli - 20.03.2010

You can find a command like that in the lvdm.pwn (this script can be found in the samp-server-package on the Downloads section on the Main site).


Re: i need one command - playbox12 - 20.03.2010

Because i dont have anything to do, i will post the givecash command of LVDM here.

Код:
#define GIVECASH_DELAY 5000 // Time in ms between /givecash commands.
(thats the define on top of the script)


(the code it self)
Код:
if(strcmp(cmd, "/givecash", true) == 0) { 
	  new tmp[256];
		tmp = strtok(cmdtext, idx);

		if(!strlen(tmp)) {
			SendClientMessage(playerid, COLOR_WHITE, "USAGE: /givecash [playerid] [amount]");
			return 1;
		}
		giveplayerid = strval(tmp);
		
		tmp = strtok(cmdtext, idx);
		if(!strlen(tmp)) {
			SendClientMessage(playerid, COLOR_WHITE, "USAGE: /givecash [playerid] [amount]");
			return 1;
		}
 		moneys = strval(tmp);
		
		//printf("givecash_command: %d %d",giveplayerid,moneys);

		
		if (IsPlayerConnected(giveplayerid)) {
			GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
			GetPlayerName(playerid, sendername, sizeof(sendername));
			playermoney = GetPlayerMoney(playerid);
			if (moneys > 0 && playermoney >= moneys) {
				GivePlayerMoney(playerid, (0 - moneys));
				GivePlayerMoney(giveplayerid, moneys);
				format(string, sizeof(string), "You have sent %s(player: %d), $%d.", giveplayer,giveplayerid, moneys);
				SendClientMessage(playerid, COLOR_YELLOW, string);
				format(string, sizeof(string), "You have recieved $%d from %s(player: %d).", moneys, sendername, playerid);
				SendClientMessage(giveplayerid, COLOR_YELLOW, string);
				printf("%s(playerid:%d) has transfered %d to %s(playerid:%d)",sendername, playerid, moneys, giveplayer, giveplayerid);
			}
			else {
				SendClientMessage(playerid, COLOR_YELLOW, "Invalid transaction amount.");
			}
		}
		else {
				format(string, sizeof(string), "%d is not an active player.", giveplayerid);
				SendClientMessage(playerid, COLOR_YELLOW, string);
			}
		return 1;
	}



Re: i need one command - DarkPower - 20.03.2010

Quote:
Originally Posted by Don Correlli
You can find a command like that in the lvdm.pwn (this script can be found in the samp-server-package on the Downloads section on the Main site).
I know how to make but when i make its bugged its give money diffrent player that is suck.....Tnx Correlli i will try