Position
#1

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

Reply
#2

Код:
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);
       
}
Reply
#3

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
Reply
#4

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;

    }
Reply
#5

Ok thanks for your help guys ;o

All good.
Reply
#6

hey! Thats cool! Thaaanks
Reply
#7

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;

	}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)