[Ajuda]Velocimetro Gringo Causando erros inesplicaveis
#1

Bem galera , como aqui no fуrum possui poucos velocнmetros brasucas, resolvi ir na Internacional

Achei um уtimo velocнmetro , Chamado LuX Speedometer
Muita gente usa ele como por exemplo ele foi adaptado no servidor LAC do Poderoso Chefгo

E Aqui hбs o uma parte do cуdigo dele(A parte que eu nгo postei era o Nome dos veнculos e o Nome dos Locais [GPS])
Код:
public LuX_SpeedoMeterUp()
{
    new Float:LPosX;
	new Float:LPosY;
	new Float:LPosZ;
	new Float:PlayerSpeedDistance;
	new value;
	new Float:L_VehHealth;
	new LVehicleStatus[15];
	
	for(new i=0; i<PLAYERS; i++)
	{
	if(VehicleStatus[GetPlayerVehicleID(i)] == 1)
	{
	LVehicleStatus = "~r~Locked";
	}
	else
	{
	LVehicleStatus = "~g~Unlocked";
	}
	if(IsPlayerConnected(i) && IsPlayerInAnyVehicle(i))
	{
 	GetPlayerPos(i, LPosX, LPosY, LPosZ);
	GetPlayerVehicleID(i);
	GetVehicleHealth(GetPlayerVehicleID(i), L_VehHealth);
	PlayerSpeedDistance = floatsqroot(floatpower(floatabs(floatsub(LPosX,LuX_ReadPlayerPosition[i][ReadX])),2)+floatpower(floatabs(floatsub(LPosY,LuX_ReadPlayerPosition[i][ReadY])),2)+floatpower(floatabs(floatsub(LPosZ,LuX_ReadPlayerPosition[i][ReadZ])),2));
	value = floatround(PlayerSpeedDistance * 5000);
	new LuxZone[MAX_ZONE_NAME];
	GetPlayer2DZone(i, LuxZone, MAX_ZONE_NAME);
	if(LuX_SpeedoMeter[i] == 0){
	TextDrawShowForPlayer(i, LBox[i]);
    TextDrawShowForPlayer(i, LLine1[i]);
	TextDrawShowForPlayer(i, LLine2[i]);
	TextDrawShowForPlayer(i, LLine3[i]);
	TextDrawShowForPlayer(i, LLine4[i]);
	TextDrawShowForPlayer(i, LCredits[i]);
	TextDrawShowForPlayer(i, Lmph[i]);
    TextDrawShowForPlayer(i, LFunc[i]);
	LuX_SpeedoMeter[i] = 1;	}
	new LMPH = floatround(value/1600);
	new LKPH = floatround(value/1000);
	
	format(lstring,sizeof(lstring),"~b~Veiculo: ~w~%s~n~~b~Lataria: ~w~%.2f~n~~b~Altitude: ~w~%.1f~n~~b~Gps: ~w~%s~n~~b~Status: %s",LVehiclesName[GetVehicleModel(GetPlayerVehicleID(i))-400],L_VehHealth,LPosZ,LuxZone,LVehicleStatus);
	TextDrawSetString(LFunc[i], lstring);
	
	format(lstr,sizeof(lstr),"%sMPH: ~w~%d  %sKM/H: ~w~%d",MPH_KPH_Color,LMPH,MPH_KPH_Color,LKPH);
	TextDrawSetString(Lmph[i], lstr);
	
	if(L_VehHealth <= 500){
	format(lstring,sizeof(lstring),"%sVehicle: ~w~%s~n~%s\Health: ~w~~r~%.0f~n~%sAltitude: ~w~%.1f~n~%sGps: ~w~%s",CategoriesColor,LVehiclesName[GetVehicleModel(GetPlayerVehicleID(i))-400],CategoriesColor,L_VehHealth,CategoriesColor,LPosZ,CategoriesColor,LuxZone);
	TextDrawSetString(LFunc[i], lstring);
    }
   	if(LKPH >= VehicleMaxSpeed)
    {
	TogglePlayerControllable(i,0);
	LUnFreeze = SetTimer("LuX_UnFreezeCar", 250, 1);
	format(lstr,sizeof(lstr),"~g~MPH: ~w~%d  ~g~KM/H: ~r~%d",LMPH,LKPH);
	TextDrawSetString(Lmph[i], lstr);
    }
	}
	LuX_ReadPlayerPosition[i][ReadX] = LPosX, LuX_ReadPlayerPosition[i][ReadY] = LPosY, LuX_ReadPlayerPosition[i][ReadZ] = LPosZ;}
	for(new i=0; i<PLAYERS; i++){
	if(!IsPlayerInAnyVehicle(i)){
	TextDrawHideForPlayer(i, LBox[i]);
	TextDrawHideForPlayer(i, LLine1[i]);
	TextDrawHideForPlayer(i, LLine2[i]);
	TextDrawHideForPlayer(i, LLine3[i]);
	TextDrawHideForPlayer(i, LLine4[i]);
	TextDrawHideForPlayer(i, LCredits[i]);
	TextDrawHideForPlayer(i, Lmph[i]);
	TextDrawHideForPlayer(i, LFunc[i]);
	LuX_SpeedoMeter[i] = 0;
	}
	}
	return 1;
}
forward LuX_UnFreezeCar(playerid);
public LuX_UnFreezeCar(playerid)
{
for(new i=0; i<PLAYERS; i++)
{
TogglePlayerControllable(playerid,1);
KillTimer(LUnFreeze);
}
return 1;
}

