SA-MP Forums Archive
Need help with this simple command - 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: Need help with this simple command (/showthread.php?tid=360932)



Need help with this simple command - Songason - 19.07.2012

It's about a very easy repair command, this is what I have:
Код:
CMD:repair(playerid, params[])
{
        RepairVehicle(GetPlayerVehicleID(playerid));
        if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, 0xFFFFFFFF, "You are not in a vehicle!");
        SendClientMessage(playerid, COLOR_PURPLE, "You repaired the vehicle");
        return 1;
}
But how do I make it that it costs money?


Re: Need help with this simple command - leonardo1434 - 19.07.2012

pawn Код:
CMD:repair(playerid, params[])
{
        if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, 0xFFFFFFFF, "You are not in a vehicle!");
        if(GetPlayerMoney(playerid) < amount) return SendClientMessage(playerid,-1,"you have no money enough"); // in amount put the amount u want to cust.
        GivePlayerMoney(playerid,- amount); // put here the amount u want to cust.
        RepairVehicle(GetPlayerVehicleID(playerid));
        SendClientMessage(playerid, COLOR_PURPLE, "You repaired the vehicle");
        return 1;
}



Re: Need help with this simple command - hansen111 - 19.07.2012

GivePlayerMoney(playerid, -100);

This will reduce the player's money by 100, change it as you wish.

Notice if the player has less than 100 he will go negative, eg. -100