Well. If you want to use /enter and /exit nears pickups you can try this:
Код:
new EnterPickup; // you can change the name of this variable
Go to OnGameModeInit callback
Код:
public OnGameModeInit()
{
EnterPickup = CreatePickup(model, type, Float:X, Float:Y, Float:Z, virtualworld) // Put your own coordonates and IDs
return 1;
}
And now, the command /enter
Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp("/enter", cmdtext, true, 10) == 0)
{
if(IsPlayerInRangeOfPoint(playerid,4, Float:x, Float:y, Float:z); // Replace Float:X,Float:y,Float:z with the coordonates of your pickup
SetPlayerPos(playerid, Float:x, Float:y, Float:z) // Replace Float:X,Float:y,Float:z with the coordonates of your interior
SetPlayerInterior(playerid,1);
SendClientMessage(playerid,-1,"You have entered in ...");
return 1;
}
return 0;
}
The same thing for /exit, only that is reversed.
If you want to enter by pressing Y instead of /enter /exit you can replace the commands with
Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if(PRESSED(KEY_YES))
{
// Code here
}
return 1;
}
P.S. If you choose the way by pressing Y you must add this on top of your gamemode.
Код:
#define PRESSED(%0) (((newkeys & (%0)) == (%0)) && ((oldkeys & (%0)) != (%0)))