28.08.2012, 18:51
existe algun codigo que no permita al jugador salir de vehiculo a menos que muera?
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;
}
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;
}
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;
}