i need one command
#1

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

Using "fast commands" or strcmp?
Reply
#3

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).
Reply
#4

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;
	}
Reply
#5

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
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)