[Ajuda] Aparecer texto para todos os passageiros
#1

Bom Pessoal estou com um problema aqui , coloquei no meu servidor um sistema de motor, Motor Ligado, Motor desligado, vamos lб

Quando o player estar dentro do veнculo , ira aparecer no velocimetro do veiculo:
Motor: Desligado apуs digita /motoron o text
Motor desligado , ira mudar para Motor: Ligado o problema й isso
O text sу mostra para o piloto do veнculo e pro passageiro nгo
O Player que esta dirigindo liga o motor e aparece motor: ligado
e pros passageiro continua aparecer
Motor: desligado , alguйm pode me ajudar?

PHP код:
            if(motor[i] == 1)
            {
            
format(velopet5,sizeof(velopet5),"~r~~h~~h~~h~~h~Motor: ~w~Ligado");
            }
            else if(
motor[i] == 0)
            {
            
format(velopet5,sizeof(velopet5),"~r~~h~~h~~h~~h~Motor: ~w~Desligado");
            }
            
TextDrawSetString(MotorOnOFF[i], velopet5); 
PHP код:
            motor[playerid] = 0// desligado 
Reply
#2

Exemplo:
pawn Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
    if(newstate == PLAYER_STATE_DRIVER || newstate == PLAYER_STATE_PASSENGER)
    {

        if(motor[playerid] == 1){ Funзгo.. }
    }
    else if(oldstate == PLAYER_STATE_DRIVER || oldstate == PLAYER_STATE_PASSENGER)
    {

        TextDrawHideForPlayer(playerid, suatxd);
                motor[playerid] = 0;

    }
    return 1;
}
Reply
#3

Quote:
Originally Posted by Coe1
Посмотреть сообщение
Exemplo:
pawn Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
    if(newstate == PLAYER_STATE_DRIVER || newstate == PLAYER_STATE_PASSENGER)
    {

        if(motor[playerid] == 1){ Funзгo.. }
    }
    else if(oldstate == PLAYER_STATE_DRIVER || oldstate == PLAYER_STATE_PASSENGER)
    {

        TextDrawHideForPlayer(playerid, suatxd);
                motor[playerid] = 0;

    }
    return 1;
}
Cara explica melhor que eu nгo consegui entender !
Reply
#4

Hmm, ok.
pawn Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
    if(newstate == PLAYER_STATE_DRIVER || newstate == PLAYER_STATE_PASSENGER) // Essa funзгo vai verificar se o player й motorista ou passageiro de um veнculo, se ele for vai executar a funзгo abaixo:
    {

        if(motor[playerid] == 1){ Funзгo.. } // Se a variбvel motor for igual a 1 ele vai executar oque tб dentro do { }. Um exemplo й chamar uma callback..
    }
    else if(oldstate == PLAYER_STATE_DRIVER || oldstate == PLAYER_STATE_PASSENGER) // Essa funзгo verifica se o player nгo й mais o motorista do veнculo. Se ele nao for motorista / passageiro vai executar as funзхes abaixo:
    {

        TextDrawHideForPlayer(playerid, suatxd); // vai esconder a textdraw que mostra o motor ligado
                motor[playerid] = 0; // vai setar a variбvel para 0..

    }
    return 1;
}
Nгo entendi muito o tуpico, se nгo for isso que vocк quer, me avise.
Reply
#5

