Gamemode: Money Bug/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: Gamemode: Money Bug/Error (
/showthread.php?tid=519606)
Gamemode: Money Bug/Error -
Zmith - 15.06.2014
Well, recently, I've been working on my own gamemode and I created a gun store also I've got a command that allows you to give a player cash /givecash. The annoying thing is that.. lets say you had $10,000 and a M4A1 cost $5,000.. right so after you've bought one you'd should have $5,000 left, right? well on my server it gives you an actual -$5,000 which sucks. Also /givecash same thing, it gives you the actual amount and not just adding the selected amount.
GIVE CASH
http://pastebin.com/uFdzqBXp
GUN STORE
http://pastebin.com/krfvcdFf
Re: Gamemode: Money Bug/Error -
RenovanZ - 15.06.2014
You have ResetPlayerMoney(playa); in your code and GivePlayerMoney with the price of thing which you buy, the solution is you have to delete ResetPlayerMoney.
Re: Gamemode: Money Bug/Error -
Lacamora - 15.06.2014
well
PHP код:
if(strcmp(cmd, "/givecash", true) == 0)
{
if(IsPlayerConnected(playerid))
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GREY, "USAGE: /givecash [player id/name] [money]");
return 1;
}
new playa;
new money;
playa = ReturnUser(tmp);
tmp = strtok(cmdtext, idx);
money = strval(tmp);
if (PlayerInfo[playerid][pAdmin] >= 5)
{
if(IsPlayerConnected(playa))
{
if(playa != INVALID_PLAYER_ID)
{
GetPlayerName(playa, giveplayer, sizeof(giveplayer));
GetPlayerName(playerid, sendername, sizeof(sendername));
ConsumingMoney[playa] = 1;
GivePlayerMoney(playa, money);
}
}
}
else
{
SendClientMessage(playerid, COLOR_GREY, "You are not a admin!");
}
}
return 1;
}
Re: Gamemode: Money Bug/Error -
Le3aT - 15.06.2014
why not giving him - money ?
Like
GivePlayerMoney(playerid, -5000);
Re: Gamemode: Money Bug/Error -
Zmith - 15.06.2014
Alright, thanks guys!