PDA

View Full Version : Help with teleporting


leon14032002
02/02/2015, 03:27 PM
I want to teleport all players but I didn t find comand for that. Can somebody tell me which is?

Nero_3D
02/02/2015, 04:38 PM
A loop and SetPlayerPos should do the job

SetPos(Float: X, Float: Y, Float: Z) {
for(new i; i != MAX_PLAYERS; ++i) {
SetPlayerPos(i, X, Y, Z);
}
}
Information

http://wiki.sa-mp.com/wiki/SetPlayerPos
http://wiki.sa-mp.com/wiki/Control_Structures#Loops

Now you only need to put it inside a command

leon14032002
02/02/2015, 05:04 PM
That whill teleport all players?

RedCode
02/02/2015, 05:11 PM
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

CalvinC
02/02/2015, 05:12 PM
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.