SA-MP Forums Archive
How To Do This? [Help] - 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: How To Do This? [Help] (/showthread.php?tid=348949)



How To Do This? [Help] - Jarnu - 07.06.2012

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.


Re: How To Do This? [Help] - JaKe Elite - 07.06.2012

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.


Re: How To Do This? [Help] - Jochemd - 07.06.2012

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


Re: How To Do This? [Help] - Jaxson - 07.06.2012

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


Re: How To Do This? [Help] - Jarnu - 07.06.2012

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?


Re: How To Do This? [Help] - MadeMan - 07.06.2012

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.


Re: How To Do This? [Help] - Jarnu - 07.06.2012

Thanks Made Man.. it worked.