29.11.2015, 14:30
kick all:
you were not checking if player id not i wrong and were not closing isplayerconnected it should be :
kill all same as above you did not close isplayerconnected and you did not load player id not [ i] well, spam messages on chat cause you send a client message in a loop you should close the loop and send your message like below:
get all:
you did not check isplayerconnected well and you did not send message to all players you just made a format also you did not open isplayerconnected + i not player id you just closed it by : }
here we go this should work:
you were not checking if player id not i wrong and were not closing isplayerconnected it should be :
PHP код:
else if(strcmp(cmdtext, "/kickall", true) == 0)
{
if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, -1, "You need to be rcon admin use /rcon login {pass}");
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i) && i != playerid)
{
PlayerPlaySound(i,1057,0.0,0.0,0.0);
Kick(i);
}
}
new string[128],pname[MAX_PLAYER_NAME+1]; GetPlayerName(playerid,pname,sizeof pname);
format(string,sizeof(string),"[ Administrator \"%s\" has Kicked all players. ]",pname);
SendClientMessageToAll(COLOR_LIGHTBLUE,string);
return 1;
}
PHP код:
else if(strcmp(cmdtext, "/killall", true) == 0)
{
if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, -1, "You need to be rcon admin use /rcon login {pass}");
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i) && i != playerid) { SetPlayerHealth(i, 0); }
}
SendClientMessage(playerid, COLOR_LIGHTBLUE, "You have killed all players");
return 1;
}
you did not check isplayerconnected well and you did not send message to all players you just made a format also you did not open isplayerconnected + i not player id you just closed it by : }
here we go this should work:
PHP код:
else if(strcmp(cmdtext, "/getall", true) == 0)
{
if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, -1, "You need to be rcon admin use /rcon login {pass}");
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) {
PlayerPlaySound(i,1057,0.0,0.0,0.0);
SetPlayerPos(i,x+(playerid/4)+1,y+(playerid/4),z);
SetPlayerInterior(i,interior);
}
}
SendClientMessage(playerid, COLOR_LIGHTBLUE, "You have got all players to your self");
new string[128],pname[MAX_PLAYER_NAME+1]; GetPlayerName(playerid,pname,sizeof pname);
format(string,sizeof(string)," Administrator \"%s\" has Teleported all players.",pname);
SendClientMessageToAll(COLOR_LIGHTBLUE,string);
return 1;
}