Tank(Rhino) Health
#1

Greetings everybody... I have been searching arround for something about this and have not found anything so far... so... time to post it

Yesterday I was doing some lol stuff with a friend in our server and I were chasing him with a tank , suddendly, he turn in a corner, get down from his vehicle, pick up a desert eagle and shoot at me, destroying the tank after a few shots....

So now i was wondering how can I make the Tank a ""invincible"" vehicle, so it can be used properly. I guess I can make it invincible throught "OnPlayerUpdate", checking if the player is in a tank and is under X health, and setting it to the maximum... but i do not want it to be completely invincible.... I want it just lick the game, to be destroyed by explosives, rockets, grenades, etc... (If possible not flamethrower cos its OP)

So... u guys have any ideas how could I do it?

Thanks everyone!
Reply
#2

pawn Код:
public OnVehicleSpawn(vehicleid)
{
    if(GetVehicleModel(vehicleid) == 432)
    {
        SetVehicleHealth(vehicleid, Float:0x7FFFFFFF);
    }
    return 1;
}
Reply
#3

Isnt 0x7FFFFFFF a hexadecimal for colors?
Reply
#4

Just because it's written in hexadecimal format, it doesn't mean that it's a color.

0x7FFFFFFF is 2,147,483,647 in decimal; the highest possible number you can reach using 32 bits integers. I just find it easier to remember the hexadecimal representation, rather than a bunch of meaningless numbers.

@Beneath me: Yes, I know. But you can only create signed 32 bit integers in Pawn, so it wasn't worth mentioning.
Reply
#5

Quote:
Originally Posted by Vince
Посмотреть сообщение
the highest possible number you can reach using 32 bits integers..
Note: Using signed 32-bits integers. Unsigned integers go from 0 to 4,294,967,295. You probably know this Vince, I just wanted to inform Castro.
Reply
#6

Interesting, didnt know about it!

But just test it and it did not work at all! After about 10 shots from desert eagle, tank got fire and... boom!
Reply
#7

Hmm, IIRC OnVehicleSpawn isn't called when you use AddStaticVehicle.. You can try looping through all vehicles that are spawned (or MAX_VEHICLES ..) and then do the check and set its HP if it's a Rhino.
Reply
#8

Quote:
Originally Posted by Vince
Посмотреть сообщение
Just because it's written in hexadecimal format, it doesn't mean that it's a color.

0x7FFFFFFF is 2,147,483,647 in decimal; the highest possible number you can reach using 32 bits integers. I just find it easier to remember the hexadecimal representation, rather than a bunch of meaningless numbers.
Small off topic, do you feel smarter now? you want to say that some 0xBLABLA is easier then 1000.0 ?
Reply
#9

Quote:
Originally Posted by ikey07
Посмотреть сообщение
Small off topic, do you feel smarter now? you want to say that some 0xBLABLA is easier then 1000.0 ?
Yes, writing 0x7FFFFFFF is easier than 1216518615156132... I mean. 2147483647.
Even writing 0b1111111111111111111111111111111 is easier than 2147483647.
and with 1000.0 you won't have real invincibility. just full hp.
Reply
#10

Quote:
Originally Posted by ikey07
Посмотреть сообщение
Small off topic, do you feel smarter now? you want to say that some 0xBLABLA is easier then 1000.0 ?
Off topic and stupid. 0x7FFFFFFF is WAY easier than remembering the largest integer in decimal. (247blablablabla)

1000.0 would be 0x3E8 btw, not 0xBLABLA
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)