[Ajuda] IsVehicleOccupied (Nao cumpri a funзao)
#1

o IsVehicleOccupied nao esta matando o player q esta tentando roubar o carro.
oq devo fazer?

Stock
PHP код:
stock IsVehicleOccupied(vehicleid)
{
    for(new 
0MAX_PLAYERSi++)
    {
        if(
IsPlayerInVehicle(i,vehicleid) && GetPlayerState(i) == PLAYER_STATE_DRIVER))
        return 
1;
    }
    return 
0;

PHP код:
// Anti-Roubo
public OnPlayerEnterVehicle(playeridvehicleidispassenger)
{
    
SendClientMessage(playeridVermelho"[AVISO]{FFFFFF} Nгo tente roubar veнculos, vocк morrerб automaticamente{FF0000}.");
    
SendClientMessage(playeridVermelho"[AVISO]{FFFFFF} Para ver os Comandos do Veiculo digite {FF0000}/vctrl");
    
SendClientMessage(playeridVermelho"[AVISO]{FFFFFF} Usamos ANTI-HACK de SpeedHack, Velocidade Permitida e {FF0000}[400-KM/H].");
    if(!
ispassenger && IsVehicleOccupied(vehicleid))
    {
        
AddVehicleComponent(vehicleid1010);
    }
    if(!
ispassenger && IsVehicleOccupied(vehicleid)) SetPlayerHealth(playerid,0.0);
    return 
1;

Reply
#2

Pra q 2 vezes a mesma verificaзгo? Coloca o SetPlayerHealth dentro do primeiro if antes do addvehiclecomponent
Reply
#3

ERRO NA STOCK CBD2.pwn(9987) : error 029: invalid expression, assumed zero
CBD2.pwn(9987 -- 998 : warning 215: expression has no effect
CBD2.pwn(998 : error 001: expected token: ";", but found "return"
Reply
#4

PHP код:
// Anti-Roubo 
public OnPlayerEnterVehicle(playeridvehicleidispassenger

    
SendClientMessage(playeridVermelho"[AVISO]{FFFFFF} Nгo tente roubar veнculos, vocк morrerб automaticamente{FF0000}."); 
    
SendClientMessage(playeridVermelho"[AVISO]{FFFFFF} Para ver os Comandos do Veiculo digite {FF0000}/vctrl"); 
    
SendClientMessage(playeridVermelho"[AVISO]{FFFFFF} Usamos ANTI-HACK de SpeedHack, Velocidade Permitida e {FF0000}[400-KM/H]."); 

    if(
playerid != ispassenger && IsVehicleOccupied(vehicleid)) 
    { 
        
AddVehicleComponent(vehicleid1010); 
        
SetPlayerHealth(playerid,0.0); 
    }
    return 
1

Reply
#5

Quote:
Originally Posted by PT
Посмотреть сообщение
PHP код:
// Anti-Roubo 
public OnPlayerEnterVehicle(playeridvehicleidispassenger

    
SendClientMessage(playeridVermelho"[AVISO]{FFFFFF} Nгo tente roubar veнculos, vocк morrerб automaticamente{FF0000}."); 
    
SendClientMessage(playeridVermelho"[AVISO]{FFFFFF} Para ver os Comandos do Veiculo digite {FF0000}/vctrl"); 
    
SendClientMessage(playeridVermelho"[AVISO]{FFFFFF} Usamos ANTI-HACK de SpeedHack, Velocidade Permitida e {FF0000}[400-KM/H]."); 
    if(
playerid != ispassenger && IsVehicleOccupied(vehicleid)) 
    { 
        
AddVehicleComponent(vehicleid1010); 
        
SetPlayerHealth(playerid,0.0); 
    }
    return 
1

o erro aparece na stock pt
Reply
#6

tem aqui uma minha que eu uso, ela usa foreach se nao quiser usar so trocar

PHP код:
stock IsVehicleOccupied(vehicleid)
{
    foreach(new 
Player)
    {
        if(
GetPlayerState(i) == PLAYER_STATE_DRIVER || GetPlayerState(i) == PLAYER_STATE_PASSENGER)
            if(
GetPlayerVehicleID(i) == vehicleid)
                return 
1;
    }
    return 
0;

Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)