Problema com o comando /alugarmoto
#1

Quando eu alugo a moto, as pessoas nгo conseguem da a ingnicгo no veiculo. Tem que sair do veiculo e depois entrar para ligar. Alguйm sabe onde errei nesse comando?

Eu acho que pode ser esses 3 linhas aqui.

PHP код:
   gEngine[playerid] = 1;
   
engineOn[GetPlayerVehicleID(playerid)] = false;
   
//TogglePlayerControllable(playerid, 1); 
COMANDO "/alugarmoto"

PHP код:
    if(strcmp(cmd"/alugarmoto"true) == 0)
    {
        if(
IsPlayerConnected(playerid))
        {
            for(new 
0sizeof(rentcar); i++)
            {
                if(
GetPlayerVehicleID(playerid) == rentcar[i]) continue;
            }
            new 
hirefee HireCost(GetPlayerVehicleID(playerid));
            if(
SBizzInfo[1][sbProducts] == 0)
            {
                
GameTextForPlayer(playerid"~r~Fora de estoque"50001);
                return 
1;
            }
            if (
GetPlayerMoney(playerid) <  SBizzInfo[1][sbEntranceCost])
            {
                
SendClientMessage(playeridCOLOR_GRAD2"  Voce nao tem dinheiro !");
                return 
1;
            }
            if(
HireCar[playerid] != 299)
            {
                
gCarLock[HireCar[playerid]] = 0;
                
UnLockCar(HireCar[playerid]);
                
SendClientMessage(playeridCOLOR_GREY"Vocк precisa desalugar seu carro/moto/barco atual primeiro !");
                return 
1;
            }
            for(new 
i=0i<MAX_PLAYERSi++)
            {
                if(
HireCar[i] == GetPlayerVehicleID(playerid))
                {
                    
SendClientMessage(playeridCOLOR_GREY"    Alguem alugou esse carro !");
                    return 
1;
                }
            }
            
/*if(PlayerInfo[playerid][pPbiskey] == 1)
            {
                GameTextForPlayer(playerid, "~w~No charge for the boss", 5000, 3);
                TogglePlayerControllable(playerid, 1);
                return 1;
            }*/
            
SafeGivePlayerMoney(playerid,-SBizzInfo[1][sbEntranceCost]);
            
SBizzInfo[1][sbTill] += SBizzInfo[1][sbEntranceCost];
            
ExtortionSBiz(1SBizzInfo[1][sbEntranceCost]);
            
SBizzInfo[1][sbProducts]--;
            
HireCar[playerid] = GetPlayerVehicleID(playerid);
            
OnPropUpdate(3,1);
            
PlayerPlaySound(playerid10520.00.00.0);
            
format(stringsizeof(string), "~w~Nao esqueca de usar ~r~/desalugarmoto~n~~g~/trancar ~w~para fechar o carro.",hirefee);
            
SendClientMessage(playeridCOLOR_YELLOW2"Voce pode dar a inginicao !");
            
gEngine[playerid] = 1;
            
engineOn[GetPlayerVehicleID(playerid)] = false;
            
//TogglePlayerControllable(playerid, 1);
            
GameTextForPlayer(playeridstring50003);
            new 
ymd;
            new 
h,mi,s;
            
getdate(y,m,d);
            
gettime(h,mi,s);
            
format(string,sizeof(string), "(%d/%d/%d)[%d:%d:%d] %s [CMD] -> /alugarmoto",d,m,y,h,mi,s,sendername);
            
CommandLog(string);
        }
        return 
1;
    } 
Reply
#2

tenta trocar isto

pawn Код:
engineOn[GetPlayerVehicleID(playerid)] = false;
por

pawn Код:
engineOn[GetPlayerVehicleID(playerid)] = true;
Reply
#3

Continua a mesma coisa, eu fico na moto e ela nгo da a inginiзгo...
Reply
#4

Nгo entendo de RPG mas dк uma olhada na CallBack OnPlayerEnterVehicle pode ser que o erro esteja lб.
Reply
#5

Jб olhei, modifiquei e nada, a moto sу da ingniзгo quando coloco /sair e entro de novo, nгo entendo pq depois de alugar a moto ela nгo libere para eu da a ingniзгo... agora complicou..
Reply
#6

Talvez tente usar
SetVehicleParamsEx
no comando que deve funcionar .
Reply
#7

Vou testar e jб te falo... se vai funcionar
Reply
#8

seguindo a logica do dark tenta isto

