Something like press "2" to fix.
#1

Well, I wanted to script an autofix by pressing 2, but I don't know how to do it. Please do it for me (As simple as cake, if you can), and I will do something like that myself next time.
Reply
#2

Jesus, use ****** and try using your own logic, the forums is a place where you ask for solutions to problem, not every piece of code you want in your 'script.'
ON TOPIC: Use OnPlayerKeyStateChange. Read about it on the wiki. Should be an easy thing if you READ properly !
Reply
#3

Script Request Thread #6
Reply
#4

pawn Код:
//Add this under OnPlayerKeyStateChange
    if(newkeys & KEY_SUBMISSION) //If they press 2
    {
        if(GetPlayerState(playerid) == 2) //If they are driving a vehicle
        {
            SetVehicleHealth(GetPlayerVehicleID(playerid),1000); //Set player's vehicle health to 1000
            RepairVehicle(GetPlayerVehicleID(playerid)); //Repair their vehicle(doors,hood, etc)
        }
    }
Useful links:
https://sampwiki.blast.hk/wiki/GetPlayerKeys#Special_Keys
https://sampwiki.blast.hk/wiki/SetVehicleHealth
https://sampwiki.blast.hk/wiki/RepairVehicle
Reply
#5

pawn Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
   if(newkeys == KEY_SUBMISSION && IsPlayerInAnyVehicle(playeird)) {
      new vehicleid = GetPlayerVehicleID(playerid);
      SetVehicleHealth(vehicleid, 1000);
   }
   return 1;
}
Reply
#6

There is no next time.And there are a dozen of scripts like that uploaded on this forum.First try to "Seacrh".
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)