Quote:
Originally Posted by Coe1
Посмотреть сообщение
Exemplo:
pawn Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
    if(newstate == PLAYER_STATE_DRIVER || newstate == PLAYER_STATE_PASSENGER)
    {

        if(motor[playerid] == 1){ Funзгo.. }
    }
    else if(oldstate == PLAYER_STATE_DRIVER || oldstate == PLAYER_STATE_PASSENGER)
    {

        TextDrawHideForPlayer(playerid, suatxd);
                motor[playerid] = 0;

    }
    return 1;
}
me ajuda ai sistema do motor
PHP код:
    if (strcmp("/motor"cmdtexttrue10) == 0)
    {
        new 
State;
        new 
motlualarporcappormaob;
        new 
carro GetPlayerVehicleID(playerid);
        if(
carro != INVALID_VEHICLE_ID)
        {
            if(
IsPlayerInAnyVehicle(playerid))
            {
             
State=GetPlayerState(playerid);
            if(
State!=PLAYER_STATE_DRIVER)
            {
                
MSGPLAYER(playerid,COLOR_GREY,"   Vocк nгo й o motorista/piloto do veнculo");
                return 
1;
            }
            if(
motor[playerid] == 0)
            {
                
GetVehicleParamsEx(carromotlualarporcappormaob);
                
SetVehicleParamsEx(carroVEHICLE_PARAMS_ONlualarporcappormaob);
                
motor[playerid] = 1;
                
SendClientMessage(playerid0xFFFFFFAA"Veiculo {2F991A}Ligado, {FFFFFF}Digite /motor para desliga-lo");
            }
            else if(
motor[playerid] == 1)
            {
                
GetVehicleParamsEx(carromotlualarporcappormaob);
                
SetVehicleParamsEx(carroVEHICLE_PARAMS_OFFlualarporcappormaob);
                
motor[playerid] = 0;
                
SendClientMessage(playerid0xFFFFFFAA"Veiculo {E31919}Desligado, {FFFFFF}Digite /motor para liga-lo");
            }
        }
              }
        return 
1;
    } 
E isso
PHP код:
            if(motor[i] == 1)
            {
            
format(velopet5,sizeof(velopet5),"~r~~h~~h~~h~~h~Motor: ~w~Ligado");
            
motor[playerid] = 1// ligado
            
}
            else if(
motor[i] == 0)
            {
            
format(velopet5,sizeof(velopet5),"~r~~h~~h~~h~~h~Motor: ~w~Desligado");
            
motor[playerid] = 0// desligado
            
}
            
TextDrawSetString(MotorOnOFF[i], velopet5); 
Reply
#6

Tenta assim:
pawn Код:
forward sismotor(playerid); // topo do gamemode

if (strcmp("/motor", cmdtext, true, 10) == 0)
    {
        new State;
        new mot, lu, alar, por, cap, porma, ob;
        new carro = GetPlayerVehicleID(playerid);
        if(carro != INVALID_VEHICLE_ID)
        {
            if(IsPlayerInAnyVehicle(playerid))
            {
             State=GetPlayerState(playerid);
            if(State!=PLAYER_STATE_DRIVER)
            {
                MSGPLAYER(playerid,COLOR_GREY,"   Vocк nгo й o motorista/piloto do veнculo");
                return 1;
            }
            if(motor[playerid] == 0)
            {
                GetVehicleParamsEx(carro, mot, lu, alar, por, cap, porma, ob);
                SetVehicleParamsEx(carro, VEHICLE_PARAMS_ON, lu, alar, por, cap, porma, ob);
                motor[playerid] = 1;
                SendClientMessage(playerid, 0xFFFFFFAA, "Veiculo {2F991A}Ligado, {FFFFFF}Digite /motor para desliga-lo");
            }
            else if(motor[playerid] == 1)
            {
                GetVehicleParamsEx(carro, mot, lu, alar, por, cap, porma, ob);
                SetVehicleParamsEx(carro, VEHICLE_PARAMS_OFF, lu, alar, por, cap, porma, ob);
                motor[playerid] = 0;
                SendClientMessage(playerid, 0xFFFFFFAA, "Veiculo {E31919}Desligado, {FFFFFF}Digite /motor para liga-lo");
            }
        }
              }
        return 1;
    }  
   
public OnPlayerStateChange(playerid, newstate, oldstate)
{
    if(newstate == PLAYER_STATE_DRIVER || newstate == PLAYER_STATE_PASSENGER)
    {

        if(motor[playerid] == 1){ sismotor(playerid); }
    }
    else if(oldstate == PLAYER_STATE_DRIVER || oldstate == PLAYER_STATE_PASSENGER)
    {

        TextDrawHideForPlayer(playerid, MotorOnOFF[i]);
        motor[playerid] = 0;

    }
    return 1;
}
   
public sismotor(playerid)
{
        if(motor[i] == 1)
            {
            format(velopet5,sizeof(velopet5),"~r~~h~~h~~h~~h~Motor: ~w~Ligado");
            motor[playerid] = 1; // ligado
            }
        else if(motor[i] == 0)
            {
            format(velopet5,sizeof(velopet5),"~r~~h~~h~~h~~h~Motor: ~w~Desligado");
            motor[playerid] = 0; // desligado
            }
            TextDrawSetString(MotorOnOFF[i], velopet5);  
    return 1
}
Obs: Nгo testado.
Reply
#7

