[Ajuda] Fazendo carro desligar
#1

Eu peguei um fs na internet porem eu queria editalo e colocar comandos de KeyState , entao eu comecei a tentar fazer o comando de desligar e ligar o carro com o botao ALT E ESPAЗO!

Porem , eu so conseguir fazer o carro ligar , nгo conseguir fazer desligar...ja vi tudo que tutorial e nao consiguo fazer isso desligar..alguem me ajuda?

PHP код:
#include <a_samp>
#define FILTERSCRIPT
#pragma tabsize 0
#if defined FILTERSCRIPT
#endif
//Cores
#define VERDE                                                                    0x33AA33AA
#define VERMELHO                                                                0xFF000096
#define PRETO                                                                    0x000000FF
#define AZUL                                                                      0x2641FEAA
#define ROXO                                                                      0xC2A2DAAA
#define AMARELO                                                                   0xFFFF00AA
#define CINZA                                                                     0xAFAFAFAA
#define Verde                                                                   0x00D700AA
new Engine[MAX_VEHICLES];
forward EngineTimer(playerid);
public 
OnFilterScriptInit()
{
    print(
"                ");
    print(
"                ");
    print(
"                ");
    print(
"[HTS][LIGADO]Sistema De Ligar E Desligar Veiculo Feito Por: Tomboy e Caio Cartaxo![HTS].");
    print(
"                   ");
    print(
"                ");
    print(
"                ");
    print(
"                ");
    return 
1;
}
public 
OnPlayerStateChange(playeridnewstateoldstate)
{
     if(
newstate == PLAYER_STATE_DRIVER)
    {
         new 
vehicleid GetPlayerVehicleID(playerid);
        if(
Engine[vehicleid] == 0)
        {
   
TogglePlayerControllable(playerid0);
            
SendClientMessage(playeridVerde"[VNR]Pressione (Espaзo) ou digite /ligarv para ligar seu veiculo");
            
SendClientMessage(playeridVerde"[VNR]Pressione (ALT) ou digite /desligarv Para desligar seu veiculo");
        }
    }
    return 
1;
}
public 
OnPlayerKeyStateChange(playeridnewkeysoldkeys)
{
         new 
vehicleid GetPlayerVehicleID(playerid);
         if(
IsPlayerInAnyVehicle(playerid))
 {
         if(
newkeys KEY_WALK)
            {
                if(
Engine[vehicleid] == 1)
                
Engine[vehicleid] = 0;
                
TogglePlayerControllable(playerid0);
}
}
  if(
Engine[vehicleid] == 0)
        {
            if(
newkeys KEY_JUMP)
            {
    
SetTimerEx("EngineTimer"10000"i"playerid);
                
TogglePlayerControllable(playerid1);
            }
        }
}
public 
OnPlayerCommandText(playeridcmdtext[])
{
 if(
strcmp(cmdtext"/ligarv"true) == 0)
    {
        new 
vehicleid GetPlayerVehicleID(playerid);
        if(
Engine[vehicleid] == 0)
        {
            
SendClientMessage(playeridVERDE"[VNR]Ligando veiculo...");
            
SetTimerEx("EngineTimer"10000"i"playerid);
        }
  else if(
Engine[vehicleid] == 1)
        {
            
SendClientMessage(playeridAMARELO"[VNR]Seu veiculo ja estб ligado!.");
        }
        return 
1;
     }
    if(
strcmp(cmdtext"/desligarv"true) == 0)
    {
        new 
vehicleid GetPlayerVehicleID(playerid);
  if(
Engine[vehicleid] == 1)
        {
            if(
IsPlayerInAnyVehicle(playerid))
            {
                
Engine[vehicleid] = 0;
                
TogglePlayerControllable(playerid0);
   }
        return 
1;
 }
        return 
0;
 }
 }
public 
EngineTimer(playerid)
{
    new 
rand random(2);
    if(
rand == 0)
    {
        
SendClientMessage(playeridVerde"[VNR]Veiculo ligado!. Para desligar o veiculo use /desligarv ou aperte ALT");
        new 
vehicleid GetPlayerVehicleID(playerid);
        
Engine[vehicleid] = 1;
    }
    if(
rand == 1)
    {
        
SendClientMessage(playeridVerde"[VNR]Veiculo ligado!. Para desligar o veiculo use /desligarv ou aperte ALT");
        new 
vehicleid GetPlayerVehicleID(playerid);
        
Engine[vehicleid] = 1;
    }
    if(
rand == 2)
    {
        
SendClientMessage(playeridVerde"[VNR]Veiculo ligado!. Para desligar o veiculo use /desligarv ou aperte ALT");
        new 
vehicleid GetPlayerVehicleID(playerid);
        
Engine[vehicleid] = 1;
    }

e toda vez que Compilo da esse Warning

PHP код:
C:\Program Files (x86)\Rockstar Games\GTA San Andreas\Server\filterscripts\Chavev.pwn(108) : warning 209: function "OnPlayerCommandText" should return a value
Pawn compiler 3.2.3664              Copyright 
(c1997-2006ITB CompuPhase
1 Warning

Porem o comando de ligar pelo espaco funciona de boa..so o de desligar pelo ALT que nao =/

Se alguem me falar no que eu estou errando Ficaria muito grato!
Reply
#2

A funзгo OnPlayerCommandText precisa retornar algum valor, coloque return 1; antes da ъltima chave

ex:

Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
      if(!strcmp(cmdtext, "/talzinho", true))
      {
               if(talzinho == 1)
               {
               SendClientMessage(playerid, -1, "Talzinho foi ativado, agora ele й um pinto no lixo");
               }
       }
     return 1;
}
Reply
#3

Pow mano , Vlw! tava quebrando a cabeзa pra tirar esse warning..

Agora so falta o ALT funcionar =/
Reply
#4

@UPP ...nada? =/
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)