public OnVehicleSpawn(vehicleid)
{
	LuX_ReadPosition(vehicleid);
	return 1;
}

public OnPlayerCommandText(playerid,cmdtext[])
{
	new cmd[128];
	new idx;
	
    cmd = strtok(cmdtext, idx);
	
	if(strcmp(cmd, "/lock", true) == 0)
	{
	new Float:X;
	new Float:Y;
	new Float:Z;
	
	if(IsPlayerConnected(playerid) && VehicleStatus[GetPlayerVehicleID(playerid)] == 0){
	new VehicleState = GetPlayerState(playerid);
	
	if(VehicleState == PLAYER_STATE_DRIVER){
	for(new v = 0; v <L_VEHICLE; v++)
	{
	if (v != playerid)
	{
	SetVehicleParamsForPlayer(GetPlayerVehicleID(playerid),v, 0, 1);
    }
	}
	SendClientMessage(playerid,AQUAGREEN, "***(LuxSpeedo): Vehicle Locked!");
	GetPlayerPos(playerid,X,Y,Z);
	PlayerPlaySound(playerid,1057,X,Y,Z);
	VehicleStatus[GetPlayerVehicleID(playerid)] = 1;
	SetTimerEx("LAutoUnlock",VehLockTime*60000,false,"i",GetPlayerVehicleID(playerid));
	}
	return 1;
	}
	}

	if(strcmp(cmd, "/unlock", true) == 0)
	{
	new Float:X;
	new Float:Y;
	new Float:Z;
	
	if(IsPlayerConnected(playerid) && VehicleStatus[GetPlayerVehicleID(playerid)] == 1)
	{
	new VehicleState = GetPlayerState(playerid);
	if(VehicleState == PLAYER_STATE_DRIVER)
	{
	for(new v = 0; v <L_VEHICLE; v++)
	{
	SetVehicleParamsForPlayer(GetPlayerVehicleID(playerid),v, 0, 0);
	}
	SendClientMessage(playerid,AQUAGREEN, "***(LuxSpeedo): Vehicle Unlocked!");
	GetPlayerPos(playerid,X,Y,Z);
	PlayerPlaySound(playerid,1057,X,Y,Z); VehicleStatus[GetPlayerVehicleID(playerid)] = 0;
	}
	return 1;
  	}
	}
	return 0;
}
	
public LAutoUnlock(vehicleid)
{
	for(new v = 0; v <L_VEHICLE; v++)
	{
	SetVehicleParamsForPlayer(vehicleid,v, 0, 0);
	}
	VehicleStatus[vehicleid] = 0;
}

public OnPlayerConnect(playerid)
{
	SendClientMessage(playerid,0x009D00AA,"*** This server uses the Lux Speedometer v2.0");
	return 1;
}

strtok(const string[], &index)
{
	new length = strlen(string);
	while ((index < length) && (string[index] <= ' ')) { index++; }
	new offset = index; new result[20];
	while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))
	{ result[index - offset] = string[index]; index++; }
	result[index - offset] = EOS; return result;
}