Quote:
Originally Posted by Coe1
Посмотреть сообщение
Tenta assim:
pawn Код:
forward sismotor(playerid); // topo do gamemode

if (strcmp("/motor", cmdtext, true, 10) == 0)
    {
        new State;
        new mot, lu, alar, por, cap, porma, ob;
        new carro = GetPlayerVehicleID(playerid);
        if(carro != INVALID_VEHICLE_ID)
        {
            if(IsPlayerInAnyVehicle(playerid))
            {
             State=GetPlayerState(playerid);
            if(State!=PLAYER_STATE_DRIVER)
            {
                MSGPLAYER(playerid,COLOR_GREY,"   Vocк nгo й o motorista/piloto do veнculo");
                return 1;
            }
            if(motor[playerid] == 0)
            {
                GetVehicleParamsEx(carro, mot, lu, alar, por, cap, porma, ob);
                SetVehicleParamsEx(carro, VEHICLE_PARAMS_ON, lu, alar, por, cap, porma, ob);
                motor[playerid] = 1;
                SendClientMessage(playerid, 0xFFFFFFAA, "Veiculo {2F991A}Ligado, {FFFFFF}Digite /motor para desliga-lo");
            }
            else if(motor[playerid] == 1)
            {
                GetVehicleParamsEx(carro, mot, lu, alar, por, cap, porma, ob);
                SetVehicleParamsEx(carro, VEHICLE_PARAMS_OFF, lu, alar, por, cap, porma, ob);
                motor[playerid] = 0;
                SendClientMessage(playerid, 0xFFFFFFAA, "Veiculo {E31919}Desligado, {FFFFFF}Digite /motor para liga-lo");
            }
        }
              }
        return 1;
    }  
   
public OnPlayerStateChange(playerid, newstate, oldstate)
{
    if(newstate == PLAYER_STATE_DRIVER || newstate == PLAYER_STATE_PASSENGER)
    {

        if(motor[playerid] == 1){ sismotor(playerid); }
    }
    else if(oldstate == PLAYER_STATE_DRIVER || oldstate == PLAYER_STATE_PASSENGER)
    {

        TextDrawHideForPlayer(playerid, MotorOnOFF[i]);
        motor[playerid] = 0;

    }
    return 1;
}
   
public sismotor(playerid)
{
        if(motor[i] == 1)
            {
            format(velopet5,sizeof(velopet5),"~r~~h~~h~~h~~h~Motor: ~w~Ligado");
            motor[playerid] = 1; // ligado
            }
        else if(motor[i] == 0)
            {
            format(velopet5,sizeof(velopet5),"~r~~h~~h~~h~~h~Motor: ~w~Desligado");
            motor[playerid] = 0; // desligado
            }
            TextDrawSetString(MotorOnOFF[i], velopet5);  
    return 1
}
Obs: Nгo testado.
o pawno para de compillar
Reply
#8

pawn Код:
forward sismotor(playerid); // topo do gamemode

if (strcmp("/motor", cmdtext, true, 10) == 0)
{
     
    new State;
    new mot, lu, alar, por, cap, porma, ob;
    new carro = GetPlayerVehicleID(playerid);
    if(carro != INVALID_VEHICLE_ID)
    {
         
        if(IsPlayerInAnyVehicle(playerid))
        {
             
            State=GetPlayerState(playerid);
            if(State!=PLAYER_STATE_DRIVER)
            {
                 
                MSGPLAYER(playerid,COLOR_GREY,"   Vocк nгo й o motorista/piloto do veнculo");
                return 1;
            }
            if(motor[playerid] == 0)
            {
                 
                GetVehicleParamsEx(carro, mot, lu, alar, por, cap, porma, ob);
                SetVehicleParamsEx(carro, VEHICLE_PARAMS_ON, lu, alar, por, cap, porma, ob);
                motor[playerid] = 1;
                SendClientMessage(playerid, 0xFFFFFFAA, "Veiculo {2F991A}Ligado, {FFFFFF}Digite /motor para desliga-lo");
            }
            else if(motor[playerid] == 1)
            {
                 
                GetVehicleParamsEx(carro, mot, lu, alar, por, cap, porma, ob);
                SetVehicleParamsEx(carro, VEHICLE_PARAMS_OFF, lu, alar, por, cap, porma, ob);
                motor[playerid] = 0;
                SendClientMessage(playerid, 0xFFFFFFAA, "Veiculo {E31919}Desligado, {FFFFFF}Digite /motor para liga-lo");
            }
        }
    }
    return 1;
}  