pawn Код:
if(strcmp(cmd, "/alugarmoto", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            for(new i = 0; i < sizeof(rentcar); i++)
            {
                if(GetPlayerVehicleID(playerid) == rentcar[i]) continue;
            }
            new hirefee = HireCost(GetPlayerVehicleID(playerid));
            if(SBizzInfo[1][sbProducts] == 0)
            {
                GameTextForPlayer(playerid, "~r~Fora de estoque", 5000, 1);
                return 1;
            }
            if (GetPlayerMoney(playerid) <  SBizzInfo[1][sbEntranceCost])
            {
                SendClientMessage(playerid, COLOR_GRAD2, "  Voce nao tem dinheiro !");
                return 1;
            }
            if(HireCar[playerid] != 299)
            {
                gCarLock[HireCar[playerid]] = 0;
                UnLockCar(HireCar[playerid]);
                SendClientMessage(playerid, COLOR_GREY, "Vocк precisa desalugar seu carro/moto/barco atual primeiro !");
                return 1;
            }
            for(new i=0; i<MAX_PLAYERS; i++)
            {
                if(HireCar[i] == GetPlayerVehicleID(playerid))
                {
                    SendClientMessage(playerid, COLOR_GREY, "    Alguem alugou esse carro !");
                    return 1;
                }
            }
            SafeGivePlayerMoney(playerid,-SBizzInfo[1][sbEntranceCost]);
            SBizzInfo[1][sbTill] += SBizzInfo[1][sbEntranceCost];
            ExtortionSBiz(1, SBizzInfo[1][sbEntranceCost]);
            SBizzInfo[1][sbProducts]--;
            HireCar[playerid] = GetPlayerVehicleID(playerid);
            OnPropUpdate(3,1);
            PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
           
            SendClientMessage(playerid, COLOR_YELLOW2, "Voce pode dar a inginicao !");
            gEngine[playerid] = 1;
           
            format(string, sizeof(string), "~w~Nao esqueca de usar ~r~/desalugarmoto~n~~g~/trancar ~w~para fechar o carro.",hirefee);
            GameTextForPlayer(playerid, string, 5000, 3);
           
            new engine, lights, alarm, doors, bonnet, boot, objective, y, m, d, h,mi,s;
            GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
            SetVehicleParamsEx(vehicleid, 1, lights, alarm, doors, bonnet, boot, objective);
           
            getdate(y,m,d);
            gettime(h,mi,s);
            format(string,sizeof(string), "(%d/%d/%d)[%d:%d:%d] %s [CMD] -> /alugarmoto",d,m,y,h,mi,s,sendername);
            CommandLog(string);
        }
        return 1;
    }
Reply
#9

Deu 2 erros.

(47820) : error 017: undefined symbol "vehicleid"

PHP код:
GetVehicleParamsEx(vehicleidenginelightsalarmdoorsbonnetbootobjective); 
(47821) : error 017: undefined symbol "vehicleid"

PHP код:
SetVehicleParamsEx(vehicleid1lightsalarmdoorsbonnetbootobjective); 
Reply
#10

esqueci 1 coisa
tenta assim

pawn Код:
if(strcmp(cmd, "/alugarmoto", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            for(new i = 0; i < sizeof(rentcar); i++)
            {
                if(GetPlayerVehicleID(playerid) == rentcar[i]) continue;
            }
            new hirefee = HireCost(GetPlayerVehicleID(playerid));
            if(SBizzInfo[1][sbProducts] == 0)
            {
                GameTextForPlayer(playerid, "~r~Fora de estoque", 5000, 1);
                return 1;
            }
            if (GetPlayerMoney(playerid) <  SBizzInfo[1][sbEntranceCost])
            {
                SendClientMessage(playerid, COLOR_GRAD2, "  Voce nao tem dinheiro !");
                return 1;
            }
            if(HireCar[playerid] != 299)
            {
                gCarLock[HireCar[playerid]] = 0;
                UnLockCar(HireCar[playerid]);
                SendClientMessage(playerid, COLOR_GREY, "Vocк precisa desalugar seu carro/moto/barco atual primeiro !");
                return 1;
            }
            for(new i=0; i<MAX_PLAYERS; i++)
            {
                if(HireCar[i] == GetPlayerVehicleID(playerid))
                {
                    SendClientMessage(playerid, COLOR_GREY, "    Alguem alugou esse carro !");
                    return 1;
                }
            }
            SafeGivePlayerMoney(playerid,-SBizzInfo[1][sbEntranceCost]);
            SBizzInfo[1][sbTill] += SBizzInfo[1][sbEntranceCost];
            ExtortionSBiz(1, SBizzInfo[1][sbEntranceCost]);
            SBizzInfo[1][sbProducts]--;
            HireCar[playerid] = GetPlayerVehicleID(playerid);
            OnPropUpdate(3,1);
            PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
           
            SendClientMessage(playerid, COLOR_YELLOW2, "Voce pode dar a inginicao !");
            gEngine[playerid] = 1;
           
            format(string, sizeof(string), "~w~Nao esqueca de usar ~r~/desalugarmoto~n~~g~/trancar ~w~para fechar o carro.",hirefee);
            GameTextForPlayer(playerid, string, 5000, 3);
           
            new engine, lights, alarm, doors, bonnet, boot, objective, y, m, d, h,mi,s, vehicleid = GetPlayerVehicleID(playerid);
            GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
            SetVehicleParamsEx(vehicleid, 1, lights, alarm, doors, bonnet, boot, objective);
           
            getdate(y,m,d);
            gettime(h,mi,s);
            format(string,sizeof(string), "(%d/%d/%d)[%d:%d:%d] %s [CMD] -> /alugarmoto",d,m,y,h,mi,s,sendername);
            CommandLog(string);
        }
        return 1;
    }
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)