#1

existe algun codigo que no permita al jugador salir de vehiculo a menos que muera?
Reply
#2

pawn Код:
static
    PlayerQuieto[MAX_PLAYERS],
    VehiculoID[MAX_PLAYERS],
    AsientoID[MAX_PLAYERS];

public OnPlayerStateChange(playerid,newstate,oldstate)
{
    if(newstate == PLAYER_STATE_DRIVER || newstate == PLAYER_STATE_PASSENGER)
    {
        if(PlayerQuieto[playerid] == 0)
        {
            VehiculoID[playerid] = GetPlayerVehicleID(playerid);
            AsientoID[playerid] = GetPlayerVehicleSeat(playerid);
        }
    }
    if(oldstate == PLAYER_STATE_DRIVER || oldstate == PLAYER_STATE_PASSENGER)
    {
        if(PlayerQuieto[playerid] == 1)
        {
            PutPlayerInVehicle(playerid, VehiculoID[playerid], AsientoID[playerid]);
        }
    }
    return 1;
}

public OnPlayerDeath(playerid, killerid, reason)
{
    VehiculoID[playerid] = 0;
    AsientoID[playerid] = 0;
    return 1;
}

public OnVehicleDeath(vehicleid, killerid)
{
    VehiculoID[killerid] = 0;
    AsientoID[killerid] = 0;
    return 1;
}
Reply
#3

pawn Код:
static
    PlayerQuieto[MAX_PLAYERS],
    VehiculoID[MAX_PLAYERS],
    AsientoID[MAX_PLAYERS];

public OnPlayerStateChange(playerid,newstate,oldstate)
{
    if(newstate == PLAYER_STATE_DRIVER || newstate == PLAYER_STATE_PASSENGER)
    {
        if(PlayerQuieto[playerid] == 0)
        {
            VehiculoID[playerid] = GetPlayerVehicleID(playerid);
            AsientoID[playerid] = GetPlayerVehicleSeat(playerid);
            PlayerQuieto[playerid] = 1;
        }
    }
    if(oldstate == PLAYER_STATE_DRIVER || oldstate == PLAYER_STATE_PASSENGER)
    {
        if(PlayerQuieto[playerid] == 1)
        {
            PutPlayerInVehicle(playerid, VehiculoID[playerid], AsientoID[playerid]);
            PlayerQuieto[playerid] = 0;
        }
    }
    return 1;
}

public OnPlayerDeath(playerid, killerid, reason)
{
    VehiculoID[playerid] = 0;
    AsientoID[playerid] = 0;
    return 1;
}

public OnVehicleDeath(vehicleid, killerid)
{
    VehiculoID[killerid] = 0;
    AsientoID[killerid] = 0;
    return 1;
}
Es el mismo cуdigo de arriba, solo que le arregle un error que iba a dar
Reply
#4

Quote:
Originally Posted by Bu11Sh0t
Посмотреть сообщение
pawn Код:
static
    PlayerQuieto[MAX_PLAYERS],
    VehiculoID[MAX_PLAYERS],
    AsientoID[MAX_PLAYERS];

public OnPlayerStateChange(playerid,newstate,oldstate)
{
    if(newstate == PLAYER_STATE_DRIVER || newstate == PLAYER_STATE_PASSENGER)
    {
        if(PlayerQuieto[playerid] == 0)
        {
            VehiculoID[playerid] = GetPlayerVehicleID(playerid);
            AsientoID[playerid] = GetPlayerVehicleSeat(playerid);
            PlayerQuieto[playerid] = 1;
        }
    }
    if(oldstate == PLAYER_STATE_DRIVER || oldstate == PLAYER_STATE_PASSENGER)
    {
        if(PlayerQuieto[playerid] == 1)
        {
            PutPlayerInVehicle(playerid, VehiculoID[playerid], AsientoID[playerid]);
            PlayerQuieto[playerid] = 0;
        }
    }
    return 1;
}

public OnPlayerDeath(playerid, killerid, reason)
{
    VehiculoID[playerid] = 0;
    AsientoID[playerid] = 0;
    return 1;
}

public OnVehicleDeath(vehicleid, killerid)
{
    VehiculoID[killerid] = 0;
    AsientoID[killerid] = 0;
    return 1;
}
Es el mismo cуdigo de arriba, solo que le arregle un error que iba a dar
esta mal, lo ke agregaste, por ke cuando se suba de se blokeada el asiento, pero lo dejara sali igual, ya ke cuando subir le das acceso a la otra funcion y cuando bajas le das a la otra.

eso lo deberia colocar en algun comando, por ejemplo . /Seguros .

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if(strcmp("/Seguros ", cmdtext, true, 10) == 0)
    {
        if(PlayerQuieto[playerid] == 0)
        {
            PlayerQuieto[playerid] = 1;
        }
        else if(PlayerQuieto[playerid] == 1)
        {
            PlayerQuieto[playerid] = 0;
        }
        return 1;
    }
    return 0;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)