public OnPlayerStateChange(playerid, newstate, oldstate)
{
    if(newstate == PLAYER_STATE_DRIVER || newstate == PLAYER_STATE_PASSENGER)
    {
       

        if(motor[playerid] == 1){ sismotor(playerid); }
    }
    else if(oldstate == PLAYER_STATE_DRIVER || oldstate == PLAYER_STATE_PASSENGER)
    {
       

        TextDrawHideForPlayer(playerid, MotorOnOFF[i]);
        motor[playerid] = 0;

    }
    return 1;
}

public sismotor(playerid)
{
    if(motor[i] == 1)
    {
         
        format(velopet5,sizeof(velopet5),"~r~~h~~h~~h~~h~Motor: ~w~Ligado");
        motor[playerid] = 1; // ligado
    }
    else if(motor[i] == 0)
    {
         
        format(velopet5,sizeof(velopet5),"~r~~h~~h~~h~~h~Motor: ~w~Desligado");
        motor[playerid] = 0; // desligado
    }
    TextDrawSetString(MotorOnOFF[i], velopet5);  
    return 1
}
Reply
#9

Alguйm ?
Reply
#10

Quote:
Originally Posted by Coe1
Посмотреть сообщение
pawn Код:
forward sismotor(playerid); // topo do gamemode

if (strcmp("/motor", cmdtext, true, 10) == 0)
{
     
    new State;
    new mot, lu, alar, por, cap, porma, ob;
    new carro = GetPlayerVehicleID(playerid);
    if(carro != INVALID_VEHICLE_ID)
    {
         
        if(IsPlayerInAnyVehicle(playerid))
        {
             
            State=GetPlayerState(playerid);
            if(State!=PLAYER_STATE_DRIVER)
            {
                 
                MSGPLAYER(playerid,COLOR_GREY,"   Vocк nгo й o motorista/piloto do veнculo");
                return 1;
            }
            if(motor[playerid] == 0)
            {
                 
                GetVehicleParamsEx(carro, mot, lu, alar, por, cap, porma, ob);
                SetVehicleParamsEx(carro, VEHICLE_PARAMS_ON, lu, alar, por, cap, porma, ob);
                motor[playerid] = 1;
                SendClientMessage(playerid, 0xFFFFFFAA, "Veiculo {2F991A}Ligado, {FFFFFF}Digite /motor para desliga-lo");
            }
            else if(motor[playerid] == 1)
            {
                 
                GetVehicleParamsEx(carro, mot, lu, alar, por, cap, porma, ob);
                SetVehicleParamsEx(carro, VEHICLE_PARAMS_OFF, lu, alar, por, cap, porma, ob);
                motor[playerid] = 0;
                SendClientMessage(playerid, 0xFFFFFFAA, "Veiculo {E31919}Desligado, {FFFFFF}Digite /motor para liga-lo");
            }
        }
    }
    return 1;
}  

public OnPlayerStateChange(playerid, newstate, oldstate)
{
    if(newstate == PLAYER_STATE_DRIVER || newstate == PLAYER_STATE_PASSENGER)
    {
       

        if(motor[playerid] == 1){ sismotor(playerid); }
    }
    else if(oldstate == PLAYER_STATE_DRIVER || oldstate == PLAYER_STATE_PASSENGER)
    {
       

        TextDrawHideForPlayer(playerid, MotorOnOFF[i]);
        motor[playerid] = 0;

    }
    return 1;
}

public sismotor(playerid)
{
    if(motor[i] == 1)
    {
         
        format(velopet5,sizeof(velopet5),"~r~~h~~h~~h~~h~Motor: ~w~Ligado");
        motor[playerid] = 1; // ligado
    }
    else if(motor[i] == 0)
    {
         
        format(velopet5,sizeof(velopet5),"~r~~h~~h~~h~~h~Motor: ~w~Desligado");
        motor[playerid] = 0; // desligado
    }
    TextDrawSetString(MotorOnOFF[i], velopet5);  
    return 1
}
Tem skype ?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)