CMD Problem help
#1

I got message all players are teleported but nobody is teleported...
Код:
CMD:getall(playerid,params[])
{
    if(pInfo[playerid][pLevel] >= 4)
	{
        new Float:Pos[3];
		GetPlayerPos(playerid,Pos[0],Pos[1],Pos[2]);
		foreach(Player, i)
		{
			if(playerid != i && pInfo[playerid][Spawned] == 1)
			{
				PlayerPlaySound(i,1057,0.0,0.0,0.0);
				SetPlayerPos(i, Pos[0], Pos[1], Pos[2]);
			}
		}
        CommandToAdmins(playerid,"getall");
		format(Jstring,sizeof(Jstring),"Admin '%s' has teleported all players", GetName(playerid));
		return SendClientMessageToAll(yellow, Jstring);
	}
	else return ShowMessage(playerid, red, 1);
}
Reply
#2

Your foreach syntax is deprecated:
PHP код:
foreach(new Player
Also, you should not only check if playerid is spawned but player 'i' as well.
Reply
#3

Again same problem
Reply
#4

Try this
pawn Код:
for(new i=0; i<MAX_PLAYERS; i++)
    {
       if(!IsPlayerConnected(i) || i == playerid || IsPlayerNPC(i)) continue;
       GetPlayerPos(playerid,x,y,z);
       SetPlayerPos(i,x+1,y,z);
    }
Reply
#5

Looking for this?
PHP код:
CMD:getall(playerid,params[])
{
    if(
pInfo[playerid][pLevel] >= 4) return ShowMessage(playeridred1);

    new 
Float:x,
        
Float:y,
        
Float:z;

    
GetPlayerPos(playeridxyz);

    foreach(new 
Player)
    {
        if(
playerid != || pInfo[playerid][Spawned] != 1) continue;
        
PlayerPlaySound(i1057,0.0,0.0,0.0);
        
SetPlayerPos(ixyz);
    }

    
CommandToAdmins(playerid"getall");
    
format(Jstring,sizeof(Jstring),"Admin '%s' has teleported all players"GetName(playerid));
    return 
SendClientMessageToAll(yellowJstring);

    return 
1;

Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)