21.05.2018, 15:47
Hello guys i need tut or help how can i create like when you at bank and press f/enter anything to go in and then teleport you into custom interior. Please help me
if (strcmp("/enter", cmdtext, true, 10) == 0)
{
if(IsPlayerInRangeOfPoint(playerid, range, Float:x, Float:y, Float:z)) {
SetPlayerPos(playerid, Float:x, Float:y, Float:z);
SetPlayerInterior(playerid, interiorid);
}
return 1;
}
This is how you do it. Under the command called /enter, Check if the player is near a bank.
You can do this by using the function IsPlayerInRangeOfPoint();. The X, Y, Z coord of the function corresponds to the X, Y, Z coord of the bank entrance. Then under the if statement, Set the player pos and his interior. A list of interior ids and location can be found here: CLICK ME So in conclusion, Your code should look something like this. PHP код:
|
#define PRESSED(%0) \
(((newkeys & (%0)) == (%0)) && ((oldkeys & (%0)) != (%0)))
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if(PRESSED(KEY_SECONDARY_ATTACK)) {
if(IsPlayerInRangeOfPoint(playerid, 3, Float:x, Float:y, Float:z)) {
SetPlayerPos(playerid, 2315.952880,-1.618174,26.742187);
SetPlayerInterior(playerid, 0);
}
return 1;
}