Need help with this simple command
#1

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?
Reply
#2

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;
}
Reply
#3

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
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)