SA-MP Forums Archive
/pay help - 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)
+--- Thread: /pay help (/showthread.php?tid=307805)



/pay help - fangoth1 - 01.01.2012

hey, can somone help me with this, im so confused, i go in game type /pay to my id just to test it but it just pays 0 to me as the id i am

Код HTML:
if (strcmp("/pay", cmd, true) == 0)
	{
	    tmp = strtok(cmdtext, idx);
		if(strlen(tmp) == 0) return SendClientMessage(playerid, COLOR_WHITE, "Usage: /pay [player id][amount]");
 		new playeree = strval(tmp);
 		new playername[MAX_PLAYER_NAME], adminname[MAX_PLAYER_NAME];
		GetPlayerName(playeree, playername, MAX_PLAYER_NAME);
		GetPlayerName(playerid, adminname, MAX_PLAYER_NAME);
 		if(!IsPlayerConnected(playeree)) return SendClientMessage(playerid, COLOR_WHITE, "Player is not connected.");

        new tmp2[128];
		new ammount = strval(tmp2);
		if(ammount >= 0 && ammount <= 99999999)

		if(GetPlayerMoney(playerid) < ammount) return SendClientMessage(playerid, COLOR_ROYALBLUE, "You don't have enough cash.");

		new Float:x, Float:y, Float:z;
		    
		GetPlayerPos(playeree, x, y, z);
		
		if(IsPlayerInRangeOfPoint(playerid, 30, x, y, z))
		{
			format(string, sizeof(string), "%s Has Payed You $%i",adminname, ammount);
			SendClientMessage(playeree, COLOR_RED, string);
			format(string, sizeof(string), "You Have Payed %s $%i", playername, ammount);
			SendClientMessage(playerid, COLOR_RED, string);
			GivePlayerMoney(playeree, ammount);
		}

		for(new i = 0; i < MAX_PLAYERS; i++)

		if(IsPlayerInRangeOfPoint(i, 30, x, y, z))
		{
			format(string, sizeof(string), "%s has give some cash to %s", adminname, playername);
			SendClientMessage(i ,COLOR_PINK, string);
		}

		return 1;
	}



Re: /pay help - Aira - 01.01.2012

Try testing it with other players, its kinda stupid doing it to yourself
(PM me IP now and i'll help you test )


Re: /pay help - fangoth1 - 01.01.2012

still need help with this


Re: /pay help - rinori - 01.01.2012

Why dont you use ZCMD, which is more easier to use and a faster command processor.


Re: /pay help - fangoth1 - 01.01.2012

cause i dont wanna have to relearn all the functions and this is fast enogh for what i use


Re: /pay help - fangoth1 - 01.01.2012

bump


Re: /pay help - Bogdan1992 - 01.01.2012

Change this
PHP код:
GivePlayerMoney(playereeammount); 
to this
PHP код:
GivePlayerMoney(playeridammount); 



Re: /pay help - fangoth1 - 01.01.2012

umm im not trying to pay myself, my money needs to go to my target id


Re: /pay help - Bogdan1992 - 01.01.2012

Just test it if it works.


Re: /pay help - fangoth1 - 01.01.2012

it wont work, i dont even need to compile it, cause paying my self wont work