public OnPlayerCommandText(playerid, cmdtext[])
{
new idx;
new cmd[256];
cmd = strtok(cmdtext, idx);
// Public commands.
if(strcmp("/enter", cmd, true) == 0) // enter property
{
if( lastPickup[playerid] != -1 || properties[lastPickup[playerid]][eType] > 0 ){
new
id = propPickups[lastPickup[playerid]],
Float:x,
Float:y,
Float:z;
GetPropertyEntrance( id, x, y, z );
if( IsPlayerInRangeOfPoint( playerid, 3.0, x, y, z )){
PutPlayerInProperty( playerid, id );
SendClientMessage( playerid, 0x55AADDFF, "* You have entered a property.. type /exit to leave" );
return 1;
}
}
return 1;
}
else if(strcmp("/exit", cmd, true) == 0) // exit property
{
if( currentInt[playerid] > -1 && GetPlayerInterior(playerid) == GetPropertyInteriorId( currentInt[playerid] )){
new id = currentInt[playerid];
new Float:x;
new Float:y;
new Float:z;
new Float:a;
// make sure they're near the exit before allowing them to exit.
GetPropertyExit( id, x, y, z );
if(!IsPlayerInRangeOfPoint(playerid,4.5,x,y,z)) {
SendClientMessage(playerid,0xDDAA55FF,"* You must be near the property exit to /exit");
return 1;
}
a = GetPropertyEntrance( id, x, y, z );
SetPlayerPos( playerid, x, y, z );
SetPlayerFacingAngle( playerid, a );
SetPlayerInterior( playerid, 0 );
SetPlayerVirtualWorld( playerid, 0 );
}
currentInt[playerid] = -1;
return 1;
}
they key Y is not supported by default, but u can add a plugin that detects the key (there is one, i forgot the name tho)
|
they key Y is not supported by default, but u can add a plugin that detects the key (there is one, i forgot the name tho)
|
I have used that a while ago https://sampforum.blast.hk/showthread.php?tid=268671
its not pefect for your purpose but u can try |
#define PRESSED(%0) \ (((newkeys & (%0)) == (%0)) && ((oldkeys & (%0)) != (%0))) public OnPlayerKeyStateChange(playerid, newkeys, oldkeys) { if(PRESSED(KEY_YES)) { if(currentInt[playerid] > -1 && GetPlayerInterior(playerid) == GetPropertyInteriorId(currentInt[playerid])) { new id = currentInt[playerid]; new Float:x, Float:y, Float:z, Float:a; // make sure they're near the exit before allowing them to exit. GetPropertyExit(id, x, y, z); if(IsPlayerInRangeOfPoint(playerid, 4.5, x, y, z)) { a = GetPropertyEntrance(id, x, y, z); SetPlayerInterior(playerid, 0); SetPlayerPos(playerid, x, y, z); SetPlayerFacingAngle(playerid, a); SetPlayerVirtualWorld(playerid, 0); currentInt[playerid] = -1; } else { SendClientMessage(playerid, 0xDDAA55FF, "* You must be near the property exit to exit"); } } else if(lastPickup[playerid] != -1 || properties[lastPickup[playerid]][eType] > 0) { new id = propPickups[lastPickup[playerid]]; new Float:x, Float:y, Float:z; GetPropertyEntrance(id, x, y, z); if(IsPlayerInRangeOfPoint(playerid, 3.0, x, y, z)) { PutPlayerInProperty(playerid, id); SendClientMessage(playerid, 0x55AADDFF, "* You have entered a property.. Press ~k~~CONVERSATION_YES~ near exit to leave"); } } } return 1; }