SA-MP Forums Archive
/gethere & /gotoplayer - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: /gethere & /gotoplayer (/showthread.php?tid=403283)



/gethere & /gotoplayer - Vinninho - 29.12.2012

Hey there, I tried to make 2 commands with ZCMD but whatever I try it keeps failing.

Therefor I post this request;

/gethere
This should bring a player infront of me.

/gotoplayer
This should teleport me infront of the desired id.

I tried something, but I'm not sure what I'm doing wrong.

Here is the code:

Код:
CMD:gethere(playerid, params[])
{
   	if(sscanf(params, "ui", playerid)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /gethere [playerid]");
	new Float:plocx,Float:plocy,Float:plocz;
    if(PInfo[playerid][Level] <1) return SendClientMessage(playerid, C_RED, "You're not authorized to use this command!");
    if(!IsPlayerConnected(playerid)) return SendClientMessage(playerid, C_RED, "This player is not connected");
	SetPlayerPos(GetPlayerPos(playerid, plocx, plocy, plocz),plocx,plocy+2, plocz);
	return 1;
}
Thank you in advance!


Re: /gethere & /gotoplayer - Vinninho - 29.12.2012

The gethere worked, but I need to the /gotoid badly.


Re: /gethere & /gotoplayer - Alternative112 - 29.12.2012

Код:
if(sscanf(params, "ui", playerid))
You are telling sscanf to get 2 variables (a username and an int), but all you should need is the player's ID. So get rid of the u in that line and see if it works.

EDIT: Beat me to it. using /goto can be made very similarly to the /gethere, all you would really need to change is this:

Код:
SetPlayerPos(playerid, plocx, plocy+2, plocz);



Re: /gethere & /gotoplayer - Vinninho - 29.12.2012

Quote:
Originally Posted by Alternative112
Посмотреть сообщение
Код:
if(sscanf(params, "ui", playerid))
You are telling sscanf to get 2 variables (a username and an int), but all you should need is the player's ID. So get rid of the u in that line and see if it works.
Thanks for your reply, my friend rescripted it for me . So, it's fine now!