SA-MP Forums Archive
Position - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Position (/showthread.php?tid=74774)



Position - TaMeD - 25.04.2009

Wow, i'm quite ashamed i have to post this, but i haven't found any posts like it..

(7140) : error 029: invalid expression, assumed zero

Код:
	if(strcmp(cmdtext, "/whereami", true) == 0)
	{
		new Float:px, Float:py, Float:pz;
		GetPlayerPos(playerid, px, py, pz);
		new wherestring[30];
		format(wherestring[],sizeof(wherestring[]),"** Position: %f %f %f", px, py, pz);
		SendClientMessage(playerid, GROVE, wherestring);
		
	}
First line is line 7135




Re: Position - pen_theGun - 25.04.2009

Код:
format(wherestring[],sizeof(wherestring[]),"** Position: %f %f %f", px, py, pz); <------
pawn Код:
if(strcmp(cmdtext, "/whereami", true) == 0)
{
    new Float:px, Float:py, Float:pz;
    GetPlayerPos(playerid, px, py, pz);
    new wherestring[30];
    format(wherestring,sizeof(wherestring),"** Position: %f %f %f", px, py, pz);
    SendClientMessage(playerid, COLOR_xGREYx, wherestring);
       
}



Re: Position - TaMeD - 26.04.2009

Ok, I that fixed the errors, however, it doesn't show all coordinates.
pawn Код:
if(strcmp(cmdtext, "/whereami", true) == 0)
    {
        new Float:px, Float:py, Float:pz;
        GetPlayerPos(playerid, px, py, pz);
        new wherestring[30];
        format(wherestring,sizeof(wherestring),"** Position: X: %f Y: %f Z: %f **", px, py, pz);
        SendClientMessage(playerid, GROVE, wherestring);
        return 1;

    }


As you can see, it only shows the X coordinate


Re: Position - Backwardsman97 - 26.04.2009

Because the string is bigger than 30 characters.

pawn Код:
if(strcmp(cmdtext, "/whereami", true) == 0)
    {
        new Float:px, Float:py, Float:pz;
        GetPlayerPos(playerid, px, py, pz);
        new wherestring[128];
        format(wherestring,sizeof(wherestring),"** Position: X: %f Y: %f Z: %f **", px, py, pz);
        SendClientMessage(playerid, GROVE, wherestring);
        return 1;

    }



Re: Position - TaMeD - 26.04.2009

Ok thanks for your help guys ;o

All good.


Re: Position - Jaykay1979 - 01.08.2009

hey! Thats cool! Thaaanks


Re: Position - [KMA]Lord_Deji - 17.11.2009

i took your codes and edited them
i end up with this witch work well
i know you prefer to put "GROVE" green color but i put white on mine
Код:
	if(strcmp(cmdtext, "/whereami", true) == 0 && IsPlayerAdmin(playerid))
	{
		new Float:px, Float:py, Float:pz;
		GetPlayerPos(playerid, px, py, pz);
		new wherestringx[30];
		new wherestringy[30];
		new wherestringz[30];
		format(wherestringx,sizeof(wherestringx),"** Position: X: %f **", px);
		format(wherestringy,sizeof(wherestringy),"** Position: Y: %f **", py);
		format(wherestringz,sizeof(wherestringz),"** Position: Z: %f **", pz);
        SendClientMessage(playerid, COLOR_WHITE, "Your Coordinate are also display in host console");
		SendClientMessage(playerid, COLOR_WHITE, wherestringx);
		SendClientMessage(playerid, COLOR_WHITE, wherestringy);
		SendClientMessage(playerid, COLOR_WHITE, wherestringz);
		print(wherestringx);
		print(wherestringy);
		print(wherestringz);
		return 1;

	}