Admin Chat Problem

Started by Mohamed Boubekri, Dec 12, 2017, 12:09 PM

Previous topic - Next topic

Mohamed Boubekri

Hello, I Have Got command /adminchat From @umar4911
I Do /adminchat iTs Work But i Dont Know What is Problem.
I Have Setlevel of Umar To 4 And i Do /adminchat <HAHAHA> But @umar4911 Say me i Dont Receirve Anything.
Here iTs Command:-
else if ( ( cmd == "adminchat" )
{
if(pstats[ player.ID ].Level < 3 ) MessagePlayer("[#FFDD33]Information:[#FFFFFF] Unauthorized Access", player);
else if(!text) MessagePlayer("[#FF0000]Command Error:[#FFFFFF] Use /" + cmd + " [Message]", player);
else {
local plr;
for( local i = 0; i <= GetMaxPlayers(); i++ )
{
plr = FindPlayer( i );
if ( ( plr ) && ( pstats[ plr.ID ].Level >= 3 ) )
{
MessagePlayer("[#00ff00][Admin Chat] : [#00ffff]" + playerName + " : [#FFFFFF]" + text + ".", plr);
}
}
ITs Wok But i Dont Know What Is Problem :( Help Me...
| What now ? | Not yet ! |
Morrocan:- [ 🇲🇦 ].

umar4911

Quote from: Mohamed on Dec 12, 2017, 12:09 PMHello, I Have Got command /adminchat From @umar4911
I Do /adminchat iTs Work But i Dont Know What is Problem.
I Have Setlevel of Umar To 4 And i Do /adminchat <HAHAHA> But @umar4911 Say me i Dont Receirve Anything.
Here iTs Command:-
else if ( ( cmd == "adminchat" )
{
if(pstats[ player.ID ].Level < 3 ) MessagePlayer("[#FFDD33]Information:[#FFFFFF] Unauthorized Access", player);
else if(!text) MessagePlayer("[#FF0000]Command Error:[#FFFFFF] Use /" + cmd + " [Message]", player);
else {
local plr;
for( local i = 0; i <= GetMaxPlayers(); i++ )
{
plr = FindPlayer( i );
if ( ( plr ) && ( pstats[ plr.ID ].Level >= 3 ) )
{
MessagePlayer("[#00ff00][Admin Chat] : [#00ffff]" + playerName + " : [#FFFFFF]" + text + ".", plr);
}
}
ITs Wok But i Dont Know What Is Problem :( Help Me...
Change this else if ( ( cmd == "adminchat" )
to else if ( cmd == "adminchat" )
I am gamer, programmer and hacker. Try to find me!
xD

Mötley

#2
You needed to remove plr.ID I think and replace it with i, Also did not see that @umar4911, I changed that error, kudos to that

   else if (  cmd == "adminchat" ) {
    if(pstats[ player.ID ].Level < 3 ) {
      MessagePlayer("[#FFDD33]Information:[#FFFFFF] Unauthorized Access", player);
      return true;
    }
    if(!text) {
      MessagePlayer("[#FF0000]Command Error:[#FFFFFF] Use /" + cmd + " [Message]", player);
      return true;
    }
    else {
      for (local i=0;i<GetMaxPlayers();i++) {
        if ( pstats[ i ].Level > 3) {
          local plr = FindPlayer(i);
       
          if (plr) {
            MessagePlayer("[#00ff00][Admin Chat] : [#00ffff] ("+playerName+"):  : [#FFFFFF]"+text, plr);
          }
        }
       }
    }
   }

Also you have playerName instead of player.Name?

Mohamed Boubekri

@TurboGrafx, @umar4911.
Just i Change PlayerName To Player.Name.
Problem Solved Thanks For Help
Locked.
| What now ? | Not yet ! |
Morrocan:- [ 🇲🇦 ].