public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if(newkeys & KEY_YES)
{
new Float:X, Float:Y, Float:Z;
GetPlayerPos(playerid, X,Y,Z);
for(new i=1;i<MAX_VEHICLES;i++)
{
if(GetVehicleModel(i) == 508)
{
new Float:fDistance = GetVehicleDistanceFromPoint(i, X, Y, Z);
if(fDistance < 5)
{
ExitX[playerid] = X, ExitY[playerid] = Y, ExitZ[playerid] = Z;
SetPlayerPos(playerid, -360.6434,-1499.0181,516.6295), SetPlayerVirtualWorld(playerid, 1);
SetCameraBehindPlayer(playerid);
SendClientMessage(playerid, COLOR_NOTES, "[INFO] You've entered the 'Journey', to leave it, press 'N'.");
return 1;
}
}
}
}
if(newkeys & KEY_NO)
{
new Float:X, Float:Y, Float:Z;
GetPlayerPos(playerid, X,Y,Z);
if(IsPlayerInRangeOfPoint(playerid, 8, -360.6434,-1499.0181,516.6295))
{
SetPlayerPos(playerid, ExitX[playerid], ExitY[playerid], ExitZ[playerid]), SetPlayerVirtualWorld(playerid, 0);
SendClientMessage(playerid, COLOR_NOTES, "[INFO] You've left the 'Journey's' interior.");
return 1;
}
}
return 1;
}
make sure its in GM script
if not then make sure that in GM script OnKeyStateChange there is no return 0; in it |
//---[Keys]
#define PRESSED(%0) (((newkeys & (%0)) == (%0)) && ((oldkeys & (%0)) != (%0)))
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if(PRESSED(KEY_YES))
{
new Float:X, Float:Y, Float:Z;
GetPlayerPos(playerid, X,Y,Z);
for(new i=0;i<MAX_VEHICLES;i++)
{
if(GetVehicleModel(i) == 508)
{
new Float:fDistance = GetVehicleDistanceFromPoint(i, X, Y, Z);
if(fDistance <= 5)
{
ExitX[playerid] = X, ExitY[playerid] = Y, ExitZ[playerid] = Z;
SetPlayerPos(playerid, -360.6434,-1499.0181,516.6295);
SetPlayerVirtualWorld(playerid, 1);
SetCameraBehindPlayer(playerid);
SendClientMessage(playerid, COLOR_NOTES, "[INFO] You've entered the 'Journey' to leave it,
press 'N'.");
}
}
}
return 1;
try
PHP код:
|