buy issue - 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: buy issue (
/showthread.php?tid=363562)
buy issue -
Akcent_Voltaj - 28.07.2012
someone sayed its easy so i buy an car and the money doesent waste it just remainds i have filterscript.but can someone give me solutions??please!!
PS:fast solutions people buy cars and money doesent go down..
Re: buy issue -
Devilxz97 - 28.07.2012
add this into your code . .
pawn Код:
if(GetPlayerMoney(playerid) < //The Price of the car)
return SendClientMessage(playerid, red, "[INFO]:You dont have enough money to buy this Car");
GivePlayerMoney(playerid, -//the price of the car );
Re: buy issue -
Akcent_Voltaj - 28.07.2012
i add from up and it should work??
PHP код:
else if(strcmp(x_nr,"buy",true) == 0)
{
if(IsAnOwnableCar(idcar))
{
if(PlayerInfo[playerid][pPcarkey] == -1) { }
else if(PlayerInfo[playerid][pPcarkey2] == -1) { }
else if(PlayerInfo[playerid][pPcarkey3] == -1) { }
else { SendClientMessage(playerid, COLOR_GREY, " Ai deja 3 masini!!"); return 1; }
if(CarInfo[idcar][cOwned]==1)
{
SendClientMessage(playerid, COLOR_GREY, "Someone already owns this car");
return 1;
}
if(GetPlayerMoney(playerid) >= CarInfo[idcar][cValue])
{
if(PlayerInfo[playerid][pPcarkey] == -1) { PlayerInfo[playerid][pPcarkey] = idcar; }
else if(PlayerInfo[playerid][pPcarkey2] == -1) { PlayerInfo[playerid][pPcarkey2] = idcar; }
else if(PlayerInfo[playerid][pPcarkey3] == -1) { PlayerInfo[playerid][pPcarkey3] = idcar; }
else { return 1; }
CarInfo[idcar][cOwned] = 1;
GetPlayerName(playerid, sendername, sizeof(sendername));
strmid(CarInfo[idcar][cOwner], sendername, 0, strlen(sendername), 999);
GivePlayerMoney(playerid,-CarInfo[idcar][cValue]);
PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
GameTextForPlayer(playerid, "~w~Felicitari~n~Nu uita sa o parchezi cu /v park!", 5000, 3);
SendClientMessage(playerid, COLOR_GRAD2, "Felicitari ti-ai cumparat o masina noua!");
TogglePlayerControllable(playerid, 1);
OnPropUpdate(); SavePlayerData(playerid);
return 1;
}
else
{
SendClientMessage(playerid, COLOR_GREY, " You don't have enough cash with you ! ");
return 1;
}
}
}
Re: buy issue -
Devilxz97 - 28.07.2012
did u try it ?
Re: buy issue -
Akcent_Voltaj - 28.07.2012
no but i put this at /v color and rest??
Re: buy issue -
Akcent_Voltaj - 28.07.2012
the money goes down then if i give myself money then the money goes back.......and nothing solved more solutions please!!
Re: buy issue -
Ranama - 29.07.2012
Your code is probably using a self made function to give the money to prevent hackers from hacking money.
So you'll need to fund what funtion the scripter uses on the other commands and use that function.
Do
NOT use the function GivePlayerMoney(); function that SA-MP team have made.