CMD:entrar(playerid)
{
if(IsPlayerInRangeOfPoint(playerid, 1.0, 1172.5526, -1323.2614, 15.4028))
{
SetPlayerInterior(playerid, 1);
SetPlayerPos(playerid, 1177.3695, -1340.4095, 9280.5693);
GameTextForPlayer(playerid, "~r~Hospital", 5000, 1);
SetPlayerFacingAngle(playerid, 90);
SetCameraBehindPlayer(playerid);
}
else SendClientMessage(playerid, 0xA9C4E4AA, "{FF0000}(ERRO){A9C4E4}: Vocк nгo estб em nenhuma porta.");
return 1;
}
CMD:sair(playerid)
{
if(IsPlayerInRangeOfPoint(playerid, 1.0, 1177.3695, -1340.4095, 9280.5693))
{
SetPlayerInterior(playerid, 0);
SetPlayerPos(playerid, 1172.5526, -1323.2614, 15.4028);
GameTextForPlayer(playerid, "~w~Los Santos", 5000, 1);
SetPlayerFacingAngle(playerid, 270);
SetCameraBehindPlayer(playerid);
}
else SendClientMessage(playerid, 0xA9C4E4AA, "{FF0000}(ERRO){A9C4E4}: Vocк nгo estб em nenhuma porta.");
return 1;
}
new Hospital[2];
public OnGameModeInit()
{
Hospital[0] = CreatePickup(1242, 2, 1503.3359, 1432.3585, 10.1191, -1); // Aqui vocк coloca as coordenadas para entrar
Hospital[1] = CreatePickup(1242, 2, 1503.3359, 1432.3585, 10.1191, -1); // Aqui vocк coloca as coordenadas de sair
return 1;
}
public OnPlayerPickUpPickup(playerid, pickupid)
{
if(pickupid == Hospital[0]) // Entrar
{
SetPlayerInterior(playerid, 1);
SetPlayerPos(playerid, 1177.3695, -1340.4095, 9280.5693);
}
else if(pickupid == Hospital[1]) // Sair
{
SetPlayerInterior(playerid, 0);
SetPlayerPos(playerid, 1172.5526, -1323.2614, 15.4028);
}
return 1;
}
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if(newskeys & KEY_SECONDARY_ATTACK)
{
if(IsPlayerInRangeOfPoint(playerid, 1.0, 1172.5526, -1323.2614, 15.4028))
{
return cmd_entrar(playerid);
}
if(IsPlayerInRangeOfPoint(playerid, 1.0, 1177.3695, -1340.4095, 9280.5693))
{
return cmd_sair(playerid);
}
}
return 1;
}
OnPlayerPickUpPickup
Pickups IDS PHP код:
|
Para colocar a tecla "F" ou a "Enter" para entrar ou sair do hospital basta usar a public OnPlayerKeyStateChange , da seguinte maneira.
PHP код:
|