stock LuX_DistanceToPoint(vehicleid)
{
	new Float:LPlayerX, Float:LPlayerY, Float:LPlayerZ, Float:LReadPos;
	GetVehiclePos(vehicleid, LPlayerX, LPlayerY, LPlayerZ);
	LReadPos = floatsqroot(floatpower(floatabs(floatsub(LPlayerX, VehPosX[vehicleid])), 2)+floatpower(floatabs(floatsub(LPlayerY, VehPosY[vehicleid])), 2)+floatpower(floatabs(floatsub(LPlayerZ, VehPosZ[vehicleid])), 2));
	return floatround(LReadPos);
}

stock LuX_ReadPosition(vehicleid)
{
    new Float:LReadX, Float:LReadY, Float:LReadZ;
    GetVehiclePos(vehicleid, LReadX, LReadY, LReadZ);
	VehPosX[vehicleid]=LReadX; VehPosY[vehicleid]=LReadY; VehPosZ[vehicleid]=LReadZ;
}

stock PlayerZone(playerid, zone[])
{
	new ReadTmpZone[MAX_ZONE_NAME];
    GetPlayer3DZone(playerid, ReadTmpZone, sizeof(ReadTmpZone)); for(new i = 0; i != sizeof(SanAndreasZones); i++){
	if(strfind(ReadTmpZone, zone, true) != -1)
	return 1;
	}
	return 0;
}


stock GetPlayer2DZone(playerid, zone[], len)
{
	new Float:x, Float:y, Float:z;
	GetPlayerPos(playerid, x, y, z);
 	for(new i = 0; i != sizeof(SanAndreasZones); i++ ){
	if(x >= SanAndreasZones[i][Zone_Area][0] && x <= SanAndreasZones[i][Zone_Area][3] && y >= SanAndreasZones[i][Zone_Area][1] && y <= SanAndreasZones[i][Zone_Area][4]){
	return format(zone, len, SanAndreasZones[i][Zone_Name], 0);}
	}
	return 0;
}
stock GetPlayer3DZone(playerid, zone[], len)
{
	new Float:x, Float:y, Float:z;
	GetPlayerPos(playerid, x, y, z);
 	for(new i = 0; i != sizeof(SanAndreasZones); i++ ){
	if(x >= SanAndreasZones[i][Zone_Area][0] && x <= SanAndreasZones[i][Zone_Area][3] && y >= SanAndreasZones[i][Zone_Area][1] && y <= SanAndreasZones[i][Zone_Area][4] && z >= SanAndreasZones[i][Zone_Area][2] && z <= SanAndreasZones[i][Zone_Area][5]){return format(zone, len, SanAndreasZones[i][Zone_Name], 0);
	}
	}
	return 0;
}
Apresenta-se o erro : Invalid Characeter Constant
SENDO QUE EU NВO ALTEREI NADAAA!1!

Nesta linha :
Код:
format(lstring,sizeof(lstring),"%sVehicle: ~w~%s~n~%s\Health: ~w~~r~%.0f~n~%sAltitude: ~w~%.1f~n~%sGps: ~w~%s",CategoriesColor,LVehiclesName[GetVehicleModel(GetPlayerVehicleID(i))-400],CategoriesColor,L_VehHealth,CategoriesColor,LPosZ,CategoriesColor,LuxZone);
Aguardo que alguem possa me ajudar !!
Reply
#2

substituir por esse
pawn Код:
format(lstring,sizeof(lstring),"%sVehicle: ~w~%s~n~%sHealth: ~w~~r~%.0f~n~%sAltitude: ~w~%.1f~n~%sGps: ~w~%s",CategoriesColor,LVehiclesName[GetVehicleModel(GetPlayerVehicleID(i))-400],CategoriesColor,L_VehHealth,CategoriesColor,LPosZ,CategoriesColor,LuxZone);
Reply
#3

Meu Compilador Pawno parece ter vida prуpria!
Nгo alterei nada e tentei novamente e Compilou normalmente!
This forum requires that you wait 60 seconds between posts. Please try again in 16 seconds.
Reply
#4

Pode fechar o Tуpico , Problema resolvido!
Obrigado Leandro!!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)