SA-MP Forums Archive
[HELP!!] Auto car fixing / Nitrous with hotkey - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: [HELP!!] Auto car fixing / Nitrous with hotkey (/showthread.php?tid=77601)



[HELP!!] Auto car fixing / Nitrous with hotkey - Moustafa - 12.05.2009

Sorry, but i actually used search many times, and i didn't find what i was searching for!

So if you could help me, Where can i find an auto car fixing and nitrous with hotkey filterscript for my stunt server?

WHAT I MEAN IS:

When the car health is nearly to explode, it gets auto fixed
When the player hits a hotkey, he gets nitrous for his car automatically!


HOPE YOU ANSWER FAST PLZ, THANK YOU


Re: [HELP!!] Auto car fixing / Nitrous with hotkey - member - 12.05.2009

Next time try searching harder, it will save you time. Below code is made by ♣ ⓐⓢⓢ it will set your vehicle health to 1000 if it falls below 300.

Auto repair
Quote:
Originally Posted by ♣ ⓐⓢⓢ
Quote:
Originally Posted by Weirdosport
(plus you can make sure the player is the driver rather than the passenger)
OnPlayerEnterVehicle dedects in which seats the player enters...

@topic
first of all, use [pawn][/pawn] tags

pawn Код:
new AutoRepairTimer[MAX_PLAYERS] = {-1, ...};
pawn Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
    if(newstate == PLAYER_STATE_DRIVER)
        switch(GetVehicleModel(GetPlayerVehicleID(playerid)))
        {
            case 425, 447, 476, 520: {} //do nothing
            default:
            {
                if(AutoRepairTimer[playerid] != -1) KillTimer(AutoRepairTimer[playerid]);
                AutoRepairTimer[playerid] = SetTimerEx("AutoRepair", 1000, true, "d", playerid);
            }
        }
}
pawn Код:
forward AutoRepair(playerid);
public AutoRepair(playerid)
{
    if(IsPlayerInAnyVehicle(playerid))
    {
        new
            Float:health;
            vehicleid = GetPlayerVehicleID(playerid);
        GetVehicleHealth(vehicleid, health);
        if(health <= 300.0)
        {
            SetVehicleHealth(vehicleid, 1000.0);
            GameTextForPlayer(playerid, "~g~Car Auto-Repaired!", 5000, 5);
            PlayerPlaySound(playerid, 1133, 0.0, 0.0, 0.0);
        }
    }
    else    KillTimer(AutoRepairTimer[playerid]), //kills the timer if the exist the vehicle or disconnects!
        AutoRepairTimer[playerid] = -1;
}
That code is better because the timer isnt the whole time active like in your code
Below is the HOTKEY button for nitrous by Daren_Jacobson. I think this one is when you press the CTRL button. Might not be safe and might cause crashes.

Quote:
Originally Posted by Daren_Jacobson
/NoS - Gives You Unlimited Nitro + a CTRL Key To Stop It !
pawn Код:
OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if ((newkeys & KEY_SUBMISSION) == (KEY_SUBMISSION) && (IsPlayerInAnyVehicle(playerid)))//not sure if that is how you do it
{
AddVehicleComponent(GetPlayerVehicleID(playerid), 1010);
return 1;
}
return 0;
}



Re: [HELP!!] Auto car fixing / Nitrous with hotkey - Moustafa - 15.05.2009

pawn Код:
C:\Documents and Settings\Moustafa & Ahmed\Desktop\server\gamemodes\universalstuntages.pwn(152) : error 017: undefined symbol "AutoRepairTimer"
C:\Documents and Settings\Moustafa & Ahmed\Desktop\server\gamemodes\universalstuntages.pwn(152) : warning 215: expression has no effect
C:\Documents and Settings\Moustafa & Ahmed\Desktop\server\gamemodes\universalstuntages.pwn(152) : error 001: expected token: ";", but found "]"
C:\Documents and Settings\Moustafa & Ahmed\Desktop\server\gamemodes\universalstuntages.pwn(152) : error 029: invalid expression, assumed zero
C:\Documents and Settings\Moustafa & Ahmed\Desktop\server\gamemodes\universalstuntages.pwn(152) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


4 Errors.



Re: [HELP!!] Auto car fixing / Nitrous with hotkey - Moustafa - 14.06.2009

I AM WAITING FOR A REPLY FOR 1 FUCKING MONTH, WTF!! SOMEONE REPLY FFS


Re: [HELP!!] Auto car fixing / Nitrous with hotkey - Lewwy - 14.06.2009

Not with that attitude.
/spank.


Re: [HELP!!] Auto car fixing / Nitrous with hotkey - Moustafa - 14.06.2009

Please.. can you please.. reply me .. and tell me what is the error.? please..?


Re: [HELP!!] Auto car fixing / Nitrous with hotkey - steven_italy - 15.06.2009

Here the autofix that i use on my server:

PWN: http://www.mediafire.com/download.php?50zwmjdt3nt
AMX: http://www.mediafire.com/download.php?zyyozfntjmu


Re: [HELP!!] Auto car fixing / Nitrous with hotkey - Moustafa - 15.06.2009

currently, i need the NoS thingy, how to do it? its not working!


Re: [HELP!!] Auto car fixing / Nitrous with hotkey - steven_italy - 15.06.2009

Код:
public OnPlayerText(playerid, text[])
 {
				if(strcmp(cmd, "/nos", true) == 0)
			  {
			    new car = GetPlayerVehicleID(playerid);
	        AddVehicleComponent(car,1010);
			    SendClientMessage(playerid,COLOR_WHITE,"[INFO] You have succesfully added 10x Nitro to car");
}
return 1;
				}
something like this?


Re: [HELP!!] Auto car fixing / Nitrous with hotkey - Moustafa - 15.06.2009

No, something when hotkey, when its pressed, he gets NoS