*** This topic title sucks, "help me" is not descriptive.
#1

Okay so heres my problem if you want to attach the Xoomer trailer to a roadtrain or linerunner the health should go down till it once explodes... I've tried some stuff but i can't manage to get it to work. This is what i got.

pawn Код:
for(new c = 0; c < MAX_PLAYERS; c++)
    {
        new vehicleid = GetPlayerVehicleID(playerid);
        if(IsPlayerInAnyVehicle(c))
        {
            if(GetVehicleModel(vehicleid) == 515)
            {
                if(GetVehicleModel(GetVehicleTrailer(vehicleid))== 584)
                {
                    new Float:health;
                    new veh = GetPlayerVehicleID(playerid);
                    GetVehicleHealth(GetVehicleModel(GetVehicleTrailer(veh))== 584, health);
                    SetVehicleHealth(GetVehicleModel(GetVehicleTrailer(veh))== 584, health-1);
                }

            }
        }

    }
This is in a timer wich repeats every 500 MS. Outputs no errors but neither removes 1 HP everytime it runs... Anyone can help?

Thanks in advance
Reply
#2

Change all of the "playerid" inside that script to "c", as you're using a loop it won't be looping through all of the players.
Reply
#3

pawn Код:
for(new c = 0; c < MAX_PLAYERS; c++)
    {
        new vehicleid = GetPlayerVehicleID(c);
        if(IsPlayerInAnyVehicle(c))
        {
            if(GetVehicleModel(vehicleid) == 515)
            {
                if(GetVehicleModel(GetVehicleTrailer(vehicleid))== 584)
                {
                    new Float:health;
                    GetVehicleHealth(vehicleid, health);
                    SetVehicleHealth(vehicleid, health-1);
                }

            }
        }

    }
try it...
EDIT POST UPDATED
Reply
#4

That still doesnt take down the trailer's health once a roadtrain is attached to xoomer
Reply
#5

post updated...
Reply
#6

Now its taking down the trucks health instead of the trailers health...
Reply
#7

Dude please make a good title next time, you always make threads like "Something need help" "Please help", please try to define problem in title. like "Mysql help" "Car bug" or something
Reply
#8

PHP код:
for(new 0MAX_PLAYERSc++)
    {
        new 
vehicleid GetPlayerVehicleID(c);
        if(
IsPlayerInAnyVehicle(c))
        {
            if(
GetVehicleModel(vehicleid) == 515)
            {
                   new 
vtrailer GetVehicleTrailer(vehicleid);
                if(
GetVehicleModel(vtrailer == 584))
                {
                    new 
Float:health;
                    
GetVehicleHealth(vtrailerhealth);//vtrailer = trailer
                    
SetVehicleHealth(vtrailerhealth-1);//vtrailer = trailer
                
}

            }
        }

    } 
Reply
#9

Quote:
Originally Posted by ExpertSahil
Посмотреть сообщение
Dude please make a good title next time, you always make threads like "Something need help" "Please help", please try to define problem in title. like "Mysql help" "Car bug" or something
Making this name gets people's attention as they want to know what it is. Just like you.. I just use your mind xD
Reply
#10

Okay i got this:
pawn Код:
for(new c = 0; c < MAX_PLAYERS; c++)
    {
        new vehicleid = GetPlayerVehicleID(c);
        if(IsPlayerInAnyVehicle(c))
        {
            if(GetVehicleModel(vehicleid) == 515)
            {
                new vtrailer = GetVehicleTrailer(vehicleid);
                if(GetVehicleModel(vtrailer) == 584)
                {
                    new Float:health;
                    GetVehicleHealth(vtrailer, health);//vtrailer = trailer
                    SetVehicleHealth(vtrailer, health-1);//vtrailer = trailer
                }

            }
        }

    }
It sure does something. When i attach roadtrain to a xoomer it removes 1 HP but it needs to go all the way to 0... how to make it do that?
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)