Help with floats
#1

Hi everybody.

So I made a VIP shop with dialogs and people can buy stuff with their Euros which they have on their account.

The problem is when I buy a VIP package it doesn't take amount of Euros from my account. It gives me like 10 million Euros more idk why...

Here is the code:

Код:
	if(dialogid == DIALOG_VIPPAKET4)
	{
		if(response)
		{
		    if(pInfo[playerid][pVip] == 4) return SCM(playerid, COLOR_RED, "Vec imate VIP 4!");
		    if(pInfo[playerid][pEuro] < 10) return SCM(playerid, COLOR_RED, "Nemate dovoljno Eura(Ђ)! 
                    (10.00Ђ)");
		    pInfo[playerid][pEuro] -= 10; //This is the problem...
		    SCM(playerid, COLOR_GREEN, "CESTITAMO! Uspesno ste kupili VIP Paket Level 4!");
		    SCM(playerid, COLOR_GREEN, "Za pomoc oko VIP-a koristite: /viphelp!");
		    pInfo[playerid][pVip] = 4;
                    GivePlayerMoneyEx(playerid, 350000);
		}
        }
The float pInfo[playerid][pEuro] is beeing weird for some reason.

Can someone help me?
Thx in advanced
Reply
#2

Show the enum
Reply
#3

Код:
 GivePlayerMoneyEx(playerid, 350000);
This...?
Reply
#4

Код:
enum PlInfo
{

	Float:pEuro,

};
new pInfo[MAX_PLAYERS][PlInfo];
There you go, I removed everything except the Euros float... You know, for unique reasons


EDIT: nah the problem is not with money, the float pEuro is not working well...
Reply
#5

Money shouldn't be a float.
Reply
#6

The code seem to be fine hmm
Reply
#7

It's a float because you know there are CENTS in Euros? So something could be 1.50€?
Reply
#8

Guys I fixed it. Thx for helping out.

The problem was I should have put pInfo[playerid][pEuro] -= 10.00000 because welcome to the world of floats.
Reply
#9

-REMOVED-
Reply
#10

Yeah that works too, ty!
Reply


Forum Jump:


Users browsing this thread: