Something like press "2" to fix. - 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: Something like press "2" to fix. (
/showthread.php?tid=425595)
Something like press "2" to fix. -
LeeXian99 - 26.03.2013
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.
Re: Something like press "2" to fix. -
RajatPawar - 26.03.2013
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 !
Re: Something like press "2" to fix. -
Macluawn - 26.03.2013
Script Request Thread #6
Re: Something like press "2" to fix. -
newbienoob - 26.03.2013
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
Re: Something like press "2" to fix. -
dr.lozer - 26.03.2013
pawn Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if(newkeys == KEY_SUBMISSION && IsPlayerInAnyVehicle(playeird)) {
new vehicleid = GetPlayerVehicleID(playerid);
SetVehicleHealth(vehicleid, 1000);
}
return 1;
}
Re: Something like press "2" to fix. -
Gamer_007 - 26.03.2013
There is no
next time.And there are a dozen of scripts like that uploaded on this forum.First try to "Seacrh".