Help with teleporting
#1

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

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

That whill teleport all players?
Reply
#4

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
Reply
#5

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.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)