SA-MP Forums Archive
some vehicles.? - 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: some vehicles.? (/showthread.php?tid=461956)



some vehicles.? - BoU3A - 04.09.2013

can i make if someone get in some vehicles get armour or health or something ?


Re: some vehicles.? - xganyx - 04.09.2013

pawn Код:
public OnPlayerEnterVehicle(playerid, vehicleid)
{
    for( new i; i < MAX_VEHICLES; i++)
    {
         if(vehicleid == i)
         {
              Your code
         }
    }
    return 1;
}



Re: some vehicles.? - Konstantinos - 04.09.2013

You could explain it better what you wanted to do anyways.

For example (if that was what you meant by "some vehicles"):
pawn Код:
public OnPlayerStateChange( playerid, newstate, oldstate )
{
    if( newstate == PLAYER_STATE_DRIVER && GetVehicleModel( GetPlayerVehicleID( playerid ) ) == 411 )
    { // If the player is now driver and the vehicle got in is infernus..
   
        SetPlayerHealth( playerid, 100.0 );
        SetPlayerArmour( playerid, 100.0 );
    }
    return 1;
}
@xganyx: You do not need to loop through vehicles, you already know the vehicleid.


Re: some vehicles.? - BoU3A - 04.09.2013

i want if someone get in this vehicle hes get armour





Re: some vehicles.? - Konstantinos - 04.09.2013

pawn Код:
public OnPlayerStateChange( playerid, newstate, oldstate )
{
    if( newstate == PLAYER_STATE_DRIVER && GetVehicleModel( GetPlayerVehicleID( playerid ) ) == 427 )
    {  
        SetPlayerArmour( playerid, 100.0 );
    }
    return 1;
}



Re: some vehicles.? - BoU3A - 04.09.2013

ty bro 1more rep for u


Re: some vehicles.? - BoU3A - 04.09.2013

oops hes said i cant rep u now sorry


Re: some vehicles.? - BoU3A - 04.09.2013

Quote:

public OnPlayerStateChange(playerid, newstatse, oldstatse)
{

if( newstatse == PLAYER_STATSE_DRIVER && GetVehicleModel( GetPlayerVehicleID( playerid) ) == 427 )
{

SetPlayerArmour( playerid, 100.0);
}
return 1;
}

i got this Errors..

Quote:

C:\Users\John\samp03x_svr_R1-2_win32\gamemodes\MyFrist.pwn(173) : error 025: function heading differs from prototype
C:\Users\John\samp03x_svr_R1-2_win32\gamemodes\MyFrist.pwn(176) : error 017: undefined symbol "PLAYER_STATSE_DRIVER"
C:\Users\John\samp03x_svr_R1-2_win32\gamemodes\MyFrist.pwn(195) : error 021: symbol already defined: "OnPlayerStateChange"

i fix this error 017: undefined symbol "PLAYER_STATSE_DRIVER"

and fix this error 021: symbol already defined: "OnPlayerStateChange"


Re: some vehicles.? - Konstantinos - 04.09.2013

It's spelled "state" not "statse". You have that callback already, just copy:
pawn Код:
// The below lines
    if( newstate == PLAYER_STATE_DRIVER && GetVehicleModel( GetPlayerVehicleID( playerid ) ) == 427 )
    {  
        SetPlayerArmour( playerid, 100.0 );
    }
and paste them into OnPlayerStateChange callback (Ctrl + F to find it if you want, type in the box "OnPlayerStateChange" and hit enter).

It will just look like that:
pawn Код:
public OnPlayerStateChange( playerid, newstate, oldstate )
{
    if( newstate == PLAYER_STATE_DRIVER && GetVehicleModel( GetPlayerVehicleID( playerid ) ) == 427 )
    {  
        SetPlayerArmour( playerid, 100.0 );
    }
    // Some other code you had..
    return 1;
}



Re: some vehicles.? - BoU3A - 04.09.2013

i dont like copy still just this error 025: function heading differs from prototype what the problem?