22.01.2016, 13:35
PHP код:
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;
}