Jump to content

Question

Posted

Problema intalnita (descriere): Am o problema la acest script . dar in loc sa imi calculeze distanta din punctul unde sunt eu pana in checkpoint si sa imi scada din distanta mie imi creste .
Ero(area / rile) / warning-(ul / urile):
Liniile de cod / sursa / script-ul(obligatoriu):

forward Distance(playerid, Float:X, Float:Y, Float:Z);
public Distance(playerid, Float:X, Float:Y, Float:Z)
{
    new Float: fDistance = GetPlayerDistanceFromPoint(playerid, X, Y, Z)/1000;

    new Str[100];
    format(Str, 100, "~w~Mai ai %0.1f km de parcurs)", fDistance);
    //TextDrawSetString(InfoTD, Str);
    PlayerTextDrawSetString(playerid, InfoTD, Str);
}

Si aici este checkpoint-ul

					SetPlayerCheckpoint(playerid, 2700.3777, -2388.7659, 13.7271, 3.0);
					PlayerTextDrawShow(playerid, InfoTD);
					SetTimerEx("Distance", 1000, true, "iiii", playerid,  X, Y, Z);


Imagini / Video (optional):
Ati incercat sa rezolvati singur?:

14 answers to this question

Recommended Posts

  • 0
Posted

Incearca asa.

 

forward Distance(playerid, Float:X, Float:Y, Float:Z);
public Distance(playerid, Float:X, Float:Y, Float:Z)
{
    new Float:fDistance = GetPlayerDistanceFromPoint(playerid, Float:X, Float:Y, Float:Z), TextDrawText[64];
    format(TextDrawText, sizeof(TextDrawText), "~w~Mai ai %0.1f km de parcurs", fDistance / 100.0);
    TextDrawSetString(InfoTD[playerid], fDistance);
}

 

j3V8Znq.png

5IGyOAw.png

  • 0
Posted

erorare la aceasta linie

TextDrawSetString(InfoTD[playerid], fDistance);

D:\eXtraGaming\gamemodes\extragaming.pwn(12231) : error 028: invalid subscript (not an array or too many subscripts): "InfoTD"
D:\eXtraGaming\gamemodes\extragaming.pwn(12231) : warning 215: expression has no effect
D:\eXtraGaming\gamemodes\extragaming.pwn(12231) : error 001: expected token: ";", but found "]"
D:\eXtraGaming\gamemodes\extragaming.pwn(12231) : error 029: invalid expression, assumed zero
D:\eXtraGaming\gamemodes\extragaming.pwn(12231) : fatal error 107: too many error messages on one line
 

  • 0
Posted
forward Distance(playerid, Float:X, Float:Y, Float:Z);
public Distance(playerid, Float:X, Float:Y, Float:Z)
{
    new Float:fDistance = GetPlayerDistanceFromPoint(playerid, Float:X, Float:Y, Float:Z), TextDrawText[64];
    format(TextDrawText, sizeof(TextDrawText), "~w~Mai ai %0.1f km de parcurs", fDistance / 100.0);
    PlayerTextDrawSetString(playerid, InfoTD, fDistance);
}

 

j3V8Znq.png

5IGyOAw.png

  • 0
Posted (edited)
SetTimerEx("Distance", 1000, true, "ifff", playerid,  X, Y, Z);

iiii -> ifff

Edited by Spman
  • 0
Posted

In loc de 

SetTimerEx("Distance", 1000, true, "iiii", playerid,  X, Y, Z);

pune 

SetTimer("Distance",1000,1);

j3V8Znq.png

5IGyOAw.png

  • 0
Posted

la fel ... creste ... aici este codul complet .

 

         		case 0:
           		{
            		DisablePlayerCheckpoint(playerid);
					SetPlayerCheckpoint(playerid, 2700.3777, -2388.7659, 13.7271, 3.0);
					PlayerTextDrawShow(playerid, InfoTD);
					SetTimer("DistantaTrucker",1000,1);
					Traseu[playerid] = 1;
					CPT[playerid] = 2;
     			}
public DistantaTrucker(playerid, Float:X, Float:Y, Float:Z)
{
    new Float: fDistance = GetPlayerDistanceFromPoint(playerid, X, Y, Z)/100.0;

    new Str[100];
    format(Str, 100, "~w~Mai ai de parcurs~w~ ~n~ ~y~(%0.1f km)", fDistance);
    //TextDrawSetString(InfoTD, Str);
    PlayerTextDrawSetString(playerid, InfoTD, Str);
}

 

  • 0
Posted (edited)
On ‎2016‎/‎03‎/‎09 at 15:05, EquiNox said:

In loc de 


SetTimerEx("Distance", 1000, true, "iiii", playerid,  X, Y, Z);

pune 


SetTimer("Distance",1000,1);

 

13 hours ago, kiLLers10 said:

Uuuuuuuppppp

ai gresit parametri...uita-te pe wiki, la functia GetPlayerDistanceFromPoint e %0.2f  nu %0.1f

Edited by DaEdRiC-FoX

**********************************

Servicii Scripting de calitate:

*********************************

Future Project: ExpertGame

*********************************

  • 0
Posted
new Text:Textdraw0;
new Text:Textdraw1;
new timer;

	Textdraw0 = TextDrawCreate(287.200042, 411.413330, "");
	TextDrawLetterSize(Textdraw0, 0.343599, 1.308799);
	TextDrawAlignment(Textdraw0, 1);
	TextDrawColor(Textdraw0, -1061109505);
	TextDrawSetShadow(Textdraw0, 0);
	TextDrawSetOutline(Textdraw0, 1);
	TextDrawBackgroundColor(Textdraw0, 51);
	TextDrawFont(Textdraw0, 1);
	TextDrawSetProportional(Textdraw0, 1);

	Textdraw1 = TextDrawCreate(312.799804-15, 427.093414, "");
	TextDrawLetterSize(Textdraw1, 0.314799, 1.338666);
	TextDrawAlignment(Textdraw1, 1);
	TextDrawColor(Textdraw1, -5963521);
	TextDrawSetShadow(Textdraw1, 0);
	TextDrawSetOutline(Textdraw1, 1);
	TextDrawBackgroundColor(Textdraw1, 51);
	TextDrawFont(Textdraw1, 1);
	TextDrawSetProportional(Textdraw1, 1);


public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
 	timer = SetTimerEx("GPSTimer", 1000, 1, "ifff", playerid, 1608.4177, -2150.9133, 13.4771);
	return 1;
}

public OnPlayerExitVehicle(playerid, vehicleid)
{
	KillTimer(timer);
	return 1;
}

forward GPSTimer(playerid, Float:xpos, Float:ypos, Float:zpos);
public GPSTimer(playerid, Float:xpos, Float:ypos, Float:zpos)
{
	new newstate = GetPlayerState(playerid);
    if(newstate == PLAYER_STATE_DRIVER)
    {
        new str[129], Float:dist;
        TextDrawShowForPlayer(playerid, Textdraw0);
        TextDrawSetString(Textdraw0, "Distanta pana la punctu rosu:");
		dist = GetPlayerDistanceFromPoint(playerid, xpos, ypos, zpos);
        format(str, sizeof(str), "(Ocean Docs - %d Metri)", floatround(dist, floatround_round));
        TextDrawShowForPlayer(playerid, Textdraw1);
        TextDrawSetString(Textdraw1, str);
	}
	else
	{
	    TextDrawHideForPlayer(playerid, Textdraw0);
	    TextDrawHideForPlayer(playerid, Textdraw1);
	}
	return 1;
}

 

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more details you can also review our Terms of Use and Privacy Policy.