16.11.2017, 18:34
Quote:
Hmmmm, vou procurar por alguns tutoriais, no mais... Obrigado.
|
PHP код:
#include a_samp
#define DOOR_LIMIT 10
enum e_DOOR_DATA
{
Float:DOOR_ENTRY[3],
Float:DOOR_EXIT[3],
DOOR_INTERIOR
}
new Door[DOOR_LIMIT][e_DOOR_DATA];
new gDoorIndex;
public OnGameModeInit()
{
// entrada_x, entrada_y, entrada_z, saida_x, saida_y, saida_z, interior
// db de ls
Door_Create(1555.1127, -1675.5417, 16.1953, 246.783996,63.900199,1003.640625, 6);
return true;
}
stock Door_Create(Float:entry_x, Float:entry_y, Float:entry_z, Float:exit_x, Float:exit_y, Float:exit_z, interior)
{
if(DOOR_LIMIT <= gDoorIndex)
return -1;
Door[gDoorIndex][DOOR_ENTRY][0] = entry_x;
Door[gDoorIndex][DOOR_ENTRY][1] = entry_y;
Door[gDoorIndex][DOOR_ENTRY][2] = entry_z;
Door[gDoorIndex][DOOR_EXIT][0] = exit_x;
Door[gDoorIndex][DOOR_EXIT][1] = exit_y;
Door[gDoorIndex][DOOR_EXIT][2] = exit_z;
Door[gDoorIndex][DOOR_INTERIOR] = interior;
return (gDoorIndex++);
}
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if(newkeys & 16)
{
for(new i = 0; i < gDoorIndex; i++)
{
if(IsPlayerInRangeOfPoint(playerid, 1.0, Door[i][DOOR_ENTRY][0], Door[i][DOOR_ENTRY][1], Door[i][DOOR_ENTRY][2]))
{
SetPlayerPos(playerid, Door[i][DOOR_EXIT][0], Door[i][DOOR_EXIT][1], Door[i][DOOR_EXIT][2]);
SetPlayerInterior(playerid, Door[i][DOOR_INTERIOR]);
SetPlayerVirtualWorld(playerid, i);
break;
}
}
for(new i = 0; i < gDoorIndex; i++)
{
if(IsPlayerInRangeOfPoint(playerid, 1.0, Door[i][DOOR_EXIT][0], Door[i][DOOR_EXIT][1], Door[i][DOOR_EXIT][2]))
{
if(GetPlayerVirtualWorld(playerid) != i)
continue;
SetPlayerPos(playerid, Door[i][DOOR_ENTRY][0], Door[i][DOOR_ENTRY][1], Door[i][DOOR_ENTRY][2]);
SetPlayerInterior(playerid, 0);
SetPlayerVirtualWorld(playerid, 0);
break;
}
}
}
return true;
}
(nгo testei in-game, nem compilei)