Galera eu to fazendo um sistema simples de carregamento de carretas para o meu GM de RPG para o emprego de caminhoneiros, na qual a funзгo й reabastecer o comйrcio em geral, como eu sempre faзo eu pego um modelo sу para fazer teste, ai quando estб 100% funcional eu copio esse para as demais utilizaзхes, porйm eu estou tendo um problema bem chato no sistema que estou desenvolvendo...
pawn Код:
/*_____| Comando CarregarCarreta |_____*/
if(strcmp(cmd, "/carregarcarreta", true) == 0)
{
new trailer = GetVehicleTrailer(veh);
if(CarregarCarretaCombustivel(playerid))
{
if(GetVehicleModel(trailer) != 584) //Verifica se o modelo do trailer do veiculo em questгo й 584 (tanque de combustivel)
{
MP(playerid, cinza, "Vocк nгo estб com uma carreta de tanque de combustнvel engatada!");
return 1;
}
else if(GetVehicleModel(trailer) == 584)
{
if(trailer == CarretaCombustivel[0])
{
if(CarregamentoNasCarretasC[CarretaCombustivel[0]] < 500)
{
if(JaEstaCarregando[playerid] == 1)
{
MP(playerid, cinza, "Vocк jб estб fazendo o carregamento da carreta, pode cancelar pressionando 'N'!");
}
else
{
JaEstaCarregando[playerid] = 1;
// TogglePlayerControllable(playerid, false);
TipoCarregamento[CarretaCombustivel[0]] = tcCombustivel;
GameTextForPlayer(playerid, "~n~~n~~w~Sua carreta esta sendo carregada!~n~Aguarde!~n~Para cancelar pressione 'N'", 5000, 3);
timerCarregamento = SetTimerEx("CarregandoCarretaCombustivel", 1000, true, "ii", playerid, CarretaCombustivel[0]);
return 1;
}
}
else if(CarregamentoNasCarretasC[CarretaCombustivel[0]] == 500)
{
GameTextForPlayer(playerid, "~n~~n~~n~~n~~n~~n~~y~Sua carreta ja esta~n~~w~100% ~g~carregada!", 10000, 3);
return 1;
}
}
else if(trailer == CarretaCombustivel[1])
{
if(CarregamentoNasCarretasC[CarretaCombustivel[1]] < 500)
{
if(JaEstaCarregando[playerid] == 1)
{
MP(playerid, cinza, "Vocк jб estб fazendo o carregamento da carreta, pode cancelar pressionando 'N'!");
}
else
{
JaEstaCarregando[playerid] = 1;
// TogglePlayerControllable(playerid, false);
TipoCarregamento[CarretaCombustivel[1]] = tcCombustivel;
GameTextForPlayer(playerid, "~n~~n~~w~Sua carreta esta sendo carregada!~n~Aguarde!~n~Para cancelar pressione 'N'", 5000, 3);
timerCarregamento = SetTimerEx("CarregandoCarretaCombustivel", 1000, true, "ii", playerid, CarretaCombustivel[1]);
return 1;
}
}
else if(CarregamentoNasCarretasC[CarretaCombustivel[1]] == 500)
{
GameTextForPlayer(playerid, "~n~~n~~n~~n~~n~~n~~y~Sua carreta ja esta~n~~w~100% ~g~carregada!", 10000, 3);
return 1;
}
}
else if(trailer == CarretaCombustivel[2])
{
if(CarregamentoNasCarretasC[CarretaCombustivel[2]] < 500)
{
if(JaEstaCarregando[playerid] == 1)
{
MP(playerid, cinza, "Vocк jб estб fazendo o carregamento da carreta, pode cancelar pressionando 'N'!");
}
else
{
JaEstaCarregando[playerid] = 1;
// TogglePlayerControllable(playerid, false);
TipoCarregamento[CarretaCombustivel[2]] = tcCombustivel;
GameTextForPlayer(playerid, "~n~~n~~w~Sua carreta esta sendo carregada!~n~Aguarde!~n~Para cancelar pressione 'N'", 5000, 3);
timerCarregamento = SetTimerEx("CarregandoCarretaCombustivel", 1000, true, "ii", playerid, CarretaCombustivel[2]);
return 1;
}
}
else if(CarregamentoNasCarretasC[CarretaCombustivel[2]] == 500)
{
GameTextForPlayer(playerid, "~n~~n~~n~~n~~n~~n~~y~Sua carreta ja esta~n~~w~100% ~g~carregada!", 10000, 3);
return 1;
}
}
}
}
return 1;
}
// e aqui a callback
/*______________________| Sistema de Caminhoneiros |__________________________*/
forward CarregandoCarretaCombustivel(playerid, trailerid);
public CarregandoCarretaCombustivel(playerid, trailerid)
{
new str[256];
// new trailerid = GetVehicleTrailer(GetPlayerVehicleID(playerid));
if(trailerid == CarretaCombustivel[0])
{
if(TipoCarregamento[trailerid] == tcCombustivel)
{
if(CarregamentoNasCarretasC[trailerid] < 500)
{
MFP(playerid, -1, "Carregando trailer de combustivel %d com %d valor total a pagar R$%.2d!", trailerid, CarregamentoNasCarretasC[trailerid], DinheiroPelaCargaCombustivel[playerid]);
CarregamentoNasCarretasC[trailerid]+= 5;
DinheiroPelaCargaCombustivel[playerid] += 25;
TextDrawSetString(textTipoCarga[trailerid], "Carga: ~y~Combustivel");
format(str, 256, "Quantia: ~y~%d", CarregamentoNasCarretasC[trailerid]);
TextDrawSetString(textQuantiaCarga[trailerid], str);
format(str, 256, "Valor da carga: ~y~%d", DinheiroPelaCargaCombustivel[playerid]);
TextDrawSetString(textValorCarga[trailerid], str);
}
else if(CarregamentoNasCarretasC[trailerid] == 500)
{
TogglePlayerControllable(playerid, true);
GameTextForPlayer(playerid, "~n~~n~~n~~n~~n~~n~~y~Sua carreta esta~n~~w~100% ~g~carregada!", 10000, 3);
KillTimer(timerCarregamento);
}
}
}
else if(trailerid == CarretaCombustivel[1])
{
if(TipoCarregamento[trailerid] == tcCombustivel)
{
if(CarregamentoNasCarretasC[trailerid] < 500)
{
MFP(playerid, -1, "Carregando trailer de combustivel %d com %d valor total a pagar R$%.2d!", trailerid, CarregamentoNasCarretasC[trailerid], DinheiroPelaCargaCombustivel[playerid]);
CarregamentoNasCarretasC[trailerid]+= 5;
DinheiroPelaCargaCombustivel[playerid] += 25;
TextDrawSetString(textTipoCarga[trailerid], "Carga: ~y~Combustivel");
format(str, 256, "Quantia: ~y~%d", CarregamentoNasCarretasC[trailerid]);
TextDrawSetString(textQuantiaCarga[trailerid], str);
format(str, 256, "Valor da carga: ~y~%d", DinheiroPelaCargaCombustivel[playerid]);
TextDrawSetString(textValorCarga[trailerid], str);
}
else if(CarregamentoNasCarretasC[trailerid] == 500)
{
TogglePlayerControllable(playerid, true);
GameTextForPlayer(playerid, "~n~~n~~n~~n~~n~~n~~y~Sua carreta esta~n~~w~100% ~g~carregada!", 10000, 3);
KillTimer(timerCarregamento);
}
}
else
{
if(CarregamentoNasCarretasC[trailerid] == 0)
{
TextDrawSetString(textTipoCarga[trailerid], "Carga: ~y~Desengatada");
TextDrawSetString(textQuantiaCarga[trailerid], "Quantia: ~y~Vaziu");
TextDrawSetString(textValorCarga[trailerid], "Valor carga: ~y~Nada");
}
}
}
else if(trailerid == CarretaCombustivel[2])
{
if(TipoCarregamento[trailerid] == tcCombustivel)
{
if(CarregamentoNasCarretasC[trailerid] < 500)
{
MFP(playerid, -1, "Carregando trailer de combustivel %d com %d valor total a pagar R$%.2d!", trailerid, CarregamentoNasCarretasC[trailerid], DinheiroPelaCargaCombustivel[playerid]);
CarregamentoNasCarretasC[trailerid]+= 5;
DinheiroPelaCargaCombustivel[playerid] += 25;
TextDrawSetString(textTipoCarga[trailerid], "Carga: ~y~Combustivel");
format(str, 256, "Quantia: ~y~%d", CarregamentoNasCarretasC[trailerid]);
TextDrawSetString(textQuantiaCarga[trailerid], str);
format(str, 256, "Valor da carga: ~y~%d", DinheiroPelaCargaCombustivel[playerid]);
TextDrawSetString(textValorCarga[trailerid], str);
}
else if(CarregamentoNasCarretasC[trailerid] == 500)
{
TogglePlayerControllable(playerid, true);
GameTextForPlayer(playerid, "~n~~n~~n~~n~~n~~n~~y~Sua carreta esta~n~~w~100% ~g~carregada!", 10000, 3);
KillTimer(timerCarregamento);
}
}
else
{
if(CarregamentoNasCarretasC[trailerid] == 0)
{
TextDrawSetString(textTipoCarga[trailerid], "Carga: ~y~Desengatada");
TextDrawSetString(textQuantiaCarga[trailerid], "Quantia: ~y~Vaziu");
TextDrawSetString(textValorCarga[trailerid], "Valor carga: ~y~Nada");
}
}
}
return 1;
}
obviamente depois que eu concertar, irei por tudo certinho em seus respectivos locais adequados de acordo com o GM, esse sistema й apenas para testes das funзхes.
Aqui seguem as imagens, eu cheguei atй por em Mensagem pro player, pra verificar se as funзхes estavam funcionando, porйm estб tudo funcionando menos a parte dos textdraws, jб tentei alterar vбrias funзхes e codes, mas nгo adiantou de nada sinceramente nгo sei o que estб errado
A parte dos textdraws eu jб criei um timer pra atualizar. nгo precisa mais disso nгo