[Ajuda]Componente
#1

boas tnho aqui uma duvida.

PHP код:
public OnPlayerEnterVehicle (playeridvehicleid)
{
    if (
vehicleid == vehicle)
    {
        
AddVehicleComponent(vehicle1010); // Nitro
        
SendClientMessage(playerid0xFFFFFFAA"Nitro added to the Taxi.");
    }
    return 
1;

tipo onde meto o id do veiculo que quero meter o componente?

PHP код:
public OnPlayerEnterVehicle (playeridvehicleid)
{
    if (
vehicleid == //й aqui que meto o id?)
    
{
        
AddVehicleComponent(vehicle1010); // Nitro
        
SendClientMessage(playerid0xFFFFFFAA"Nitro added to the Taxi.");
    }
    return 
1;

Reply
#2

Por exemplo, no meu servidor o ID do taxi й 10, entгo fica assim:

pawn Код:
public OnPlayerEnterVehicle (playerid, vehicleid)
{
    if (vehicleid == 10)
    {
        AddVehicleComponent(vehicleid, 1010); // Nitro
        SendClientMessage(playerid, 0xFFFFFFAA, "Nitro added to the Taxi.");
    }
    return 1;
}

Tem mais algumas maneiras de vocк fazer isso, entгo usa essa que fica mais facil :D
Reply
#3

dame erro

Quote:

C:\Users\Ricardo Moreira\Desktop\RedContry\RC-RP\gamemodes\RC-RP.pwn(2181) : error 055: start of function body without function header
C:\Users\Ricardo Moreira\Desktop\RedContry\RC-RP\gamemodes\RC-RP.pwn(2182) : error 010: invalid function or declaration
C:\Users\Ricardo Moreira\Desktop\RedContry\RC-RP\gamemodes\RC-RP.pwn(2184) : error 010: invalid function or declaration
C:\Users\Ricardo Moreira\Desktop\RedContry\RC-RP\gamemodes\RC-RP.pwn(2186) : error 010: invalid function or declaration
C:\Users\Ricardo Moreira\Desktop\RedContry\RC-RP\gamemodes\RC-RP.pwn(2187) : error 010: invalid function or declaration
C:\Users\Ricardo Moreira\Desktop\RedContry\RC-RP\gamemodes\RC-RP.pwn(2191) : error 021: symbol already defined: "GetPlayerPos"
C:\Users\Ricardo Moreira\Desktop\RedContry\RC-RP\gamemodes\RC-RP.pwn(2195) : error 010: invalid function or declaration
C:\Users\Ricardo Moreira\Desktop\RedContry\RC-RP\gamemodes\RC-RP.pwn(2197) : error 010: invalid function or declaration
C:\Users\Ricardo Moreira\Desktop\RedContry\RC-RP\gamemodes\RC-RP.pwn(219 : error 010: invalid function or declaration
C:\Users\Ricardo Moreira\Desktop\RedContry\RC-RP\gamemodes\RC-RP.pwn(2201) : error 021: symbol already defined: "cx"
C:\Users\Ricardo Moreira\Desktop\RedContry\RC-RP\gamemodes\RC-RP.pwn(2201) : error 021: symbol already defined: "cz"
C:\Users\Ricardo Moreira\Desktop\RedContry\RC-RP\gamemodes\RC-RP.pwn(2206) : error 054: unmatched closing brace ("}")
C:\Users\Ricardo Moreira\Desktop\RedContry\RC-RP\gamemodes\RC-RP.pwn(220 : error 055: start of function body without function header
C:\Users\Ricardo Moreira\Desktop\RedContry\RC-RP\gamemodes\RC-RP.pwn(2210) : error 010: invalid function or declaration
C:\Users\Ricardo Moreira\Desktop\RedContry\RC-RP\gamemodes\RC-RP.pwn(2212) : error 010: invalid function or declaration
C:\Users\Ricardo Moreira\Desktop\RedContry\RC-RP\gamemodes\RC-RP.pwn(2213) : error 010: invalid function or declaration
C:\Users\Ricardo Moreira\Desktop\RedContry\RC-RP\gamemodes\RC-RP.pwn(2215) : error 010: invalid function or declaration
C:\Users\Ricardo Moreira\Desktop\RedContry\RC-RP\gamemodes\RC-RP.pwn(2217) : error 010: invalid function or declaration
C:\Users\Ricardo Moreira\Desktop\RedContry\RC-RP\gamemodes\RC-RP.pwn(221 : error 010: invalid function or declaration
C:\Users\Ricardo Moreira\Desktop\RedContry\RC-RP\gamemodes\RC-RP.pwn(2220) : error 010: invalid function or declaration
C:\Users\Ricardo Moreira\Desktop\RedContry\RC-RP\gamemodes\RC-RP.pwn(2222) : error 010: invalid function or declaration
C:\Users\Ricardo Moreira\Desktop\RedContry\RC-RP\gamemodes\RC-RP.pwn(2223) : error 010: invalid function or declaration
C:\Users\Ricardo Moreira\Desktop\RedContry\RC-RP\gamemodes\RC-RP.pwn(2225) : error 021: symbol already defined: "cx"
C:\Users\Ricardo Moreira\Desktop\RedContry\RC-RP\gamemodes\RC-RP.pwn(2225) : error 021: symbol already defined: "cz"
C:\Users\Ricardo Moreira\Desktop\RedContry\RC-RP\gamemodes\RC-RP.pwn(2231) : error 010: invalid function or declaration
C:\Users\Ricardo Moreira\Desktop\RedContry\RC-RP\gamemodes\RC-RP.pwn(3375) : warning 219: local variable "string" shadows a variable at a preceding level
C:\Users\Ricardo Moreira\Desktop\RedContry\RC-RP\gamemodes\RC-RP.pwn(3639) : warning 204: symbol is assigned a value that is never used: "cut"
C:\Users\Ricardo Moreira\Desktop\RedContry\RC-RP\gamemodes\RC-RP.pwn(20637) : warning 219: local variable "cx" shadows a variable at a preceding level
C:\Users\Ricardo Moreira\Desktop\RedContry\RC-RP\gamemodes\RC-RP.pwn(20637) : warning 219: local variable "cy" shadows a variable at a preceding level
C:\Users\Ricardo Moreira\Desktop\RedContry\RC-RP\gamemodes\RC-RP.pwn(20637) : warning 219: local variable "cz" shadows a variable at a preceding level
C:\Users\Ricardo Moreira\Desktop\RedContry\RC-RP\gamemodes\RC-RP.pwn(42365) : warning 219: local variable "cx" shadows a variable at a preceding level
C:\Users\Ricardo Moreira\Desktop\RedContry\RC-RP\gamemodes\RC-RP.pwn(42365) : warning 219: local variable "cy" shadows a variable at a preceding level
C:\Users\Ricardo Moreira\Desktop\RedContry\RC-RP\gamemodes\RC-RP.pwn(42365) : warning 219: local variable "cz" shadows a variable at a preceding level
C:\Users\Ricardo Moreira\Desktop\RedContry\RC-RP\gamemodes\RC-RP.pwn(44049) : warning 219: local variable "alarme" shadows a variable at a preceding level
C:\Users\Ricardo Moreira\Desktop\RedContry\RC-RP\gamemodes\RC-RP.pwn(44049) : warning 219: local variable "portas" shadows a variable at a preceding level
C:\Users\Ricardo Moreira\Desktop\RedContry\RC-RP\gamemodes\RC-RP.pwn(44049) : warning 219: local variable "capo" shadows a variable at a preceding level
C:\Users\Ricardo Moreira\Desktop\RedContry\RC-RP\gamemodes\RC-RP.pwn(44049) : warning 219: local variable "portamalas" shadows a variable at a preceding level
C:\Users\Ricardo Moreira\Desktop\RedContry\RC-RP\gamemodes\RC-RP.pwn(44073) : warning 203: symbol is never used: "SetWorld"
C:\Users\Ricardo Moreira\Desktop\RedContry\RC-RP\gamemodes\RC-RP.pwn(44073) : warning 203: symbol is never used: "cx"
C:\Users\Ricardo Moreira\Desktop\RedContry\RC-RP\gamemodes\RC-RP.pwn(44073) : warning 203: symbol is never used: "cy"
C:\Users\Ricardo Moreira\Desktop\RedContry\RC-RP\gamemodes\RC-RP.pwn(44073) : warning 203: symbol is never used: "cz"
C:\Users\Ricardo Moreira\Desktop\RedContry\RC-RP\gamemodes\RC-RP.pwn(42260) : warning 204: symbol is assigned a value that is never used: "roadblocktimer"
C:\Users\Ricardo Moreira\Desktop\RedContry\RC-RP\gamemodes\RC-RP.pwn(10135) : warning 204: symbol is assigned a value that is never used: "tugate"
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


25 Errors.

veja o public todo
mas meti logo no inicio

PHP код:
public OnPlayerEnterVehicle(playeridvehicleidispassenger)

{
    if (
vehicleid == 40)
    {
        
AddVehicleComponent(vehicleid1079); // Cutte
    
}
    return 
1;
}

{
    if(
gTeam[playerid] >= 1||gTeam[playerid] >= 3||gTeam[playerid] >= 4)
    {
        if (
IsACopCar(vehicleid) && !ispassenger)
        {
            if(
PlayerInfo[playerid][pLeader]==1||PlayerInfo[playerid][pLeader]==2||PlayerInfo[playerid][pLeader]==3||PlayerInfo[playerid][pMember]==1||PlayerInfo[playerid][pMember]==2||PlayerInfo[playerid][pMember]==3) {}
            else {
                
//WantedPoints[playerid]+=2;
                //SetPlayerCriminal(playerid,255, "Stealing A Police Vehicle");
                
new Float:cxFloat:cyFloat:cz;
                
GetPlayerPos(playeridcxcycz);
                
SetPlayerPos(playeridcx,  cycz);
            }
        }
        if (
IsNgCar(vehicleid) && !ispassenger)
        {
            if(
PlayerInfo[playerid][pLeader]==1||PlayerInfo[playerid][pLeader]==2||PlayerInfo[playerid][pLeader]==3||PlayerInfo[playerid][pMember]==1||PlayerInfo[playerid][pMember]==2||PlayerInfo[playerid][pMember]==3) {}
            else {
                
//WantedPoints[playerid]+=2;
                //SetPlayerCriminal(playerid,255, "Stealing A Police Vehicle");
                
new Float:cxFloat:cyFloat:cz;
                
GetPlayerPos(playeridcxcycz);
                
SetPlayerPos(playeridcx,  cycz);
            }
            
        }
        
        {

        if (
IsAnAmbulance(vehicleid) && !ispassenger)
        {
            if(
PlayerInfo[playerid][pMember]==4||PlayerInfo[playerid][pLeader]==4) { }
            else { 
WantedPoints[playerid]+=2SetPlayerCriminal(playerid,255"Roubos de uma ambulвncia"); }
        }
        if (
IsATank(vehicleid) && !ispassenger)
        {
            if(
PlayerInfo[playerid][pLeader]==1||PlayerInfo[playerid][pLeader]==3||PlayerInfo[playerid][pMember]==3) {}
            else { 
WantedPoints[playerid]+=2SetPlayerCriminal(playerid,255"Roubos de um tanque"); SendClientMessage(playeridCOLOR_RED,"Vocк nгo sabe como conduzi-lo ainda."); }
        }
        if(
IsAnOwnableCar(vehicleid) && CarInfo[vehicleid][cLock] == && CarInfo[vehicleid][cOwned] == 1)
        {
            if(
PlayerInfo[playerid][pAdmin] >= 1337 && AdminDuty[playerid] == 1) { }
            else
            {
                new 
Float:cxFloat:cyFloat:cz;
                
GetPlayerPos(playeridcxcycz);
                
SetPlayerPos(playeridcxcycz);
            }
        }
    }
    return 
1;

Reply
#4

Cara me explica para que pegar a cordenade e setar d novo?
Como a public й de entrar no carro sу mandar remover o player.

Teanta assim:

pawn Код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
    if (vehicleid == 40)
    {
        AddVehicleComponent(vehicleid, 1079); // Cutte
    }
    if(gTeam[playerid] >= 1||gTeam[playerid] >= 3||gTeam[playerid] >= 4)
    {
        if(IsACopCar(vehicleid) && !ispassenger)
        {
            if(PlayerInfo[playerid][pLeader] > 3 || PlayerInfo[playerid][pMember] > 3)
            {
                //WantedPoints[playerid]+=2;
                //SetPlayerCriminal(playerid,255, "Stealing A Police Vehicle");
                RemovePlayerFromVehicle(playerid);
            }
        }
        if(IsNgCar(vehicleid) && !ispassenger)
        {
            if(PlayerInfo[playerid][pLeader] > 3 || PlayerInfo[playerid][pMember] > 3)
            {
                //WantedPoints[playerid]+=2;
                //SetPlayerCriminal(playerid,255, "Stealing A Police Vehicle");
                RemovePlayerFromVehicle(playerid);
            }
           
        }
        if (IsAnAmbulance(vehicleid) && !ispassenger)
        {
            if(PlayerInfo[playerid][pMember] != 4 || PlayerInfo[playerid][pLeader] != 4)WantedPoints[playerid]+=2; SetPlayerCriminal(playerid,255, "Roubos de uma ambulвncia");
        }
        if (IsATank(vehicleid) && !ispassenger)
        {
            if(PlayerInfo[playerid][pLeader] != 3 || PlayerInfo[playerid][pMember] != 3)WantedPoints[playerid]+=2; SetPlayerCriminal(playerid,255, "Roubos de um tanque"); SendClientMessage(playerid, COLOR_RED,"Vocк nгo sabe como conduzi-lo ainda.");
        }
        if(IsAnOwnableCar(vehicleid) && CarInfo[vehicleid][cLock] == 1 && CarInfo[vehicleid][cOwned] == 1)
        {
            if(PlayerInfo[playerid][pAdmin] < 1337 && AdminDuty[playerid] == 0)
            RemovePlayerFromVehicle(playerid);
        }
    }
    return 1;
}
Reply
#5

foi o que disse aqui na wiki.

https://sampwiki.blast.hk/wiki/Car_Component_ID
Reply
#6

Cara testa o cуdigo que eu passei, acho que vai resolver seu caso.
Acabei de arrumar ele, pq tava sem uns ;
Reply
#7

Se quiser colocar veiculo por veiculo, faзa desta forma:
PHP код:
public OnPlayerEnterVehicleplayeridvehicleid )
{
   new 
kVeh;
   
kVeh GetPlayerVehicleIDplayerid );
   if( 
kVeh == ID || kVeh == ID || kVeh == ID )
   {
      
AddVehicleComponentkVeh1010 ); //Nitro
      
SendClientMessageplayerid0xFFFFFFAA"Nitro adicionado no taxi." );
      return 
true;
   }
   return 
true;

Se quiser uma certa sequкncia de veiculos seguido, tipo: veiculo 363, 364, 365, 366, faзa do seguinte:
PHP код:
public OnPlayerEnterVehicleplayeridvehicleid )
{
   new 
kVeh;
   
kVeh GetPlayerVehicleIDplayerid );
   if( 
kVeh >= 363 && kVeh <= 366 )
   {
      
AddVehicleComponentkVeh1010 ); //Nitro
      
SendClientMessageplayerid0xFFFFFFAA"Nitro adicionado no taxi." );
      return 
true;
   }
   return 
true;

Reply
#8

aproveito para perguntar uma coisa, pq voces usar "GetPlayerVehicleID( playerid );" certeza que funfa? й que o player ainda nao esta no carro, esta a entrar, eu aconselho "vehicleid" que estб definido na callback, mais seguro acho eu!
Reply
#9

Concordo com o DJloko, assim fica mais seguro :d
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)