15.06.2011, 15:58
pawn Code:
public OnPlayerStateChange(playerid,newstate,oldstate)
{
if(oldstate == PLAYER_STATE_ONFOOT && newstate == PLAYER_STATE_PASSENGER)
{
new jm = GetPlayerVehicleID(playerid);
if(GetVehicleModel(jm) == 437) {
SetPlayerPos(playerid, /*x,y,z do interior*/);
SetPlayerFacingAngle(playerid, 181.1296);
SetPVarInt(playerid, "vID", GetPlayerVehicleID(playerid));
return 0x01;
}
return 0x01;
}
return 0x01;
}
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if(newkeys == KEY_SECONDARY_ATTACK)
{
if(GetPVarInt(playerid, "vID") > 0) {
new Float:Pos[3];
GetVehiclePos(GetPVarInt(playerid, "vID"), Pos[0], Pos[1], Pos[2]);
SetPlayerPos(playerid, Pos[0]+4, Pos[1], Pos[2]);
DeletePVar(playerid, "vID");
return 0x01;
}
}
return 1;
}