SA-MP Forums Archive
Whats The Problem With This.. - 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: Whats The Problem With This.. (/showthread.php?tid=216971)



Whats The Problem With This.. - Anthonyx3' - 26.01.2011

Hey guys, im not sure whats wrong with this:
pawn Код:
if(GetPlayerCash(playerid) > VehStats[vehicleid][vPrice])
            {
                SendClientMessage(playerid, COLOR_BLUE, "Congratz u bout a car nigga");
                VehStats[vehicleid][vOwnerID] = UserStats[playerid][pSQLid];
                GivePlayerCash(playerid, -VehStats[vehicleid][vPrice]);
                UpdateVehStats(vehicleid);
            }
            else
            {
                SendClientMessage(playerid, COLOR_BLUE, " Nigga, chu 2 pooooooooor!!");
            }
It keeps sending the "nigga chu 2 poor" message. I have 5000$ on me, i set car to 150$. Any ideas why code isn't working correctly.


Re: Whats The Problem With This.. - CoaPsyFactor - 26.01.2011

try to put GetPlayerMoney instead of GetPlayerCash and try with strval for VehStats[vehicleid][vPrice] (strval(VehStats[vehicleid][vPrice]))


Re: Whats The Problem With This.. - admantis - 26.01.2011

Quote:
Originally Posted by CoaPsyFactor
Посмотреть сообщение
try to put GetPlayerMoney instead of GetPlayerCash and try with strval for VehStats[vehicleid][vPrice] (strval(VehStats[vehicleid][vPrice]))
You really need to work harder with your brain. He is using a custom GetPlayerMoney function.


Re: Whats The Problem With This.. - Anthonyx3' - 27.01.2011

After insulting him, got any help? xD


Re: Whats The Problem With This.. - Krx17 - 27.01.2011

Show us your GetPlayerCash function.


Re: Whats The Problem With This.. - Anthonyx3' - 27.01.2011

I use this:
pawn Код:
#define GivePlayerCash(%0,%1) SetPVarInt(%0,"Money",GetPlayerCash(%0)+%1),GivePlayerMoney(%0,%1)
#define ResetPlayerCash(%0) SetPVarInt(%0,"Money",0), ResetPlayerMoney(%0)
#define GetPlayerCash(%0) GetPVarInt(%0,"Money")



Re: Whats The Problem With This.. - Krx17 - 27.01.2011

Before the if statement, add this line:
pawn Код:
printf("Money: $%d", GetPlayerCash(playerid));
See what it prints.