How To Do This? [Help]
#1

How to Block Vehicle Repair In Derby Area?
I used this:

pawn Код:
if(PRESSED(KEY_SUBMISSION))
    {
       new vehicleid = GetPlayerVehicleID(playerid);
       if(IsPlayerInVehicle(playerid, vehicleid) || IsPlayerInDM[playerid] == 0)
       {
                    SetVehicleHealth(vehicleid,1000.0);
                        RepairVehicle(GetPlayerVehicleID(playerid));
            PlayerPlaySound(playerid, 1133, 0.0, 0.0, 0.0);
    }
 }
       else return SendClientMessage(playerid, COLOR_RED,"Use /exitdm before you can Fix your Vehicle!");
    return 1;
}
but the problem is even i press any key out of Derby or DM.. it gives me that Message.. 'Use /exitdm before you can Fix your Veh' and nothing happenes.
Reply
#2

create a global variable then if player is in derby set the global variable to 1 then if player press vehicle repair check if player global variable is 0, if global variable is 0 then make it enable for players.
Reply
#3

Set a variable to 1 when you jointhe derby and check if the variable is 1 when repair. If it's 1, block it.
Reply
#4

pawn Код:
IsPlayerInArea
Hope this function helps. It is from uf.inc.
Reply
#5

I did that.. and it worked.. but the problem is i get That message "use /exitdm bla bla" out of derby by pressing any key.. how to fix this?
Reply
#6

pawn Код:
if(PRESSED(KEY_SUBMISSION))
    {
        if(IsPlayerInAnyVehicle(playerid))
        {
            new vehicleid = GetPlayerVehicleID(playerid);
            if(IsPlayerInDM[playerid] == 0)
            {
                RepairVehicle(vehicleid);
                PlayerPlaySound(playerid, 1133, 0.0, 0.0, 0.0);
            }
            else
            {
                SendClientMessage(playerid, COLOR_RED,"Use /exitdm before you can Fix your Vehicle!");
            }
        }
    }
And you don't need SetVehicleHealth, RepairVehicle does that already.
Reply
#7

Thanks Made Man.. it worked.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)