#include <a_samp>
#include <YSI\y_hooks>
new bool:Entrada[MAX_PLAYERS][10];
hook OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if(IsPlayerInRangeOfPoint(playerid, 1.0, 1555.1055, -1675.6426, 16.1953)) // Delegacia los santos
{
Entrada[playerid][0] = true;
SetPlayerPos(playerid, 246.7995,65.9249,1003.6406);
SetPlayerInterior(playerid,6);
SendClientMessage(playerid, amarelo, "| INFO | Vocк entrou na delegacia de Los Santos central");
}
else if(IsPlayerInRangeOfPoint(playerid, 1.0, 627.9832,-571.7913,17.4442)) // Delegacia de Dillimore
{
Entrada[playerid][1] = true;
SetPlayerPos(playerid, 246.7995,65.9249,1003.6406);
SetPlayerInterior(playerid,6);
SendClientMessage(playerid, amarelo, "| INFO | Vocк entrou na delegacia de Los Santos Dillimore");
}
else if(IsPlayerInRangeOfPoint(playerid, 1.0,-2162.4524,-2386.0876,30.6250))// Delegacia Angel Pine
{
Entrada[playerid][2] = true;
SetPlayerPos(playerid, 246.7995,65.9249,1003.6406);
SetPlayerInterior(playerid,6);
SendClientMessage(playerid, amarelo, "| INFO | Vocк entrou na delegacia de Los Santos Angel Pine");
}
else if(IsPlayerInRangeOfPoint(playerid, 1.0, 2290.1243,2430.7190,10.8203)) // Delegacia las venturas
{
Entrada[playerid][3] = true;
SetPlayerPos(playerid, 246.4518,64.6877,1003.6406);
SetPlayerInterior(playerid, 6);
SendClientMessage(playerid, amarelo, "| INFO | Vocк entrou na delegacia de Las Venturas central");
}
else if(IsPlayerInRangeOfPoint(playerid, 1.0, -217.2057,979.1824,19.5006)) // Delegacia Fort Carson
{
Entrada[playerid][4] = true;
SetPlayerPos(playerid, 246.4518,64.6877,1003.6406);
SetPlayerInterior(playerid, 6);
SendClientMessage(playerid, amarelo, "| INFO | Vocк entrou na delegacia de Las Venturas Fort Carson");
}
else if(IsPlayerInRangeOfPoint(playerid, 1.0, -1389.9792,2637.6277,55.9844)) // Delegacia las Venturas El Quebrados
{
Entrada[playerid][5] = true;
SetPlayerPos(playerid, 246.4518,64.6877,1003.6406);
SetPlayerInterior(playerid, 6);
SendClientMessage(playerid, amarelo, "| INFO | Vocк entrou na delegacia de Las Venturas El Quebrados");
}
else if(IsPlayerInRangeOfPoint(playerid, 1.0, -1605.4912, 711.4242, 13.8672)) // Delegacia SF
{
Entrada[playerid][6] = true;
SetPlayerPos(playerid, 246.4518,64.6877,1003.6406);
SetPlayerInterior(playerid, 6);
SendClientMessage(playerid, amarelo, "| INFO | Vocк entrou na delegacia de San Fierro Downtown");
}
else if(IsPlayerInRangeOfPoint(playerid, 1.0, 593.6790,-1250.0275,18.2274)) // Banco Los Santos
{
Entrada[playerid][7] = true;
SetPlayerPos(playerid, 2308.1907,-15.6250,26.7496);
SetPlayerInterior(playerid, 0);
SendClientMessage(playerid, amarelo, "| INFO | Vocк entrou na Agкncia bancбria Los Santos ");
}
// saidas
if(IsPlayerInRangeOfPoint(playerid, 1.0, 246.8718, 62.3202, 1003.6406)) // Delegacia
{
if(Entrada[playerid][0] == true)
{
SetPlayerPos(playerid, 1551.7937,-1675.5795,16.0063); // Los Santos central
SetPlayerInterior(playerid, 0);
Entrada[playerid][0] = false;
SendClientMessage(playerid, amarelo, "| INFO | Vocк atualmente estб em Los Santos Pershing Square");
}
if(Entrada[playerid][1] == true)
{
SetPlayerPos(playerid, 631.1216,-571.6235,16.3359); // Los Santos Dillimore
SetPlayerInterior(playerid, 0);
Entrada[playerid][1] = false;
SendClientMessage(playerid, amarelo, "| INFO | Vocк atualmente estб em Los Santos Dillimore");
}
if(Entrada[playerid][2] == true)
{
SetPlayerPos(playerid, -2164.3137,-2388.2537,30.6250); // Angel Pine
SetPlayerInterior(playerid, 0);
Entrada[playerid][2] = false;
SendClientMessage(playerid, amarelo, "| INFO | Vocк atualmente estб em Los Santos Angel Pine");
}
if(Entrada[playerid][3] == true)
{
SetPlayerPos(playerid, 2289.9453,2427.4331,10.8203); // Las Venturas
SetPlayerInterior(playerid, 0);
Entrada[playerid][3] = false;
SendClientMessage(playerid, amarelo, "| INFO | Vocк atualmente estб em Las Venturas Roca Escalante");
}
if(Entrada[playerid][4] == true)
{
SetPlayerPos(playerid, -214.2173,980.6703,19.3386); // Fort Carson
SetPlayerInterior(playerid, 0);
Entrada[playerid][4] = false;
SendClientMessage(playerid, amarelo, "| INFO | Vocк atualmente estб em Las Venturas Fort Carson");
}
if(Entrada[playerid][5] == true)
{
SetPlayerPos(playerid, -1391.2225,2636.0962,55.9844); // El Quebrados
SetPlayerInterior(playerid, 0);
Entrada[playerid][5] = false;
SendClientMessage(playerid, amarelo, "| INFO | Vocк atualmente estб em Las Venturas El Quebrados");
}
if(Entrada[playerid][6] == true)
{
SetPlayerPos(playerid, -1605.8491,715.1511,12.4780); // El Quebrados
SetPlayerInterior(playerid, 0);
Entrada[playerid][6] = false;
SendClientMessage(playerid, amarelo, "| INFO | Vocк atualmente estб em San Fierro Downtown");
}
else if(IsPlayerInRangeOfPoint(playerid, 1.0, 2315.5479,0.3543,26.7422)) // Banco
{
if(Entrada[playerid][7] == true)
{
SetPlayerPos(playerid, 592.7502,-1247.3318,18.1243); // Los Santos
SetPlayerInterior(playerid, 0);
Entrada[playerid][7] = false;
SendClientMessage(playerid, amarelo, "| INFO | Vocк atualmente estб em Los Santos Pershing Square");
}
if(IsPlayerInRangeOfPoint(playerid, 1.0, 246.8718, 62.3202, 1003.6406)) // Delegacia
{
if(Entrada[playerid][0] == true)
{
SetPlayerPos(playerid, 1551.7937,-1675.5795,16.0063); // Los Santos central
SetPlayerInterior(playerid, 0);
Entrada[playerid][0] = false;
SendClientMessage(playerid, amarelo, "| INFO | Vocк atualmente estб em Los Santos Pershing Square");
}
else if(Entrada[playerid][1] == true)
{
SetPlayerPos(playerid, 631.1216,-571.6235,16.3359); // Los Santos Dillimore
SetPlayerInterior(playerid, 0);
Entrada[playerid][1] = false;
SendClientMessage(playerid, amarelo, "| INFO | Vocк atualmente estб em Los Santos Dillimore");
}
else if(Entrada[playerid][2] == true)
{
SetPlayerPos(playerid, -2164.3137,-2388.2537,30.6250); // Angel Pine
SetPlayerInterior(playerid, 0);
Entrada[playerid][2] = false;
SendClientMessage(playerid, amarelo, "| INFO | Vocк atualmente estб em Los Santos Angel Pine");
}
else if(Entrada[playerid][3] == true)
{
SetPlayerPos(playerid, 2289.9453,2427.4331,10.8203); // Las Venturas
SetPlayerInterior(playerid, 0);
Entrada[playerid][3] = false;
SendClientMessage(playerid, amarelo, "| INFO | Vocк atualmente estб em Las Venturas Roca Escalante");
}
else if(Entrada[playerid][4] == true)
{
SetPlayerPos(playerid, -214.2173,980.6703,19.3386); // Fort Carson
SetPlayerInterior(playerid, 0);
Entrada[playerid][4] = false;
SendClientMessage(playerid, amarelo, "| INFO | Vocк atualmente estб em Las Venturas Fort Carson");
}
else if(Entrada[playerid][5] == true)
{
SetPlayerPos(playerid, -1391.2225,2636.0962,55.9844); // El Quebrados
SetPlayerInterior(playerid, 0);
Entrada[playerid][5] = false;
SendClientMessage(playerid, amarelo, "| INFO | Vocк atualmente estб em Las Venturas El Quebrados");
}
else if(Entrada[playerid][6] == true)
{
SetPlayerPos(playerid, -1605.8491,715.1511,12.4780); // El Quebrados
SetPlayerInterior(playerid, 0);
Entrada[playerid][6] = false;
SendClientMessage(playerid, amarelo, "| INFO | Vocк atualmente estб em San Fierro Downtown");
}
}
else if(IsPlayerInRangeOfPoint(playerid, 1.0, 2315.5479,0.3543,26.7422)) // Banco
{
if(Entrada[playerid][7] == true)
{
SetPlayerPos(playerid, 592.7502,-1247.3318,18.1243); // Los Santos
SetPlayerInterior(playerid, 0);
Entrada[playerid][7] = false;
SendClientMessage(playerid, amarelo, "| INFO | Vocк atualmente estб em Los Santos Pershing Square");
}
Deste modo de pensar da para facilitar a vida em varios pontos .
+1 Ex: PHP Code:
|
Tente assim:
PHP Code:
|
Ola , vou dar uma sugestгo .
Acaba ficando mais limpo no meu ponto de vista , vlw jovem . |
#include <a_samp>
enum iF{
iNome[100],
Float:eX,
Float:eY,
Float:eZ,
Float:sX,
Float:sY,
Float:sZ,
Interior
}
new EntradaInfo[MAX_ENTRADAS][iF] = {
{"Delegacia", 1555.1055, -1675.6426, 16.1953, 246.7995,65.9249,1003.6406, 6},
{"Delegacia Dillimore", 627.9832,-571.7913,17.4442, 246.7995,65.9249,1003.6406, 6}
};
public OnGameModeInit()
{
new StringS[300];
for(new inf = 0; inf< MAX_ENTRADAS; inf++)
{
format(StringS, sizeof StringS, "{FFFFFF}[{6495ED}%s{FFFFFF}]\nAperte 'F' para entrar", EntradaInfo[inf][iNome]);
Create3DTextLabel(StringS, -1, EntradaInfo[inf][eX],EntradaInfo[inf][eY],EntradaInfo[inf][eZ], 15.0, 0, 0);
CreatePickup(1239, 1, EntradaInfo[inf][eX],EntradaInfo[inf][eY],EntradaInfo[inf][eZ],-1);
CreatePickup(1239, 1, EntradaInfo[inf][sX],EntradaInfo[inf][sY],EntradaInfo[inf][sZ],-1);
format(StringS, sizeof StringS, "{FFFFFF}[{6495ED}%s{FFFFFF}]\nAperte 'F' para saida", EntradaInfo[inf][iNome]);
Create3DTextLabel(StringS, -1, EntradaInfo[inf][sX],EntradaInfo[inf][sY],EntradaInfo[inf][sZ], 15.0, 0, 0);
}
return true;
}
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if(newkeys == KEY_SECONDARY_ATTACK)
{
for(new inf = 0; inf< MAX_ENTRADAS; inf++)
{
if(IsPlayerInRangeOfPoint(playerid, 2.0, EntradaInfo[inf][eX],EntradaInfo[inf][eY],EntradaInfo[inf][eZ]))
return SetPlayerPos(playerid, EntradaInfo[inf][sX],EntradaInfo[inf][sY],EntradaInfo[inf][sZ]), SetPlayerInterior(playerid, EntradaInfo[inf][Interior]);
if(IsPlayerInRangeOfPoint(playerid, 2.0, EntradaInfo[inf][sX],EntradaInfo[inf][sY],EntradaInfo[inf][sZ]))
return SetPlayerPos(playerid, EntradaInfo[inf][eX],EntradaInfo[inf][eY],EntradaInfo[inf][eZ]), SetPlayerInterior(playerid, EntradaInfo[inf][Interior]);
}
}
return true;
}
Bom testei esse sistema, funcionou certinho, e й bem mais rapido e facil de se fazer, porem ele da conflito, entra na delegacia de dillimore e sai na delegacia de los santos, fora que nгo consegui colocar o interior 0 para quando o player sai, a desvantagem eh q nisso tambйm nгo da pra colocar mensagem quando ele entra e nem quando ele sai pelo que percebi
|