NEED SOME HELP HERE! :) -
VanillaRain - 12.05.2012
i have this code
Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp("/coordinates", cmdtext, true, 10) == 0)
{
new String[231];
new Float:x, Float:y, Float:z;
GetPlayerPos(playerid, x, y, z);
format(String, sizeof(String), "Your coordinates are %s", GetPlayerPos(playerid, x, y, z)-1);
SendClientMessage(playerid, 0x33FF33AA, String);
return 1;
}
return 0;
}
and what i want is when i type /coordinates the server say to me "Your coordinates are X Y Z" of course the X -Y - Z must be numbers
the code i have writed above will do this work or is wrong? thanx to everybody!
Re: NEED SOME HELP HERE! :) -
CoaPsyFactor - 12.05.2012
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp("/coordinates", cmdtext, true, 10) == 0)
{
new String[231];
new Float:x, Float:y, Float:z;
GetPlayerPos(playerid, x, y, z);
format(String, sizeof(String), "Your coordinates are %f %f %f", x-1, y-1, z-1);
SendClientMessage(playerid, 0x33FF33AA, String);
return 1;
}
return 0;
}
Re: NEED SOME HELP HERE! :) -
VanillaRain - 12.05.2012
Quote:
Originally Posted by CoaPsyFactor
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[]) {
if (strcmp("/coordinates", cmdtext, true, 10) == 0) { new String[231]; new Float:x, Float:y, Float:z; GetPlayerPos(playerid, x, y, z); format(String, sizeof(String), "Your coordinates are %f %f %f", x-1, y-1, z-1); SendClientMessage(playerid, 0x33FF33AA, String); return 1; } return 0; }
|
i will try it and test if it works REP+ for sure!
EDIT: man i love you! you make my day it works great! thanx! REP+
Re: NEED SOME HELP HERE! :) -
CoaPsyFactor - 12.05.2012
it will work, but I am not sure what did you want with this -1

, this will print your position - 1.
Re: NEED SOME HELP HERE! :) -
VanillaRain - 12.05.2012
it is for know where am i, and in my server i have an island but i don't know it's coordinates and i want to add object with this filterscript i can know the coordinates and add objects where i want.. if i want the exact coordinates i must remove the "-1" from each variables (x-y-z)
Re: NEED SOME HELP HERE! :) -
CoaPsyFactor - 12.05.2012
yes yes, remove -1 from x y and z for exact coords
Re: NEED SOME HELP HERE! :) -
RedWingz - 12.05.2012
Why don't you use ZCMD ? It's much faster than STRCMP:
pawn Код:
COMMAND:coordinates(playerid, params[])
{
new String[231];
new Float:x, Float:y, Float:z;
GetPlayerPos(playerid, x, y, z);
format(String, sizeof(String), "Your coordinates are %f %f %f", x-1, y-1, z-1);
SendClientMessage(playerid, 0x33FF33AA, String);
return 1;
}