Still error - 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: Still error (
/showthread.php?tid=609599)
Still error -
Micko123 - 14.06.2016
Sry if this is multi posting but i really need to fix this
PHP код:
YCMD:kupizlato(playerid, params[], help)
{
#pragma unused help
if(IsPlayerInRangeOfPoint(playerid, 1.0, 1696.5371,-1183.6985,23.8899))
{
new string[128], ammount, cash = ammount * 300;
if(sscanf(params, "i", ammount))
{
SCM(playerid,-1,"ES:RPG Pomoc | "SPLAVA"/kupizlato [Kolicina]");
SCM(playerid,-1,"ES:RPG Pomoc | "SPLAVA"Cijena grama je 300");
return 1;
}
else
{
PlayerInfo[playerid][pZlato] += ammount;
GivePlayerMoney(playerid, - cash);
format(string, sizeof(string), ""SPLAVA"Kupili ste "ZUTA"%d g zlata za "ZELENA"%d$", ammount, cash);
SCM(playerid, -1, string);
return 1;
}
}
else
{
SCM(playerid, -1, "[ES:RPG] "CRVENA"Niste na mjestu kupovine zlata!");
return 1;
}
}
Code works fine with one error. It give me ammount of gold i want but it says that i bough it for 0$. How is that possible??
Re: Still error -
Stinged - 14.06.2016
Код:
new string[128], ammount, cash = ammount * 300;
You're never actually setting cash to something other than 0 (
cash = 0 * 300 = 0)
Re: Still error -
Micko123 - 14.06.2016
then what should i do?? it should multyply ammount of gold with 300$ and take it away from buyer.
Re: Still error -
Stinged - 14.06.2016
Код:
YCMD:kupizlato(playerid, params[], help)
{
#pragma unused help
if(IsPlayerInRangeOfPoint(playerid, 1.0, 1696.5371,-1183.6985,23.8899))
{
new ammount;
if(sscanf(params, "i", ammount))
{
SCM(playerid,-1,"ES:RPG Pomoc | "SPLAVA"/kupizlato [Kolicina]");
SCM(playerid,-1,"ES:RPG Pomoc | "SPLAVA"Cijena grama je 300");
return 1;
}
else
{
new string[128], cash = ammount * 300;
PlayerInfo[playerid][pZlato] += ammount;
GivePlayerMoney(playerid, - cash);
format(string, sizeof(string), ""SPLAVA"Kupili ste "ZUTA"%d g zlata za "ZELENA"%d$", ammount, cash);
SCM(playerid, -1, string);
return 1;
}
}
else
{
SCM(playerid, -1, "[ES:RPG] "CRVENA"Niste na mjestu kupovine zlata!");
return 1;
}
}
Re: Still error -
Micko123 - 14.06.2016
so i just need to transfer it from up there to down here?
Re: Still error -
Stinged - 14.06.2016
Yes, isn't it obvious?
Re: Still error -
Micko123 - 14.06.2016
Thank you very much
hehehe