18.04.2013, 22:49
Hello, You read the title.

if(!strcmp("/tpall", cmdtext, true))
{
for(new i=1;i<=MAX_PLAYERS;i++)
{
new Float:x, Float:y, Float:z;
GetPlayerPos(playerid,x,y,z);
SetPlayerPos(i,x,y+1,z); // . is all player
return 1;
}
return 0;
}
like this bro ?
pawn Код:
|
if(!strcmp("/getall", cmdtext, true))
{
new Float:x, Float:y, Float:z;
GetPlayerPos(playerid, x, y, z);
for(new i=0; i<MAX_PLAYERS; i++)
{
if (IsPlayerConnected(i))
{
SetPlayerPos(i,x,y,z);
}
}
return 1;
}
You don't have to get the playerid's player position in every loop and also you dont have to take as many coordinates sets as the slots of the server are.
Here is the most timesaving (without foreach) command: pawn Код:
|
if(!strcmp("/getall", cmdtext, true))
{
new Float:x, Float:y, Float:z, Float:c=0.0;
GetPlayerPos(playerid, x, y, z);
for(new i=0; i<MAX_PLAYERS; i++)
{
if (IsPlayerConnected(i))
{
SetPlayerPos(i,x+c,y+c,z);
c=c+0.4;
}
}
return 1;
}
So that the players don't get gathered on a single spot and get stuck:
pawn Код:
|
new interior;
GetPlayerInterior(playerid,interior);
SetPlayerInterior(i,interior);