some vehicles.?
#1

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

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

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.
Reply
#4

i want if someone get in this vehicle hes get armour


Reply
#5

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

ty bro 1more rep for u
Reply
#7

oops hes said i cant rep u now sorry
Reply
#8

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"
Reply
#9

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;
}
Reply
#10

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


Forum Jump:


Users browsing this thread: 1 Guest(s)