Help with command to get player pos -
Reiikz - 06.05.2018
i'm trying to tell player's pos in the chat but it retrieves empty floats
any idia why this doesn't work?
Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
if(strcmp(cmdtext, "/pos", true) == 0)
{
new Float:x, Float:y, Float:z, string[50];
GetPlayerPos(playerid, x, y, z);
format(string, sizeof(string), "x: %f, y: %f, z: %f", x, y, z);
SendClientMessage(playerid, 0xFFFFFFAA, string);
}
return 1;
}
Re: Help with command to get player pos -
Osamakurdi - 06.05.2018
Quote:
Originally Posted by Reiikz
i'm trying to tell player's pos in the chat but it retrieves empty floats
any idia why this doesn't work?
Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
if(strcmp(cmdtext, "/pos", true, 4) == 0)
{
new Float:x, Float:y, Float:z, string[50];
GetPlayerPos(playerid, x, y, z);
format(string, sizeof(string), "x: %f, y: %f, z: %f", x, y, z);
SendClientMessage(playerid, 0xFFFFFFAA, string);
}
return 1;
}
|
Do these changes and tell me what it says on console
Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
if(strcmp(cmdtext, "/pos", true) == 0)
{
new Float:x, Float:y, Float:z, string[50];
GetPlayerPos(playerid, x, y, z);
printf("x:%f, y:%f, z:%f", x, y, z);
format(string, sizeof(string), "x: %f, y: %f, z: %f", x, y, z);
SendClientMessage(playerid, 0xFFFFFFAA, string);
}
return 1;
}
Re: Help with command to get player pos -
insus100 - 06.05.2018
Use a larger string like 256 characters instead of 50.
Re: Help with command to get player pos -
Lokii - 06.05.2018
wired works for me!
Quote:
Originally Posted by insus100
Use a larger string like 256 characters instead of 50.
|
No! 50 is enough theres no need for 256!
this req 44 cells
Код:
x: 1.11111111, y: 1.11111111, z: 1.11111111
also even if the cells wernt enough it would still display
for example instead off
Код:
x: 1.11111111, y: 1.11111111, z: 1.11111111
it would display
Код:
x: 1.11111111, y: 1.11111
Re: Help with command to get player pos -
Reiikz - 06.05.2018
Quote:
Originally Posted by Lokii
wired works for me!
No! 50 is enough theres no need for 256!
this req 44 cells
Код:
x: 1.11111111, y: 1.11111111, z: 1.11111111
also even if the cells wernt enough it would still display
for example instead off
Код:
x: 1.11111111, y: 1.11111111, z: 1.11111111
it would display
Код:
x: 1.11111111, y: 1.11111
|
i'm using a similar variable on a filterscript that was the problem, i removed temporarily the filterscript and it worked, thanks, i'm so stupid for creating a thread just for this
Re: Help with command to get player pos -
insus100 - 06.05.2018
Yeah, I thought his message displayed more characters like "Your pos is blahblahblah" but only displays the coords, I was wrong.
Re: Help with command to get player pos -
Dayrion - 06.05.2018
Quote:
Originally Posted by Reiikz
i'm using a similar variable on a filterscript that was the problem, i removed temporarily the filterscript and it worked, thanks, i'm so stupid for creating a thread just for this
|
We all started one day, there is no stupid question from a sensible person.
Re: Help with command to get player pos -
HoussemKeyCo - 06.05.2018
Why people still use strcmp for commands, use ZCMD or YCMD.