SA-MP Forums Archive
I need help with 1 function. +1 rep for help again - 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: I need help with 1 function. +1 rep for help again (/showthread.php?tid=308923)



I need help with 1 function. +1 rep for help again - Artie_Scorpion - 05.01.2012

pawn Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
    if( oldstate == PLAYER_STATE_ONFOOT && newstate == PLAYER_STATE_DRIVER )
    {
    //If they got into a car from being on foot.
        if( CheckVehicle( GetPlayerVehicleID( playerid ) ) )  //naudoti || masina ||
        {
            if( GetPlayerSkin(playerid) != 287) //naudoti || skinas || nepamirsti id 27
            {
                //If their skin is not 27
                //Remove them and send message.
                RemovePlayerFromVehicle( playerid );
                SendClientMessage( playerid,0xFF000000, "Noredami vairuoti si transporta turite buti kareiviu" );//-1
            }
            else
            {
                SendClientMessage(playerid, 0xFF000000, "Atsisedote i transporta. Jeigu dirbate, tada dirbkite savo darba");
            }
        }
    }
    return 1;
}
and
pawn Код:
CheckVehicle( vehicleid ) {

     switch( GetVehicleModel( vehicleid ) ) {

          case 520, 593, 476, 432: return true;

     }
     return false;
}
This is vehicles which allowed to use only soldiers.
So question is how to make this function for others, like medics, mechanics in this one function? Oh and don't forget a vehicles for them...


Re: I need help with 1 function. +1 rep for help again - [NRG]Dark - 05.01.2012

In Line:
Quote:

if( GetPlayerSkin(playerid) != 287) //naudoti || skinas || nepamirsti id 27

It is specified what should be done if the player is not using the skin 287.
What should be done is the following:

Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
    if( oldstate == PLAYER_STATE_ONFOOT && newstate == PLAYER_STATE_DRIVER )
    {
    //If they got into a car from being on foot.
        if( CheckVehicle( GetPlayerVehicleID( playerid ) ) )  //naudoti || masina ||
        {
            if( GetPlayerSkin(playerid) != 287) //naudoti || skinas || nepamirsti id 27
            {
                //If their skin is not 27
                //Remove them and send message.
                RemovePlayerFromVehicle( playerid );
                SendClientMessage( playerid,0xFF000000, "Noredami vairuoti si transporta turite buti kareiviu" );//-1
            }
if( GetPlayerSkin(playerid) != [skin_of_player]) //naudoti || skinas || nepamirsti id 27
            {
                //If their skin is not [skin_of_player]
                //Remove them and send message.
                RemovePlayerFromVehicle( playerid );
                SendClientMessage( playerid,0xFF000000, "Noredami vairuoti si transporta turite buti kareiviu" );//-1
            }
            else
            {
                SendClientMessage(playerid, 0xFF000000, "Atsisedote i transporta. Jeigu dirbate, tada dirbkite savo darba");
            }
        }
    }
    return 1;
}
replace the skin [skin_of_player] for the skin of type of player


Re: I need help with 1 function. +1 rep for help again - Artie_Scorpion - 05.01.2012

Quote:
Originally Posted by [NRG]Dark
Посмотреть сообщение
In Line:

It is specified what should be done if the player is not using the skin 287.
What should be done is the following:

Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
    if( oldstate == PLAYER_STATE_ONFOOT && newstate == PLAYER_STATE_DRIVER )
    {
    //If they got into a car from being on foot.
        if( CheckVehicle( GetPlayerVehicleID( playerid ) ) )  //naudoti || masina ||
        {
            if( GetPlayerSkin(playerid) != 287) //naudoti || skinas || nepamirsti id 27
            {
                //If their skin is not 27
                //Remove them and send message.
                RemovePlayerFromVehicle( playerid );
                SendClientMessage( playerid,0xFF000000, "Noredami vairuoti si transporta turite buti kareiviu" );//-1
            }
if( GetPlayerSkin(playerid) != [skin_of_player]) //naudoti || skinas || nepamirsti id 27
            {
                //If their skin is not [skin_of_player]
                //Remove them and send message.
                RemovePlayerFromVehicle( playerid );
                SendClientMessage( playerid,0xFF000000, "Noredami vairuoti si transporta turite buti kareiviu" );//-1
            }
            else
            {
                SendClientMessage(playerid, 0xFF000000, "Atsisedote i transporta. Jeigu dirbate, tada dirbkite savo darba");
            }
        }
    }
    return 1;
}
replace the skin [skin_of_player] for the skin of type of player
Are you crazy or something? I told you to dont make other skins for military vehicles!!!
I wanted for ex. medic with ambulance and rancher...


Re: I need help with 1 function. +1 rep for help again - Artie_Scorpion - 05.01.2012

do something


Re: I need help with 1 function. +1 rep for help again - [NRG]Dark - 05.01.2012

Sorry but I did not understand what he said.