16.08.2013, 20:56
Olб a todos, o meu problema й o seguinte eu fiz um velocimetro para o meu server, testei mas um amigo e ele funcionava lindamente mas depois no server ele acabou por bugar e desaparecer , alguem me pode explicar o que poderia ser?
Obrigado desde ja
pawn Код:
//------------------------------Velocimetro---------
new TimerVelocimetro[MAX_PLAYERS];
new Text:Textdraw0[MAX_PLAYERS];
new Text:Textdraw1[MAX_PLAYERS];
new Text:Textdraw2[MAX_PLAYERS];
new Text:Textdraw3[MAX_PLAYERS];
new Text:Textdraw4[MAX_PLAYERS];
new Text:Textdraw5[MAX_PLAYERS];
new Text:Textdraw6[MAX_PLAYERS];
new Text:Textdraw7[MAX_PLAYERS];
new Text:Textdraw8[MAX_PLAYERS];
new Text:Textdraw9[MAX_PLAYERS];
new Text:Textdraw10[MAX_PLAYERS];
//-----------------VELOCIMETRO----------------------
Textdraw0[playerid] = TextDrawCreate(244.000000, 352.000000, "0");
TextDrawBackgroundColor(Textdraw0[playerid], 255);
TextDrawFont(Textdraw0[playerid], 1);
TextDrawLetterSize(Textdraw0[playerid], 6.749995, 24.000000);
TextDrawColor(Textdraw0[playerid], 255);
TextDrawSetOutline(Textdraw0[playerid], 0);
TextDrawSetProportional(Textdraw0[playerid], 1);
TextDrawSetShadow(Textdraw0[playerid], 1);
Textdraw1[playerid] = TextDrawCreate(244.000000, 371.000000, "0");
TextDrawBackgroundColor(Textdraw1[playerid], 255);
TextDrawFont(Textdraw1[playerid], 1);
TextDrawLetterSize(Textdraw1[playerid], 6.749995, 24.000000);
TextDrawColor(Textdraw1[playerid], 255);
TextDrawSetOutline(Textdraw1[playerid], 0);
TextDrawSetProportional(Textdraw1[playerid], 1);
TextDrawSetShadow(Textdraw1[playerid], 1);
Textdraw2[playerid] = TextDrawCreate(244.000000, 354.000000, "0");
TextDrawBackgroundColor(Textdraw2[playerid], 255);
TextDrawFont(Textdraw2[playerid], 1);
TextDrawLetterSize(Textdraw2[playerid], 6.749995, 24.000000);
TextDrawColor(Textdraw2[playerid], 255);
TextDrawSetOutline(Textdraw2[playerid], 0);
TextDrawSetProportional(Textdraw2[playerid], 1);
TextDrawSetShadow(Textdraw2[playerid], 1);
Textdraw3[playerid] = TextDrawCreate(305.000000, 402.000000, "Km/h~n~~n~");
TextDrawBackgroundColor(Textdraw3[playerid], 255);
TextDrawFont(Textdraw3[playerid], 1);
TextDrawLetterSize(Textdraw3[playerid], 0.260000, 1.000000);
TextDrawColor(Textdraw3[playerid], -1);
TextDrawSetOutline(Textdraw3[playerid], 0);
TextDrawSetProportional(Textdraw3[playerid], 1);
TextDrawSetShadow(Textdraw3[playerid], 1);
Textdraw4[playerid] = TextDrawCreate(301.000000, 413.000000, "100");
TextDrawBackgroundColor(Textdraw4[playerid], 255);
TextDrawFont(Textdraw4[playerid], 1);
TextDrawLetterSize(Textdraw4[playerid], 0.500000, 1.000000);
//TextDrawColor(Textdraw4, -16776961);
TextDrawSetOutline(Textdraw4[playerid], 0);
TextDrawSetProportional(Textdraw4[playerid], 1);
TextDrawSetShadow(Textdraw4[playerid], 1);
Textdraw5[playerid] = TextDrawCreate(286.000000, 422.000000, "Combustivel");
TextDrawBackgroundColor(Textdraw5[playerid], 255);
TextDrawFont(Textdraw5[playerid], 1);
TextDrawLetterSize(Textdraw5[playerid], 0.330000, 0.899999);
TextDrawColor(Textdraw5[playerid], -1);
TextDrawSetOutline(Textdraw5[playerid], 0);
TextDrawSetProportional(Textdraw5[playerid], 1);
TextDrawSetShadow(Textdraw5[playerid], 1);
Textdraw6[playerid] = TextDrawCreate(297.000000, 430.000000, "100%");
TextDrawBackgroundColor(Textdraw6[playerid], 255);
TextDrawFont(Textdraw6[playerid], 1);
TextDrawLetterSize(Textdraw6[playerid], 0.500000, 1.000000);
//TextDrawColor(Textdraw6, 16711935);
TextDrawSetOutline(Textdraw6[playerid], 0);
TextDrawSetProportional(Textdraw6[playerid], 1);
TextDrawSetShadow(Textdraw6[playerid], 1);
Textdraw7[playerid] = TextDrawCreate(269.000000, 434.000000, "");
TextDrawBackgroundColor(Textdraw7[playerid], 255);
TextDrawFont(Textdraw7[playerid], 1);
TextDrawLetterSize(Textdraw7[playerid], 0.500000, 1.000000);
TextDrawColor(Textdraw7[playerid], -16776961);
TextDrawSetOutline(Textdraw7[playerid], 0);
TextDrawSetProportional(Textdraw7[playerid], 1);
TextDrawSetShadow(Textdraw7[playerid], 1);
Textdraw8[playerid] = TextDrawCreate(361.000000, 434.000000, "");
TextDrawBackgroundColor(Textdraw8[playerid], 255);
TextDrawFont(Textdraw8[playerid], 1);
TextDrawLetterSize(Textdraw8[playerid], 0.500000, 1.000000);
TextDrawColor(Textdraw8[playerid], -16776961);
TextDrawSetOutline(Textdraw8[playerid], 0);
TextDrawSetProportional(Textdraw8[playerid], 1);
TextDrawSetShadow(Textdraw8[playerid], 1);
Textdraw9[playerid] = TextDrawCreate(305.000000, 448.000000, "I");
TextDrawBackgroundColor(Textdraw9[playerid], 255);
TextDrawFont(Textdraw9[playerid], 1);
TextDrawLetterSize(Textdraw9[playerid], 0.920000, -1.100000);
TextDrawColor(Textdraw9[playerid], -16776961);
TextDrawSetOutline(Textdraw9[playerid], 0);
TextDrawSetProportional(Textdraw9[playerid], 1);
TextDrawSetShadow(Textdraw9[playerid], 1);
Textdraw10[playerid] = TextDrawCreate(317.000000, 448.000000, "I");
TextDrawBackgroundColor(Textdraw10[playerid], 255);
TextDrawFont(Textdraw10[playerid], 1);
TextDrawLetterSize(Textdraw10[playerid], 0.920000, -1.100000);
TextDrawColor(Textdraw10[playerid], -16776961);
TextDrawSetOutline(Textdraw10[playerid], 0);
TextDrawSetProportional(Textdraw10[playerid], 1);
TextDrawSetShadow(Textdraw10[playerid], 1);
if(newstate == PLAYER_STATE_DRIVER || newstate == PLAYER_STATE_PASSENGER)
{
TextDrawShowForPlayer(playerid, Textdraw0[playerid]);
TextDrawShowForPlayer(playerid, Textdraw1[playerid]);
TextDrawShowForPlayer(playerid, Textdraw2[playerid]);
TimerVelocimetro[playerid] = SetTimerEx("VelocimetroP", 100, true, "u", playerid);
}
else if(oldstate == PLAYER_STATE_DRIVER || oldstate == PLAYER_STATE_PASSENGER)
{
TextDrawHideForPlayer(playerid,Textdraw0[playerid]);
TextDrawHideForPlayer(playerid,Textdraw1[playerid]);
TextDrawHideForPlayer(playerid,Textdraw2[playerid]);
TextDrawHideForPlayer(playerid,Textdraw3[playerid]);
TextDrawHideForPlayer(playerid,Textdraw4[playerid]);
TextDrawHideForPlayer(playerid,Textdraw5[playerid]);
TextDrawHideForPlayer(playerid,Textdraw6[playerid]);
TextDrawHideForPlayer(playerid,Textdraw7[playerid]);
TextDrawHideForPlayer(playerid,Textdraw8[playerid]);
TextDrawHideForPlayer(playerid,Textdraw9[playerid]);
TextDrawHideForPlayer(playerid,Textdraw10[playerid]);
KillTimer(TimerVelocimetro[playerid]);
}
forward VelocimetroP(playerid);
public VelocimetroP(playerid)
{
if(ShowFuel[playerid] && GetPlayerState(playerid) == PLAYER_STATE_DRIVER || GetPlayerState(playerid) == PLAYER_STATE_PASSENGER)
{
new carid = GetPlayerVehicleID(playerid);
if(GetVehicleModel(carid) == 481 || GetVehicleModel(carid) == 509 || GetVehicleModel(carid) == 510)
{
return 1;
}
//new form[128];
new vehicle = GetPlayerVehicleID(playerid);
GetVehicleVelocity(GetPlayerVehicleID(playerid), fPos[0], fPos[1], fPos[2]);
fSpeed = floatmul(floatsqroot(floatadd(floatpower(fPos[0], 2), floatadd(floatpower(fPos[1], 2), floatpower(fPos[2], 2)))), 140);
if(!OutOfFuel[playerid])
{
if(Fuel[vehicle] <= 25)
{
if(EngineStatus[vehicle])
{
TextDrawShowForPlayer(playerid, Textdraw0[playerid]);
TextDrawShowForPlayer(playerid, Textdraw1[playerid]);
TextDrawShowForPlayer(playerid, Textdraw2[playerid]);
TextDrawShowForPlayer(playerid, Textdraw3[playerid]);
new dt2[10];
format(dt2,sizeof(dt2),"~r~ %0.0f", fSpeed);
TextDrawShowForPlayer(playerid, Textdraw4[playerid]);
TextDrawSetString(Textdraw4[playerid], dt2);
TextDrawShowForPlayer(playerid, Textdraw5[playerid]);
new dt[10];
format(dt,sizeof(dt),"~r~ %d%", Fuel[vehicle]);
TextDrawShowForPlayer(playerid, Textdraw6[playerid]);
TextDrawSetString(Textdraw6[playerid], dt);
if(Seatbelt[playerid] == 0)
{
new dt3[10];
format(dt3,sizeof(dt3),"~r~C", Seatbelt[playerid]);
TextDrawShowForPlayer(playerid, Textdraw7[playerid]);
TextDrawSetString(Textdraw7[playerid], dt3);
} else {
new dt3[10];
format(dt3,sizeof(dt3),"~g~C", Seatbelt[playerid]);
TextDrawShowForPlayer(playerid, Textdraw7[playerid]);
TextDrawSetString(Textdraw7[playerid], dt3);
}
if(CarWindowStatus[GetPlayerVehicleID(playerid)] == 0)
{
new dt4[10];
format(dt4,sizeof(dt4),"~r~J");
TextDrawShowForPlayer(playerid, Textdraw8[playerid]);
TextDrawSetString(Textdraw8[playerid], dt4);
}
else
{
new dt5[10];
format(dt5,sizeof(dt5),"~g~J");
TextDrawShowForPlayer(playerid, Textdraw8[playerid]);
TextDrawSetString(Textdraw8[playerid], dt5);
}
TextDrawShowForPlayer(playerid, Textdraw9[playerid]);
TextDrawShowForPlayer(playerid, Textdraw10[playerid]);
//format(form, sizeof(form), "~w~~n~~n~~n~~n~~n~~n~~y~Motor a trabalhar.~n~~w~Gasolina:~g~ %d%~n~~r~Deposito de Reserva. ~n~~w~Velocidade:~g~ %0.0f KM/H",Fuel[vehicle], fSpeed);
//GameTextForPlayer(i,form,1000,5);//veloc.
}
else
{
//format(form, sizeof(form), "~w~~n~~n~~n~~n~~n~~n~~y~Motor desligado.~n~~w~Gasolina:~g~ %d%~n~~r~Deposito de Reserva. ~n~~w~Velocidade:~g~ %0.0f KM/H",Fuel[vehicle], fSpeed);
//GameTextForPlayer(i,form,1000,5);
TextDrawShowForPlayer(playerid, Textdraw0[playerid]);
TextDrawShowForPlayer(playerid, Textdraw1[playerid]);
TextDrawShowForPlayer(playerid, Textdraw2[playerid]);
}
}
else
{
if(EngineStatus[vehicle])
{
TextDrawShowForPlayer(playerid, Textdraw0[playerid]);
TextDrawShowForPlayer(playerid, Textdraw1[playerid]);
TextDrawShowForPlayer(playerid, Textdraw2[playerid]);
TextDrawShowForPlayer(playerid, Textdraw3[playerid]);
new dt2[10];
format(dt2,sizeof(dt2),"~r~ %0.0f", fSpeed);
TextDrawShowForPlayer(playerid, Textdraw4[playerid]);
TextDrawSetString(Textdraw4[playerid], dt2);
TextDrawShowForPlayer(playerid, Textdraw5[playerid]);
new dt[10];
format(dt,sizeof(dt),"~g~ %d%", Fuel[vehicle]);
TextDrawShowForPlayer(playerid, Textdraw6[playerid]);
TextDrawSetString(Textdraw6[playerid], dt);
if(Seatbelt[playerid] == 0)
{
new dt3[10];
format(dt3,sizeof(dt3),"~r~C", Seatbelt[playerid]);
TextDrawShowForPlayer(playerid, Textdraw7[playerid]);
TextDrawSetString(Textdraw7[playerid], dt3);
} else {
new dt3[10];
format(dt3,sizeof(dt3),"~g~C", Seatbelt[playerid]);
TextDrawShowForPlayer(playerid, Textdraw7[playerid]);
TextDrawSetString(Textdraw7[playerid], dt3);
}
if(CarWindowStatus[GetPlayerVehicleID(playerid)] == 0)
{
new dt4[10];
format(dt4,sizeof(dt4),"~r~J");
TextDrawShowForPlayer(playerid, Textdraw8[playerid]);
TextDrawSetString(Textdraw8[playerid], dt4);
}
else
{
new dt5[10];
format(dt5,sizeof(dt5),"~g~V");
TextDrawShowForPlayer(playerid, Textdraw8[playerid]);
TextDrawSetString(Textdraw8[playerid], dt5);
}
//format(form, sizeof(form), "~w~~n~~n~~n~~n~~n~~n~~y~Motor a trabalhar.~n~~w~Gasolina:~g~ %d% ~n~~w~Velocidade:~g~ %0.0f KM/H",Fuel[vehicle], fSpeed);
//GameTextForPlayer(i,form,1000,5);
}
else
{
//format(form, sizeof(form), "~w~~n~~n~~n~~n~~n~~n~~y~Motor desligado.~n~~w~Gasolina:~g~ %d% ~n~~w~Velocidade:~g~ %0.0f KM/H",Fuel[vehicle], fSpeed);
//GameTextForPlayer(i,form,1000,5);
TextDrawShowForPlayer(playerid, Textdraw0[playerid]);
TextDrawShowForPlayer(playerid, Textdraw1[playerid]);
TextDrawShowForPlayer(playerid, Textdraw2[playerid]);
}
}
}
}
return 1;
}
Obrigado desde ja