01.04.2011, 00:08
how to make a icon infront of a door then have a command say enter then setplayerpos into the building
new pdpickup1; // PD Main entrance outside
new pdpickup2; // PD Main entrance inside
pdpickup1 = CreatePickup(1239, 1, 1555.4861, -1675.3259, 16.1953, -1);
pdpickup2 = CreatePickup(1239, 1, 246.7955, 62.3329, 1003.6406, -1);
Create3DTextLabel( "Use /enter to get inside\nLos Santos Police Department.", -1, 1555.4861, -1675.3259, 16.1953, 10.0, 0, 1 );
Create3DTextLabel( "Use /exit to get outside\nLos Santos Police Department.", -1, 246.7955, 62.3329, 1003.6406, 10.0, 0, 1 );
public OnPlayerPickUpPickup(playerid, pickupid)
{
if( pickupid == pdpickup1 ) GameTextForPlayer( playerid, "~w~Use ~r~/enter ~w~to go inside the ~n~~b~Police Department~w~.", 2000, 3 ); // PD Outside
if( pickupid == pdpickup2 ) GameTextForPlayer( playerid, "~w~Use ~r~/exit ~w~to get outside ~n~~b~Police Department~w~.", 2000, 3 ); // PD Inside
return 1;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp("/enter", cmdtext, true, 6) == 0)
{
if(IsPlayerInRangeOfPoint( playerid, 1.5, 1555.4861, -1675.3259, 16.1953 ) )
{
if(!IsPlayerInAnyVehicle( playerid ) )
{
SetPlayerInterior( playerid, 6 );
SetPlayerPos( playerid, 246.7840, 63.9002, 1003.6406 );
return 1;
}
else return SendClientMessage( playerid, -1, "You must get out of the vehicle first." );
}
}
if (strcmp("/exit", cmdtext, true, 5) == 0)
{
if(IsPlayerInRangeOfPoint( playerid, 1.5, 246.7955, 62.3329, 1003.6406 ) )
{
if(!IsPlayerInAnyVehicle( playerid ) )
{
SetPlayerInterior(playerid, 0);
SetPlayerVirtualWorld(playerid, 0);
SetPlayerPos(playerid, 1553.2699, -1675.4012, 16.1953);
return 1;
}
else return SendClientMessage( playerid, -1, "You must get out of the vehicle first." );
}
}
return 0;
}
if (strcmp("/enter", cmdtext, true, 6) == 0)
{
if(IsPlayerInRangeOfPoint( playerid, 1.5, 1555.4861, -1675.3259, 16.1953 ) )
{
if(!IsPlayerInAnyVehicle( playerid ) )
{
SetPlayerInterior( playerid, 6 );
SetPlayerPos( playerid, 246.7840, 63.9002, 1003.6406 );
return 1;
}
else return SendClientMessage( playerid, -1, "You must get out of the vehicle first." );
}
}
if (strcmp("/exit", cmdtext, true, 5) == 0)
{
if(IsPlayerInRangeOfPoint( playerid, 1.5, 246.7955, 62.3329, 1003.6406 ) )
{
if(!IsPlayerInAnyVehicle( playerid ) )
{
SetPlayerInterior(playerid, 0);
SetPlayerVirtualWorld(playerid, 0);
SetPlayerPos(playerid, 1553.2699, -1675.4012, 16.1953);
return 1;
}
else return SendClientMessage( playerid, -1, "You must get out of the vehicle first." );
}
}