02.07.2014, 10:58
I created this "Interior" script for the vehicle "Journey".
Basically, whenever you press 'Y' while next to the "Journey", it should place you in its interior ( custom map ).
But the problem is, that nothing is happening.
I've tried changing the "newkeys & KEY_***" to "newkeys == KEY_***", but that doesn't work either.
I'm guessing the problem is in the loop, but I don't see any problem there d:
code;
Basically, whenever you press 'Y' while next to the "Journey", it should place you in its interior ( custom map ).
But the problem is, that nothing is happening.
I've tried changing the "newkeys & KEY_***" to "newkeys == KEY_***", but that doesn't work either.
I'm guessing the problem is in the loop, but I don't see any problem there d:
code;
pawn Код:
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;
}