SA-MP Forums Archive
Somethings worng.. - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Somethings worng.. (/showthread.php?tid=107270)



Somethings worng.. - BP13 - 09.11.2009

pawn Код:
public OnVehicleStreamIn(vehicleid, forplayerid)
{
    if(IsPlayerInAnyVehicle(forplayerid) && PlayerIsInDM[forplayerid] == false) //seems to work
    {
    for(new i = 0; i < MAX_PLAYERS; i++)
        {
        if(IsPlayerConnected(i))
            {
                SetVehicleHealth(GetPlayerVehicleID(forplayerid), 999999.0);
            }
        }
    }
    if(IsPlayerInAnyVehicle(forplayerid) && PlayerIsInDM[forplayerid] == true)//Does not work cars are still invincible.
    {
    for(new i = 0; i < MAX_PLAYERS; i++)
        {
        if(IsPlayerConnected(i))
            {
                SetVehicleHealth(GetPlayerVehicleID(forplayerid), 1000.0);
            }
        }
    }
    if(IsPlayerInAnyVehicle(forplayerid) && Locked[forplayerid] == true)
    {
    for(new i = 0; i < MAX_PLAYERS; i++)
        {
        if(IsPlayerConnected(i))
            {
                SetVehicleParamsForPlayer(vehicleid, i, 0, 1);
            }
        }
    }
}
Please help. I'm not sure why its doing this.


Re: Somethings worng.. - StrickenKid - 09.11.2009

well what you're doing doesn't make sense...

pawn Код:
public OnVehicleStreamIn(vehicleid, forplayerid)
{
    if(IsPlayerInAnyVehicle(forplayerid) && !PlayerIsInDM[forplayerid]) //seems to work
    {
        for(new i = 0; i < MAX_PLAYERS; i++) // you're looping through every player
        {
            if(IsPlayerConnected(i)) // you're checking if that player is connected
            {
                SetVehicleHealth(GetPlayerVehicleID(forplayerid), 999999.0); // then you're setting the health of one car all those times....
            }
        }
    }
    if(IsPlayerInAnyVehicle(forplayerid) && PlayerIsInDM[forplayerid] == true)//Does not work cars are still invincible.
    {
        for(new i = 0; i < MAX_PLAYERS; i++)
        {
            if(IsPlayerConnected(i))
            {
                SetVehicleHealth(GetPlayerVehicleID(forplayerid), 1000.0); // same thing here, setting the health of one car many times
            }
        }
    }
    if(IsPlayerInAnyVehicle(forplayerid) && Locked[forplayerid] == true)
    {
        for(new i = 0; i < MAX_PLAYERS; i++)
        {
            if(IsPlayerConnected(i))
            {
                SetVehicleParamsForPlayer(vehicleid, i, 0, 1);
            }
        }
    }
}



Re: Somethings worng.. - BP13 - 09.11.2009

well um what am I suppose to do.