SA-MP Forums Archive
Help with teleporting - 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: Help with teleporting (/showthread.php?tid=561325)



Help with teleporting - leon14032002 - 02.02.2015

I want to teleport all players but I didn t find comand for that. Can somebody tell me which is?


AW: Help with teleporting - Nero_3D - 02.02.2015

A loop and SetPlayerPos should do the job
pawn Код:
SetPos(Float: X, Float: Y, Float: Z) {
    for(new i; i != MAX_PLAYERS; ++i) {
        SetPlayerPos(i, X, Y, Z);
    }
}
Information

https://sampwiki.blast.hk/wiki/SetPlayerPos
https://sampwiki.blast.hk/wiki/Control_Structures#Loops

Now you only need to put it inside a command


Re: Help with teleporting - leon14032002 - 02.02.2015

That whill teleport all players?


Re: Help with teleporting - RedCode - 02.02.2015

You need to have admin system.

Код:
#include <a_samp>
#include <zcmd>

CMD:getall(playerid,params[])
{
    #pragma unused params
	if(AccInfo[playerid][Level] >= 4)
	{
		SendCommandToAdmins(playerid,"GetAll");
		new Float:x,Float:y,Float:z, interior = GetPlayerInterior(playerid);
    	GetPlayerPos(playerid,x,y,z);
	   	for(new i = 0; i < MAX_PLAYERS; i++)
  		{
		if(IsPlayerConnected(i) && (i != playerid) && i != ServerInfo[MaxAdminLevel])
		{
		PlayerPlaySound(i,1057,0.0,0.0,0.0);
		SetPlayerPos(i,x+(playerid/4)+1,y+(playerid/4),z);
		SetPlayerInterior(i,interior);
		}
		}
		new string[128];
		format(string,sizeof(string),"|- Administrator \"%s\" has Teleported all players -|", pName(playerid));
		return SendClientMessageToAll(blue, string);
	}
	else return ErrorMessages(playerid, 5);
}
This is from luxadmin


Re: Help with teleporting - CalvinC - 02.02.2015

Yes, a loop will loop through all players, and in that case make everyone "i".
Then you use SetPlayerPos on "i" which will teleport everybody.