[Ajuda] veiculo profissao
#1

como faзo para ver se o player que esta entrando no veiculo de uma profissao й dessa profissao?

eu fiz isso:
PHP Code:
if (GetPlayerVehicleID(playerid) == caminhao[0])
    {
        if(
GetPlayerState(playerid)==PLAYER_STATE_DRIVER)
            {
            if(
Player[playerid][Profissao]!=1)
                {
                
ClearAnimations playerid ) ;
                 
RemovePlayerFromVehicle(playerid);
                 
SendClientMessage(playerid,COR_VERMELHO,"Vocк nгo й um Caminhoneiro");
                }
            }
    } 
PHP Code:
new caminhao[23];
//////////vaiculos
public OnFilterScriptInit()
{
    
caminhao[0] = CreateVehicle(4032778.1956, -2376.827114.105190.000011100);
    
caminhao[1] = CreateVehicle(4032759.2173, -2375.741514.1051, -90.180011100);
    
caminhao[2] = CreateVehicle(4032759.2842, -2372.063014.1051, -90.000011100);
    
caminhao[3] = CreateVehicle(4032759.4177, -2368.599114.1051, -90.060011100);
    
caminhao[4] = CreateVehicle(4032759.2805, -2364.922614.1051, -90.060011100);
    
caminhao[5] = CreateVehicle(4032759.3254, -2361.092814.1051, -90.000011100);
    
caminhao[6] = CreateVehicle(4032759.5269, -2357.420714.1051, -90.000011100);
    
caminhao[7] = CreateVehicle(4032759.5083, -2353.450414.1051, -90.240011100);
    
caminhao[8] = CreateVehicle(4032759.6807, -2349.339614.1051, -90.000011100);
    
caminhao[9] = CreateVehicle(4032759.9221, -2345.439514.1051, -90.000011100);
    
caminhao[10] = CreateVehicle(4032759.8955, -2341.316714.1051, -90.060011100);
    
caminhao[11] = CreateVehicle(4032760.0535, -2337.039614.1051, -90.000011100);
    
caminhao[12] = CreateVehicle(4032759.3333, -2379.268314.1051, -90.000011100);
    
caminhao[13] = CreateVehicle(4032778.0913, -2381.075014.105190.000011100);
    
caminhao[14] = CreateVehicle(4032777.8953, -2387.481214.105190.000011100);
    
caminhao[15] = CreateVehicle(4032777.9941, -2384.305214.105190.000011100);
    
caminhao[16] = CreateVehicle(4032777.5559, -2395.318414.105190.000011100);
    
caminhao[17] = CreateVehicle(4032777.4539, -2398.809314.105190.000011100);
    
caminhao[18] = CreateVehicle(4032777.3525, -2402.245614.105190.000011100);
    
caminhao[19] = CreateVehicle(4032777.6592, -2391.816714.105190.000011100);
    
caminhao[20] = CreateVehicle(4032775.9270, -2418.251214.105190.000011100);
    
caminhao[21] = CreateVehicle(4032774.7324, -2455.206514.105190.000011100);
    
caminhao[22] = CreateVehicle(4032774.7046, -2493.558114.105190.000011100); 
da esses erros
Code:
E:\sampser\gamemodes\rpgm.pwn(500) : error 017: undefined symbol "caminhao"
E:\sampser\gamemodes\rpgm.pwn(500) : warning 215: expression has no effect
E:\sampser\gamemodes\rpgm.pwn(500) : error 001: expected token: ";", but found "]"
E:\sampser\gamemodes\rpgm.pwn(500) : error 029: invalid expression, assumed zero
E:\sampser\gamemodes\rpgm.pwn(500) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


4 Errors.
desculpa por estar postando muitos threads no forum й que й a parte que mais tenho dificuldade
Reply
#2

Quote:
Originally Posted by RayanSanty
View Post
No topo da sua gamemode coloque:

PHP Code:
new caminhao[24]; 
eu coloquei jб
Reply
#3

Tente usar isto

PHP Code:
forward IsACaminhao(playerid);
public 
IsACaminhao(carid)
{
    if((
carid >= caminhao[0]) && (carid <= caminhao[sizeof(caminhao)-1]))
    {
        return 
true;
    }
    return 
0;

Reply
#4

pjfPedro uma duvida ta faltando uma chave nessa parte do cуdigo '}'
Code:
new caminhao[23];

//////////vaiculos
public OnFilterScriptInit()
{
    caminhao[0] = CreateVehicle(403, 2778.1956, -2376.8271, 14.1051, 90.0000, 1, 1, 100);
    caminhao[1] = CreateVehicle(403, 2759.2173, -2375.7415, 14.1051, -90.1800, 1, 1, 100);
    caminhao[2] = CreateVehicle(403, 2759.2842, -2372.0630, 14.1051, -90.0000, 1, 1, 100);
    caminhao[3] = CreateVehicle(403, 2759.4177, -2368.5991, 14.1051, -90.0600, 1, 1, 100);
    caminhao[4] = CreateVehicle(403, 2759.2805, -2364.9226, 14.1051, -90.0600, 1, 1, 100);
    caminhao[5] = CreateVehicle(403, 2759.3254, -2361.0928, 14.1051, -90.0000, 1, 1, 100);
    caminhao[6] = CreateVehicle(403, 2759.5269, -2357.4207, 14.1051, -90.0000, 1, 1, 100);
    caminhao[7] = CreateVehicle(403, 2759.5083, -2353.4504, 14.1051, -90.2400, 1, 1, 100);
    caminhao[8] = CreateVehicle(403, 2759.6807, -2349.3396, 14.1051, -90.0000, 1, 1, 100);
    caminhao[9] = CreateVehicle(403, 2759.9221, -2345.4395, 14.1051, -90.0000, 1, 1, 100);
    caminhao[10] = CreateVehicle(403, 2759.8955, -2341.3167, 14.1051, -90.0600, 1, 1, 100);
    caminhao[11] = CreateVehicle(403, 2760.0535, -2337.0396, 14.1051, -90.0000, 1, 1, 100);
    caminhao[12] = CreateVehicle(403, 2759.3333, -2379.2683, 14.1051, -90.0000, 1, 1, 100);
    caminhao[13] = CreateVehicle(403, 2778.0913, -2381.0750, 14.1051, 90.0000, 1, 1, 100);
    caminhao[14] = CreateVehicle(403, 2777.8953, -2387.4812, 14.1051, 90.0000, 1, 1, 100);
    caminhao[15] = CreateVehicle(403, 2777.9941, -2384.3052, 14.1051, 90.0000, 1, 1, 100);
    caminhao[16] = CreateVehicle(403, 2777.5559, -2395.3184, 14.1051, 90.0000, 1, 1, 100);
    caminhao[17] = CreateVehicle(403, 2777.4539, -2398.8093, 14.1051, 90.0000, 1, 1, 100);
    caminhao[18] = CreateVehicle(403, 2777.3525, -2402.2456, 14.1051, 90.0000, 1, 1, 100);
    caminhao[19] = CreateVehicle(403, 2777.6592, -2391.8167, 14.1051, 90.0000, 1, 1, 100);
    caminhao[20] = CreateVehicle(403, 2775.9270, -2418.2512, 14.1051, 90.0000, 1, 1, 100);
    caminhao[21] = CreateVehicle(403, 2774.7324, -2455.2065, 14.1051, 90.0000, 1, 1, 100);
    caminhao[22] = CreateVehicle(403, 2774.7046, -2493.5581, 14.1051, 90.0000, 1, 1, 100); 
//aqui
Reply
#5

Quote:
Originally Posted by Hatiro
View Post
pjfPedro uma duvida ta faltando uma chave nessa parte do cуdigo '}'
Code:
new caminhao[23];

//////////vaiculos
public OnFilterScriptInit()
{
    caminhao[0] = CreateVehicle(403, 2778.1956, -2376.8271, 14.1051, 90.0000, 1, 1, 100);
    caminhao[1] = CreateVehicle(403, 2759.2173, -2375.7415, 14.1051, -90.1800, 1, 1, 100);
    caminhao[2] = CreateVehicle(403, 2759.2842, -2372.0630, 14.1051, -90.0000, 1, 1, 100);
    caminhao[3] = CreateVehicle(403, 2759.4177, -2368.5991, 14.1051, -90.0600, 1, 1, 100);
    caminhao[4] = CreateVehicle(403, 2759.2805, -2364.9226, 14.1051, -90.0600, 1, 1, 100);
    caminhao[5] = CreateVehicle(403, 2759.3254, -2361.0928, 14.1051, -90.0000, 1, 1, 100);
    caminhao[6] = CreateVehicle(403, 2759.5269, -2357.4207, 14.1051, -90.0000, 1, 1, 100);
    caminhao[7] = CreateVehicle(403, 2759.5083, -2353.4504, 14.1051, -90.2400, 1, 1, 100);
    caminhao[8] = CreateVehicle(403, 2759.6807, -2349.3396, 14.1051, -90.0000, 1, 1, 100);
    caminhao[9] = CreateVehicle(403, 2759.9221, -2345.4395, 14.1051, -90.0000, 1, 1, 100);
    caminhao[10] = CreateVehicle(403, 2759.8955, -2341.3167, 14.1051, -90.0600, 1, 1, 100);
    caminhao[11] = CreateVehicle(403, 2760.0535, -2337.0396, 14.1051, -90.0000, 1, 1, 100);
    caminhao[12] = CreateVehicle(403, 2759.3333, -2379.2683, 14.1051, -90.0000, 1, 1, 100);
    caminhao[13] = CreateVehicle(403, 2778.0913, -2381.0750, 14.1051, 90.0000, 1, 1, 100);
    caminhao[14] = CreateVehicle(403, 2777.8953, -2387.4812, 14.1051, 90.0000, 1, 1, 100);
    caminhao[15] = CreateVehicle(403, 2777.9941, -2384.3052, 14.1051, 90.0000, 1, 1, 100);
    caminhao[16] = CreateVehicle(403, 2777.5559, -2395.3184, 14.1051, 90.0000, 1, 1, 100);
    caminhao[17] = CreateVehicle(403, 2777.4539, -2398.8093, 14.1051, 90.0000, 1, 1, 100);
    caminhao[18] = CreateVehicle(403, 2777.3525, -2402.2456, 14.1051, 90.0000, 1, 1, 100);
    caminhao[19] = CreateVehicle(403, 2777.6592, -2391.8167, 14.1051, 90.0000, 1, 1, 100);
    caminhao[20] = CreateVehicle(403, 2775.9270, -2418.2512, 14.1051, 90.0000, 1, 1, 100);
    caminhao[21] = CreateVehicle(403, 2774.7324, -2455.2065, 14.1051, 90.0000, 1, 1, 100);
    caminhao[22] = CreateVehicle(403, 2774.7046, -2493.5581, 14.1051, 90.0000, 1, 1, 100); 
//aqui
Acho que nгo, ele nгo deve ter postado o cуdigo completo, senгo os erros seriam outros...
Reply
#6

Quote:
Originally Posted by Hatiro
View Post
pjfPedro uma duvida ta faltando uma chave nessa parte do cуdigo '}'
Code:
new caminhao[23];

//////////vaiculos
public OnFilterScriptInit()
{
    caminhao[0] = CreateVehicle(403, 2778.1956, -2376.8271, 14.1051, 90.0000, 1, 1, 100);
    caminhao[1] = CreateVehicle(403, 2759.2173, -2375.7415, 14.1051, -90.1800, 1, 1, 100);
    caminhao[2] = CreateVehicle(403, 2759.2842, -2372.0630, 14.1051, -90.0000, 1, 1, 100);
    caminhao[3] = CreateVehicle(403, 2759.4177, -2368.5991, 14.1051, -90.0600, 1, 1, 100);
    caminhao[4] = CreateVehicle(403, 2759.2805, -2364.9226, 14.1051, -90.0600, 1, 1, 100);
    caminhao[5] = CreateVehicle(403, 2759.3254, -2361.0928, 14.1051, -90.0000, 1, 1, 100);
    caminhao[6] = CreateVehicle(403, 2759.5269, -2357.4207, 14.1051, -90.0000, 1, 1, 100);
    caminhao[7] = CreateVehicle(403, 2759.5083, -2353.4504, 14.1051, -90.2400, 1, 1, 100);
    caminhao[8] = CreateVehicle(403, 2759.6807, -2349.3396, 14.1051, -90.0000, 1, 1, 100);
    caminhao[9] = CreateVehicle(403, 2759.9221, -2345.4395, 14.1051, -90.0000, 1, 1, 100);
    caminhao[10] = CreateVehicle(403, 2759.8955, -2341.3167, 14.1051, -90.0600, 1, 1, 100);
    caminhao[11] = CreateVehicle(403, 2760.0535, -2337.0396, 14.1051, -90.0000, 1, 1, 100);
    caminhao[12] = CreateVehicle(403, 2759.3333, -2379.2683, 14.1051, -90.0000, 1, 1, 100);
    caminhao[13] = CreateVehicle(403, 2778.0913, -2381.0750, 14.1051, 90.0000, 1, 1, 100);
    caminhao[14] = CreateVehicle(403, 2777.8953, -2387.4812, 14.1051, 90.0000, 1, 1, 100);
    caminhao[15] = CreateVehicle(403, 2777.9941, -2384.3052, 14.1051, 90.0000, 1, 1, 100);
    caminhao[16] = CreateVehicle(403, 2777.5559, -2395.3184, 14.1051, 90.0000, 1, 1, 100);
    caminhao[17] = CreateVehicle(403, 2777.4539, -2398.8093, 14.1051, 90.0000, 1, 1, 100);
    caminhao[18] = CreateVehicle(403, 2777.3525, -2402.2456, 14.1051, 90.0000, 1, 1, 100);
    caminhao[19] = CreateVehicle(403, 2777.6592, -2391.8167, 14.1051, 90.0000, 1, 1, 100);
    caminhao[20] = CreateVehicle(403, 2775.9270, -2418.2512, 14.1051, 90.0000, 1, 1, 100);
    caminhao[21] = CreateVehicle(403, 2774.7324, -2455.2065, 14.1051, 90.0000, 1, 1, 100);
    caminhao[22] = CreateVehicle(403, 2774.7046, -2493.5581, 14.1051, 90.0000, 1, 1, 100); 
//aqui
nгo
й que temmais coisas depois
Reply
#7

Quote:
Originally Posted by RayanSanty
View Post
Tente usar isto

PHP Code:
forward IsACaminhao(playerid);
public 
IsACaminhao(carid)
{
    if((
carid >= caminhao[0]) && (carid <= caminhao[sizeof(caminhao)-1]))
    {
        return 
true;
    }
    return 
0;

nгo entendi й tipo isso?

Code:
stock IsABike(carid)
{
    if(carid==522||carid==521||carid==468||carid==581||carid==461||carid==463||carid==586||carid==523||carid==462)
    {
        return 1;
    }

    return 0;
}
Reply
#8

eu troque do onplayerenterveicle para onplayerstatechange
pawn Code:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
    if(newstate==PLAYER_STATE_DRIVER)
    {
        if (GetPlayerVehicleID(playerid) == caminhao[0])
        {
            if(Player[playerid][Profissao]!=1)
            {
                ClearAnimations ( playerid ) ;
                RemovePlayerFromVehicle(playerid);
                SendClientMessage(playerid,COR_VERMELHO,"Vocк nгo й um Caminhoneiro");
            }
        }

    }

    return 1;
}
Reply
#9

pjfPedro faz assim
Code:
#define MAX_CARROS_ORG 23//definir o nъmero de carros da org
new caminhao[MAX_CARROS_ORG];
Code:
public OnFilterScriptInit()
{
    caminhao[0] = CreateVehicle(403, 2778.1956, -2376.8271, 14.1051, 90.0000, 1, 1, 100);
    caminhao[1] = CreateVehicle(403, 2759.2173, -2375.7415, 14.1051, -90.1800, 1, 1, 100);
    caminhao[2] = CreateVehicle(403, 2759.2842, -2372.0630, 14.1051, -90.0000, 1, 1, 100);
    caminhao[3] = CreateVehicle(403, 2759.4177, -2368.5991, 14.1051, -90.0600, 1, 1, 100);
    caminhao[4] = CreateVehicle(403, 2759.2805, -2364.9226, 14.1051, -90.0600, 1, 1, 100);
    caminhao[5] = CreateVehicle(403, 2759.3254, -2361.0928, 14.1051, -90.0000, 1, 1, 100);
    caminhao[6] = CreateVehicle(403, 2759.5269, -2357.4207, 14.1051, -90.0000, 1, 1, 100);
    caminhao[7] = CreateVehicle(403, 2759.5083, -2353.4504, 14.1051, -90.2400, 1, 1, 100);
    caminhao[8] = CreateVehicle(403, 2759.6807, -2349.3396, 14.1051, -90.0000, 1, 1, 100);
    caminhao[9] = CreateVehicle(403, 2759.9221, -2345.4395, 14.1051, -90.0000, 1, 1, 100);
    caminhao[10] = CreateVehicle(403, 2759.8955, -2341.3167, 14.1051, -90.0600, 1, 1, 100);
    caminhao[11] = CreateVehicle(403, 2760.0535, -2337.0396, 14.1051, -90.0000, 1, 1, 100);
    caminhao[12] = CreateVehicle(403, 2759.3333, -2379.2683, 14.1051, -90.0000, 1, 1, 100);
    caminhao[13] = CreateVehicle(403, 2778.0913, -2381.0750, 14.1051, 90.0000, 1, 1, 100);
    caminhao[14] = CreateVehicle(403, 2777.8953, -2387.4812, 14.1051, 90.0000, 1, 1, 100);
    caminhao[15] = CreateVehicle(403, 2777.9941, -2384.3052, 14.1051, 90.0000, 1, 1, 100);
    caminhao[16] = CreateVehicle(403, 2777.5559, -2395.3184, 14.1051, 90.0000, 1, 1, 100);
    caminhao[17] = CreateVehicle(403, 2777.4539, -2398.8093, 14.1051, 90.0000, 1, 1, 100);
    caminhao[18] = CreateVehicle(403, 2777.3525, -2402.2456, 14.1051, 90.0000, 1, 1, 100);
    caminhao[19] = CreateVehicle(403, 2777.6592, -2391.8167, 14.1051, 90.0000, 1, 1, 100);
    caminhao[20] = CreateVehicle(403, 2775.9270, -2418.2512, 14.1051, 90.0000, 1, 1, 100);
    caminhao[21] = CreateVehicle(403, 2774.7324, -2455.2065, 14.1051, 90.0000, 1, 1, 100);
    caminhao[22] = CreateVehicle(403, 2774.7046, -2493.5581, 14.1051, 90.0000, 1, 1, 100); 
return 1;
}
proximo
Code:
new profissao = 0; // fiz isso para simular o PlayerInfo[playerid][IdDaOrg]
Code:
cmd:darprofissao(playerid){
  ++profissao;
  return 1;
}
cmd:removerprofissao(playerid){
  --profissao;
  return 1;
}
public OnPlayerStateChange(playerid, newstate, oldstate)
{
  for(new c = 0; c <= 23; c++)
    {
        if(IsPlayerInVehicle(playerid, caminhao[c]) && profissao != 1)
        {
            SendClientMessage(playerid, -1, "voce nao e um caminhoneiro");
            RemovePlayerFromVehicle(playerid);
            break;
        }
    }
  return 1;
}
edit: se quiser adicionar mais organizaзгo/profissгo segui o exemplo https://pastebin.com/0e27tER1
creditos: https://sampforum.blast.hk/showthread.php?tid=395339
Reply
#10

Quote:
Originally Posted by Hatiro
View Post
pjfPedro faz assim
Code:
#define MAX_CARROS_ORG 23//definir o nъmero de carros da org
new caminhao[MAX_CARROS_ORG];
Code:
public OnFilterScriptInit()
{
    caminhao[0] = CreateVehicle(403, 2778.1956, -2376.8271, 14.1051, 90.0000, 1, 1, 100);
    caminhao[1] = CreateVehicle(403, 2759.2173, -2375.7415, 14.1051, -90.1800, 1, 1, 100);
    caminhao[2] = CreateVehicle(403, 2759.2842, -2372.0630, 14.1051, -90.0000, 1, 1, 100);
    caminhao[3] = CreateVehicle(403, 2759.4177, -2368.5991, 14.1051, -90.0600, 1, 1, 100);
    caminhao[4] = CreateVehicle(403, 2759.2805, -2364.9226, 14.1051, -90.0600, 1, 1, 100);
    caminhao[5] = CreateVehicle(403, 2759.3254, -2361.0928, 14.1051, -90.0000, 1, 1, 100);
    caminhao[6] = CreateVehicle(403, 2759.5269, -2357.4207, 14.1051, -90.0000, 1, 1, 100);
    caminhao[7] = CreateVehicle(403, 2759.5083, -2353.4504, 14.1051, -90.2400, 1, 1, 100);
    caminhao[8] = CreateVehicle(403, 2759.6807, -2349.3396, 14.1051, -90.0000, 1, 1, 100);
    caminhao[9] = CreateVehicle(403, 2759.9221, -2345.4395, 14.1051, -90.0000, 1, 1, 100);
    caminhao[10] = CreateVehicle(403, 2759.8955, -2341.3167, 14.1051, -90.0600, 1, 1, 100);
    caminhao[11] = CreateVehicle(403, 2760.0535, -2337.0396, 14.1051, -90.0000, 1, 1, 100);
    caminhao[12] = CreateVehicle(403, 2759.3333, -2379.2683, 14.1051, -90.0000, 1, 1, 100);
    caminhao[13] = CreateVehicle(403, 2778.0913, -2381.0750, 14.1051, 90.0000, 1, 1, 100);
    caminhao[14] = CreateVehicle(403, 2777.8953, -2387.4812, 14.1051, 90.0000, 1, 1, 100);
    caminhao[15] = CreateVehicle(403, 2777.9941, -2384.3052, 14.1051, 90.0000, 1, 1, 100);
    caminhao[16] = CreateVehicle(403, 2777.5559, -2395.3184, 14.1051, 90.0000, 1, 1, 100);
    caminhao[17] = CreateVehicle(403, 2777.4539, -2398.8093, 14.1051, 90.0000, 1, 1, 100);
    caminhao[18] = CreateVehicle(403, 2777.3525, -2402.2456, 14.1051, 90.0000, 1, 1, 100);
    caminhao[19] = CreateVehicle(403, 2777.6592, -2391.8167, 14.1051, 90.0000, 1, 1, 100);
    caminhao[20] = CreateVehicle(403, 2775.9270, -2418.2512, 14.1051, 90.0000, 1, 1, 100);
    caminhao[21] = CreateVehicle(403, 2774.7324, -2455.2065, 14.1051, 90.0000, 1, 1, 100);
    caminhao[22] = CreateVehicle(403, 2774.7046, -2493.5581, 14.1051, 90.0000, 1, 1, 100); 
return 1;
}
proximo
Code:
new profissao = 0; // fiz isso para simular o PlayerInfo[playerid][IdDaOrg]
Code:
cmd:darprofissao(playerid){
  ++profissao;
  return 1;
}
cmd:removerprofissao(playerid){
  --profissao;
  return 1;
}
public OnPlayerStateChange(playerid, newstate, oldstate)
{
  for(new c = 0; c <= 23; c++)
    {
        if(IsPlayerInVehicle(playerid, caminhao[c]) && profissao != 1)
        {
            SendClientMessage(playerid, -1, "voce nao e um caminhoneiro");
            RemovePlayerFromVehicle(playerid);
            break;
        }
    }
  return 1;
}
edit: se quiser adicionar mais organizaзгo/profissгo segui o exemplo https://pastebin.com/0e27tER1
creditos: https://sampforum.blast.hk/showthread.php?tid=395339
ele ainda da um erro
Code:
undefined symbol "caminhao"
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)