question - 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: question (
/showthread.php?tid=650216)
question -
AstroPoid - 23.02.2018
How can i get the next player ascendingly who have some features on , for example: specing rcon admins ascendingly
Код:
CMD:specadmins(playerid, params[])
{
foreach(new i : Character)
{
if(IsPlayerAdmin(i)) TogglePlayerSpectating(playerid, 1); PlayerSpectatePlayer(playerid, i,
SPECTATE_MODE_NORMAL);
}
return 1;
}
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if(newkeys & SPRINT_KEY)
{
//Spectating the next admin
}
return 1;
}
Re: question -
kingmk - 23.02.2018
I hope i helped u. [I didn't test the code]
Код:
new SpectateID[MAX_PLAYERS];
hook OnPlayerConnect(playerid)
{
SpectateID[playerid] = -1;
return 1;
}
hook OnPlayerDisconnect(playerid)
{
SpectateID[playerid] = -1;
return 1;
}
CMD:specadmins(playerid, params[])
{
foreach(new i : Player)
{
if(IsPlayerAdmin(i))
{
TogglePlayerSpectating(playerid, 1);
PlayerSpectatePlayer(playerid, i, SPECTATE_MODE_NORMAL);
SpectateID[playerid] = i;
return 1;
}
}
return 1;
}
hook OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if(newkeys & SPRINT_KEY)
{
if(SpectateID[playerid] != -1)
{
foreach(new i : Player)
{
if(IsPlayerAdmin(i) && i != SpectateID[playerid])
{
PlayerSpectatePlayer(playerid, i, SPECTATE_MODE_NORMAL);
SendClientMessage(playerid, -1, "You now spectateing the next admin.");
SpectateID[playerid] = i;
}
}
}
}
return 1;
}
Re: question -
AstroPoid - 23.02.2018
Thanks for help , but thats not what i exactly mean , i mean to do it for example with bigger id , or who been rcon before who. This code will select players randomly due internet connection of loops , i need to do it 1 by 1
Re: question -
AstroPoid - 23.02.2018
Nvm , i found how to do it, thanks