SA-MP Forums Archive
Will this work - 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: Will this work (/showthread.php?tid=480992)



Will this work - kingcrome - 13.12.2013

If i make a command /opcar and the script will be like SetCarHealth 500000 will it have that much health?


Re: Will this work - SilentSoul - 13.12.2013

Try by your self first , using this functions
IsPlayerInAnyVehicle
SetVehicleHealth


Re: Will this work - MORJAN1122 - 13.12.2013

do like this
Код:
if(strcmp("/opcar", cmdtext, true) == 0)
{
    new vehicleid = GetPlayerVehicleID(playerid);
    SetVehicleHealth(vehicleid, 1000);
    SendClientMessage(playerid, COLOUR_WHITE, "The vehicles engine has been fully repaired.");
    return 1;
}
and you cant set500000 becuse full health is 1000 see this WIKI SetVehicleHealth


Re: Will this work - Vince - 13.12.2013

I'm pretty sure the health is limited to 0xFFFF (65535). But yes, it should work.

Edit: Well fuck you, flood control!


Re: Will this work - tuitalker - 13.12.2013

you can set a timer if you want your car undestructible or be automatically repaired every (for example) 1 second.


Re: Will this work - xVIP3Rx - 13.12.2013

Quote:
Originally Posted by MickeyB
Посмотреть сообщение
The default health for all vehicles is 1000, this is not the maximum you can set it to whatever you like using SetVehicleHealth. Increasing the value will simply mean it will be allowed to take more damage before it explodes.

Something that may also interest you is that different vehicles take different values of damage on collisions with objects or other vehicles however weapons do the same amount of damage to any vehicle, so a Rhino can be destroyed in the same amount of bullets it takes to destroy a Tractor.

(Note that all vehicles will catch on fire and explode at 250.0 health)


Hope this helps you out.


EDIT: You can also use the command "/DL" in-game which will show a 3D text on every vehicle stating various information about it including its current health, this may help you with debugging and troubleshooting when using the SetVehicleHealth function.
Quote:
Originally Posted by Vince
Посмотреть сообщение
Edit: Well fuck you, flood control!
Yeah I hate it too..


Re: Will this work - kingcrome - 13.12.2013

I know that full hp is 1k but if i set it to 50k will it make it more tanky?


Re: Will this work - SilentSoul - 13.12.2013

Quote:
Originally Posted by MORJAN1122
Посмотреть сообщение
do like this
Код:
if(strcmp("/opcar", cmdtext, true) == 0)
{
    new vehicleid = GetPlayerVehicleID(playerid);
    SetVehicleHealth(vehicleid, 1000);
    SendClientMessage(playerid, COLOUR_WHITE, "The vehicles engine has been fully repaired.");
    return 1;
}
and you cant set500000 becuse full health is 1000 see this WIKI SetVehicleHealth
You can manage the value of the health , wiki samp saying full health for the vehicle equal 1000that's not mean can't go above 1000, same thing with SetPlayerHealth for health equal to 100 but you can set his health to whatever you want.


Respuesta: Re: Will this work - Gryphus One - 13.12.2013

Quote:
Originally Posted by Vince
Посмотреть сообщение
I'm pretty sure the health is limited to 0xFFFF (65535). But yes, it should work.
One day I was playing in a friend's test server (I think it was home hosted) and I'm not sure, but I think he had a car with 100k health. Also I don't remember if he used SetVehicleHealth or a cheat.


Re: Will this work - Hansrutger - 13.12.2013

Quote:
Originally Posted by kingcrome
Посмотреть сообщение
I know that full hp is 1k but if i set it to 50k will it make it more tanky?
You can make it more tanky by buying more armor and make sure your enemies don't have armor penentration and you'll be just fine.

Sorry, you just simply don't get these opportunities anymore. xD


On topic: A guy from an other university came once to visit our university and he told us to try things that we wanted to know the answer to. He also said that he doubted that what we knew at that time would even be possible to crash our computers and therefore he told us that advice. Same goes for you, I doubt that you can make your own computer crash if you try to make a such command. However, I suggest you put like a "SendClientMessage" under when you have repaired along with a format telling you how much the car was "healed" by and by that you will also know if it worked. And then do /dl ingame to see if it indeed worked. :P