new Navio[20];
new DirigindoNavio[MAX_PLAYERS];
new PortaDaCabine;
Navio[1] = CreateObject(10771,885.19287109,-2979.91235352,3.60642958,0.00000000,0.00000000,0.00000000); //object(carrier_hull_sfse) (1) navio
Navio[2] = CreateObject(11145,819.40930176,-2980.10034180,2.65397930,0.00000000,0.00000000,0.00000000); //object(carrier_lowdeck_sfs) (1) navio
Navio[3] = CreateObject(10770,888.35449219,-2987.49316406,36.78397369,0.00000000,0.00000000,0.00000000); //object(carrier_bridge_sfse) (1) navio
Navio[4] = CreateObject(11146,876.20745850,-2979.27954102,10.40734959,0.00000000,0.00000000,0.00000000); //object(carrier_hangar_sfs) (1) navio
Navio[5] = CreateObject(11237,887.84484863,-2987.48022461,36.67521667,0.00000000,0.00000000,0.00000000); //object(carrier_bits_sfse) (1) navio
Navio[6] = CreateObject(3115,786.14044189,-2979.84643555,8.08432961,0.00000000,0.00000000,180.64996338); //object(carrier_lift1_sfse) (1)pode subir navio
Navio[7] = CreateObject(3114,828.43194580,-2964.96801758,7.81825066,0.00000000,0.00000000,0.00000000); //object(carrier_lift2_sfse) (1) pode subir tambem navio
Navio[8] = CreateObject(2634,895.07348633,-2982.04980469,16.93971634,0.00000000,0.00000000,0.00000000); //object(ab_vaultdoor) (1) navio
Navio[9] = CreateObject(2634,897.66278076,-2980.06323242,10.01470757,0.00000000,0.00000000,0.00000000); //object(ab_vaultdoor) (2) navio
Navio[10] = CreateObject(2634,902.15283203,-2983.20605469,9.73971176,0.00000000,180.56996155,269.68997192); //object(ab_vaultdoor) (3) navio
Navio[11] = CreateObject(3884,909.93994141,-2987.72216797,26.49646378,0.00000000,0.00000000,270.67504883); //object(samsite_sfxrf) (1) navio
Navio[12] = CreateObject(3790,910.59423828,-2988.38525391,29.14423943,0.00000000,151.44006348,0.00000000); //object(missile_01_sfxr) (1) missel navio
Navio[13] = CreateObject(3790,910.89074707,-2988.37744141,28.71923828,0.00000000,151.43554688,0.00000000); //object(missile_01_sfxr) (3) missel navio
Navio[14] = CreateObject(967,910.74450684,-2983.59521484,18.35428619,0.00000000,0.00000000,0.00000000); //object(bar_gatebox01) (1) cabine navio
Navio[15] = CreateObject(1473,903.86267090,-2981.02929688,15.63841248,0.00000000,0.00000000,272.65997314); //object(dyn_porch_1b) (1) navio
Navio[16] = CreateObject(1473,905.61047363,-2980.94311523,16.48841095,0.00000000,0.00000000,272.65869141); //object(dyn_porch_1b) (2) navio
Navio[17] = CreateObject(1473,907.32965088,-2980.84570312,17.28841019,0.00000000,0.00000000,272.65869141); //object(dyn_porch_1b) (3) navio
Navio[18] = CreateObject(1473,909.00427246,-2980.82495117,18.03841782,0.00000000,0.00000000,272.65869141); //object(dyn_porch_1b) (4)navio
Navio[19] = CreateObject(1473,910.45617676,-2981.24072266,18.31341362,336.18005371,0.00000000,272.65869141); //object(dyn_porch_1b) (6) navio
if (strcmp("/entrarnavio", cmdtext, true, 10) == 0)
{
if(DirigindoNavio[playerid] == 0) {
if(IsPlayerInRangeOfPoint(playerid, 3.0, 910.74450684,-2983.59521484,18.35428619)) {
SendClientMessage(playerid, AZUL, "Vocк estб dirigindo o navio !!!");
//new PlayerName[MAX_PLAYER_NAME];
GetPlayerName(playerid, PlayerName, sizeof(PlayerName));
new string[60];
format(string, sizeof(string), "%s estб dirigindo o navio", PlayerName);
print(string);
TogglePlayerControllable(playerid, false);
DirigindoNavio[playerid] = 1;
PortaDaCabine = CreateObject(991,908.16186523,-2982.80712891,19.41952896,0.00000000,0.00000000,0.00000000);//object(bar_barriergate1) (1) criar quando o player esta dirigindo navio
}
else
{
SendClientMessage(playerid, VERMELHO, "Vocк nгo estб na cabine do navio");
}
}
else
{
SendClientMessage(playerid, VERMELHO, "Vocк jб estб dirigindo o navio");
}
return 1;
}
if (strcmp("/sairnavio", cmdtext, true, 10) == 0)
{
if(DirigindoNavio[playerid] == 0)
{
SendClientMessage(playerid, VERMELHO, "Vocк nгo estб pilotando o navio");
}
else if(DirigindoNavio[playerid] == 1)
{
DestroyObject(PortaDaCabine);
DirigindoNavio[playerid] = 0;
TogglePlayerControllable(playerid, true);
}
return 1;
}
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
new Float:X;
new Float:Y;
new Float:Z;
if((newkeys == KEY_WALK) || (newkeys == KEY_UP) && (DirigindoNavio[playerid] = 1))
{
MoveObject(Navio[19], X+2, Y, Z, 8.0);
return 1;
}
if(((newkeys) == KEY_WALK) || (newkeys == KEY_UP) && (newkeys == KEY_RIGHT) && (DirigindoNavio[playerid] = 1))
{
MoveObject(Navio[19], X+2, Y+2, Z, 8.0);
return 1;
}
if(((newkeys) == KEY_DOWN) || (newkeys == KEY_DOWN) && (newkeys == KEY_LEFT) && (DirigindoNavio[playerid] = 1))
{
MoveObject(Navio[19], X-2, Y-2, Z, 5.0);
return 1;
}
if(((newkeys) == KEY_DOWN) || (newkeys == KEY_DOWN) && (newkeys == KEY_RIGHT) && (DirigindoNavio[playerid] = 1))
{
MoveObject(Navio[19], X-2, Y+2, Z, 5.0);
return 1;
}
return 1;
}
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
new Float:X;
new Float:Y;
new Float:Z;
GetObjectPos(Navio[19], X, Y, Z);
if((newkeys == KEY_WALK) || (newkeys == KEY_UP) && (DirigindoNavio[playerid] = 1))
{
MoveObject(Navio[19], X+2, Y, Z, 8.0);
return 1;
}
if(((newkeys) == KEY_WALK) || (newkeys == KEY_UP) && (newkeys == KEY_RIGHT) && (DirigindoNavio[playerid] = 1))
{
MoveObject(Navio[19], X+2, Y+2, Z, 8.0);
return 1;
}
if(((newkeys) == KEY_DOWN) || (newkeys == KEY_DOWN) && (newkeys == KEY_LEFT) && (DirigindoNavio[playerid] = 1))
{
MoveObject(Navio[19], X-2, Y-2, Z, 5.0);
return 1;
}
if(((newkeys) == KEY_DOWN) || (newkeys == KEY_DOWN) && (newkeys == KEY_RIGHT) && (DirigindoNavio[playerid] = 1))
{
MoveObject(Navio[19], X-2, Y+2, Z, 5.0);
return 1;
}
return 1;
}
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
new Float:X;
new Float:Y;
new Float:Z;
GetPlayerPos(playerid, X, Y, Z);
if((newkeys == KEY_WALK) || (newkeys == KEY_UP) && (DirigindoNavio[playerid] = 1))
{
MoveObject(Navio[19], X+2, Y, Z, 8.0);
return 1;
}
if(((newkeys) == KEY_WALK) || (newkeys == KEY_UP) && (newkeys == KEY_RIGHT) && (DirigindoNavio[playerid] = 1))
{
MoveObject(Navio[19], X+2, Y+2, Z, 8.0);
return 1;
}
if(((newkeys) == KEY_DOWN) || (newkeys == KEY_DOWN) && (newkeys == KEY_LEFT) && (DirigindoNavio[playerid] = 1))
{
MoveObject(Navio[19], X-2, Y-2, Z, 5.0);
return 1;
}
if(((newkeys) == KEY_DOWN) || (newkeys == KEY_DOWN) && (newkeys == KEY_RIGHT) && (DirigindoNavio[playerid] = 1))
{
MoveObject(Navio[19], X-2, Y+2, Z, 5.0);
return 1;
}
return 1;
}
print("Funcionou");
Coloca assim em algum deles:
pawn Код:
|