CMD Problem help - 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: CMD Problem help (
/showthread.php?tid=614397)
CMD Problem help -
Mijata - 07.08.2016
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);
}
Re: CMD Problem fix -
AndySedeyn - 07.08.2016
Your foreach syntax is deprecated:
PHP код:
foreach(new i : Player)
Also, you should not only check if playerid is spawned but player 'i' as well.
Re: CMD Problem help -
Mijata - 08.08.2016
Again same problem
Re: CMD Problem help -
Problems - 08.08.2016
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);
}
Re: CMD Problem help -
Dayrion - 08.08.2016
Looking for this?
PHP код:
CMD:getall(playerid,params[])
{
if(pInfo[playerid][pLevel] >= 4) return ShowMessage(playerid, red, 1);
new Float:x,
Float:y,
Float:z;
GetPlayerPos(playerid, x, y, z);
foreach(new i : Player)
{
if(playerid != i || pInfo[playerid][Spawned] != 1) continue;
PlayerPlaySound(i, 1057,0.0,0.0,0.0);
SetPlayerPos(i, x, y, z);
}
CommandToAdmins(playerid, "getall");
format(Jstring,sizeof(Jstring),"Admin '%s' has teleported all players", GetName(playerid));
return SendClientMessageToAll(yellow, Jstring);
return 1;
}