Works only with id 0.
#1

Hi there ! My /goto command works only for id 0, so you can teleport only to the person with id 0 .
Reply
#2

Show us the command.
Reply
#3

And your code?
Reply
#4

Fuck, I forgot to put it .
Код:
CMD:goto(playerid, params[])
{
	if(IsPlayerConnected(playerid))
	{
	    new toplayerid, Float:pos[3];

		GetPlayerPos(toplayerid, pos[0], pos[1], pos[2]);
 		
 		if (toplayerid != INVALID_PLAYER_ID)
 		{
   			if(!sscanf(params, "i", toplayerid))
			{
	    	    SetPlayerPos(playerid, pos[0], pos[1], pos[2]);
			} else SendClientMessage(playerid, color_grey, "UTILIZARE:/goto <id>");
		}
	} else SendClientMessage(playerid, color_grey, "Acest jucator nu este connectat");
	return 1;
}
Reply
#5

Your code is wrong.

PHP код:
CMD:goto(playeridparams[]) {
    new 
toplayeridFloat:pos[3];
    if(
sscanf(params"u"toplayerid)) return SendClientMessage(playeridcolor_grey"UTILIZARE:/goto <id>"); //You can do /goto <name or ID> now.
    
if(!IsPlayerConnected(toplayerid)) return SendClientMessage(playeridcolor_grey"Acest jucator nu este connectat");
    
GetPlayerPos(toplayeridpos[0], pos[1], pos[2]);
    
SetPlayerPos(playeridpos[0], pos[1], pos[2]);
    return 
1;

Reply
#6

If it compiles then it`s not wrong.. Just doing what isn`t expected of it.

Analyze the flow of logic. On line 7, you're always reading the position of player 0, because toplayerid will always be 0 at that point, since it was declared just a line above - the actual is written to it only later.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)