SA-MP Forums Archive
*** This topic title sucks, "help me" is not descriptive. - 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: *** This topic title sucks, "help me" is not descriptive. (/showthread.php?tid=390007)



*** This topic title sucks, "help me" is not descriptive. - thimo - 04.11.2012

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


Re: Help with something - iGetty - 04.11.2012

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.


Re: Help with something - Danyal - 04.11.2012

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


Re: Help with something - thimo - 04.11.2012

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


Re: Help with something - Danyal - 04.11.2012

post updated...


Re: Help with something - thimo - 04.11.2012

Now its taking down the trucks health instead of the trailers health...


Re: Help with something - ExpertSahil - 04.11.2012

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


Re: Help with something - tyler12 - 04.11.2012

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
                
}

            }
        }

    } 



Re: Help with something - thimo - 04.11.2012

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


Re: Help with something - thimo - 04.11.2012

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?