dcmd not work
#1

what wrong here??
pawn Код:
dcmd_tele(playerid, params[])
{
    new cordx,cordy,cordz;
    if(sscanf(params, "ud",cordx,cordy,cordz)) return SendClientMessage(playerid,0xFF0000FF, "[aiuto]: /tele[x][y][z]");
    SendClientMessage(playerid,0xFF9900AA,"coord=%d %d %d",cordx,cordy,cordz);
    return SetPlayerPos(playerid,cordx,cordy,cordz);
}
Reply
#2

Did you add
pawn Код:
dcmd(tele, 4, cmdtext);
Under OnPlayerCommandText ?

EDIT:

Alse you might want to create a string for the "SendClientMessage". Like this:
pawn Код:
new String[256];
format(String, sizeof(String), "cord= %s, %s, %s.", cordx, cordy, cordz);
SendClientMessage(playerid, Color, String);
Reply
#3

Format the string before sending it
https://sampwiki.blast.hk/wiki/Format
Reply
#4

okay i make this
pawn Код:
dcmd_teleporto(playerid, params[])
{
    new cordx,cordy,cordz;
    new text[128];
    if(sscanf(params, "ud",cordx,cordy,cordz)) return SendClientMessage(playerid,0xFF0000FF, "[aiuto]: /teleporto [x][y][z]");
    format(text,sizeof(text),"[cord]: %d %d %d",cordx,cordy,cordz);
    SendClientMessage(playerid,0xFF9900AA,text);
    return SetPlayerPos(playerid,cordx,cordy,cordz);
}
but dont teleport me
Reply
#5

Why are you using "ud" as string in sscanf?
You're using 3 decimals now so you have to do "ddd".
Reply
#6

Coordinates are floats and you need to change the data type definition in sscanf to fff, which represents 3 floats (x, y, z). But you can still use integers, since nobodys gonna bother typing floats in a command
Reply
#7

Код:
dcmd_teleporto(playerid, params[])
{
    	new Float:cordx, Float:cordy, Float:cordz;
    	if(sscanf(params, "fff",cordx, cordy, cordz)) 
		return SendClientMessage(playerid, 0xFF0000FF, "[aiuto]: /teleporto [x][y][z]");

	new string[64];
    	format(text, sizeof(text), "[cord]: %.4f %.4f %.4f",cordx, cordy, cordz);
    	SendClientMessage(playerid, 0xFF9900AA, text);
	SetPlayerPos(playerid, cordx, cordy, cordz);
	return 1;
}
I can't understand how you even compiled the previous code.
Reply
#8

omg i typed /teleporto 281.1523 2527.4270 16.8029 and teleport me to 1132341 2424124 46616166 wtF?
Reply
#9

Quote:
Originally Posted by WackoX
Посмотреть сообщение
Код:
dcmd_teleporto(playerid, params[])
{
    	new Float:cordx, Float:cordy, Float:cordz;
    	if(sscanf(params, "fff",cordx, cordy, cordz)) 
		return SendClientMessage(playerid, 0xFF0000FF, "[aiuto]: /teleporto [x][y][z]");

	new string[64];
    	format(text, sizeof(text), "[cord]: %.4f %.4f %.4f",cordx, cordy, cordz);
    	SendClientMessage(playerid, 0xFF9900AA, text);
	SetPlayerPos(playerid, cordx, cordy, cordz);
	return 1;
}
I can't understand how you even compiled the previous code.
Like i said.
Reply
#10

yea thx now work fine
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)