pInfo[playerid][Money] +money; ?
#1

Hi guys,
I have a doubt on making a give money command.I want to know if this code will work to give the player the money he has and + the money the admin gave.(Ex:You gave an player 5$ while he has 10$ and he now has 15$).
NOTE:I didn't make a full command k?
PHP код:
pInfo[playerid][Money] +money
So That's it.Thanks in advance!
Reply
#2

Nope.

Код:
pInfo[playerid][Money] += money;
Reply
#3

pInfo[playerid][Money] += money;
Reply
#4

I've written you a quick setmoney command, you can use this to create a givemoney command.
I'm not sure if its working since i wrote it in notepad.

Код:
CMD:setmoney(playerid, params[])
{
		new str[128], lookupid, amount;
		if(pInfo[playerid][Admin] < 5 && !IsPlayerAdmin(playerid)) return SendClientMessage(playerid, COLOR_WHITE, "{ff0000}[Error]:{ffffff} You are not authorized to use this command.");
		{
				if(sscanf(params, "ui",lookupid, amount)) return SendClientMessage(playerid ,COLOR_WHITE, "{ffAAAa}[Admin]:{ffffff} /setmoney [ID/Name] [amount]");
				if(!IsPlayerConnected(lookupid)) return SendClientMessage(playerid, COLOR_WHITE, "{ff0000}[Error]:{ffffff} This Player is not connected.");
				format(str, sizeof(str), "{ffAAAa}[Admin]:{ffffff} %s (ID:%d) has set %s (ID:%d) money count to {F8E607}(%d){ffffff}!", GetName(playerid), playerid, GetName(lookupid),lookupid, amount);
				SendClientMessage(lookupid, COLOR_WHITE, str);
				SetPlayerMoney(lookupid, amount); //We set the money to the total amount (so this is a "SET" command, Not "GIVE");
				pInfo[playerid][Money] = amount;
				//SavePlayerData(lookupid); Use your save player data function to store it in your database.
		}
		return 1;
}
This SETS the players money to the amount you fill in, so /setmoney player 12345 will set his cash to 12345,
This does NOT get the players money, (amount) and adds the profit to that!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)