Money drops when player dies(help)
#1

Hi, i'm making that if you got more than 15k on you when you die you will loose the money, also if you got 20k on you you will drop 5k onto the ground, and spawn with 15k, but it doesnt work correctly(when you die you will get in debt like -54645646, something like that amount, and it wonly work once ) please help me to fix this code

I got this on OnPlayerDeath:
Код:
	new pdeathcash = GetMoney(playerid);
	for(new i = 0; i < sizeof(DropInfo); i++)
  	{
  	    if(DropInfo[i][dx] == 0.0 && DropInfo[i][dy] == 0.0 && DropInfo[i][dz] == 0.0 == pdeathcash > 15000)
  	    {
  	        new Float:X,Float:Y,Float:Z;
		    GetPlayerPos(playerid, X, Y, Z);
  	        DropInfo[i][dType] = 7;
  	        DropInfo[i][dAmount][0] = pdeathcash;
  	        DropInfo[i][dx] = X;
  	        DropInfo[i][dy] = Y;
  	        DropInfo[i][dz] = Z;
  	        DropInfo[i][dWorld] = GetPlayerVirtualWorld(playerid);
  	        GiveMoney(playerid,-(pdeathcash - 15000));
  	        DropObject[i] = CreateObject(1212, X, Y, Z-1, 0, 0, 0, 200.0, GetPlayerVirtualWorld(playerid));
		}
	}
Reply
#2

Quote:
Originally Posted by Mikkel_RE
Посмотреть сообщение
pawn Код:
DropInfo[i][dz] == 0.0 == pdeathcash > 15000
What is it? Correctly:
pawn Код:
DropInfo[i][dz] == 0.0 && pdeathcash > 15000
And change GiveMoney to GivePlayerMoney (GiveMoney doesn't exists), GetMoney to GetPlayerMoney, and remove the minus:

pawn Код:
new pdeathcash = GetPlayerMoney(playerid);
// blah-blah-blah
GivePlayerMoney(playerid, pdeathcash - 15000);
Reply
#3

Well on my gamemode I'm using GiveMoney, because GivePlayerMoney doenst exist in it
Reply
#4

Change condition. Remove the minus here: playerid, -(pdeathcash - 15000)
Reply
#5

I changed it to:
Код:
GiveMoney(playerid,-(pdeathcash 15000));
And now i get these errors when i compile it:
Код:
C:\Users\vMikkelReimer\Desktop\RDZ - Sшren\PWN n AMX\gf_jan12.pwn(7100) : error 001: expected token: ")", but found "-integer value-"
C:\Users\vMikkelReimer\Desktop\RDZ - Sшren\PWN n AMX\gf_jan12.pwn(7100) : error 029: invalid expression, assumed zero
Reply
#6

Remove the first minus. I even highlighted it in red.
Reply
#7

Oh, sorry, im color blinded, but i have deleted the first minus now, and i still have the same problem, now i just get alot of money, instead of getting in debt
Reply
#8

Oh, sorry.

Correctly:

pawn Код:
GiveMoney(playerid, -15000);
Reply
#9

Then it will just take 15k from the player when he dies, i mean that, if get got 15k+ on his hand he will loose the remaining amount, also let's say he got 100k on his hand, and he dies, he will drop 85k onto the ground, and keep 15k on his hand when he spawn
Reply
#10

Didn't understand. If I have 15k ondeath I will spawn with 0? Please explain in detail.
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)