NEED SOME HELP HERE! :)
#1

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!

Reply
#2

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;
}
Reply
#3

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

it will work, but I am not sure what did you want with this -1 , this will print your position - 1.
Reply
#5

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)
Reply
#6

yes yes, remove -1 from x y and z for exact coords
Reply
#7

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;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)