Why not working?
#1

guys, i made a newb system in my server which only shows message to mods and admins not to all players. but when IG i type /newb, it closes server.exe file. please tell me..
PHP код:
CMD:newb(playeridparams[])
{
    new 
log[128];
    if(
gPlayerLogged{playerid} == 0)
    {
        
SendClientMessageEx(playeridCOLOR_GREY"You're not logged in.");
        return 
1;
    }
    if(
PlayerInfo[playerid][pTut] == 0)
    {
        
SendClientMessageEx(playeridCOLOR_GREY"You can't do that at this time.");
        return 
1;
    }
    if ((
nonewbie) && PlayerInfo[playerid][pAdmin] < 2)
    {
        
SendClientMessageEx(playeridCOLOR_GRAD2"The newbie chat channel has been disabled by an administrator!");
        return 
1;
    }
    if(
PlayerInfo[playerid][pNMute] == 1)
    {
        
SendClientMessageEx(playeridCOLOR_GREY"You are muted from the newbie chat channel.");
        return 
1;
    }
    new 
string[128];
    if(
NewbieTimer[playerid] > 0)
    {
        
format(stringsizeof(string), "You must wait %d seconds before speaking again in this channel."NewbieTimer[playerid]);
        
SendClientMessageEx(playeridCOLOR_GREYstring);
        return 
1;
    }
    if(
gNewbie[playerid]==1)
    {
        
SendClientMessageEx(playeridCOLOR_GREY"You have the channel toggled, /tognewbie to re-enable!");
        return 
1;
    }
    if(
isnull(params)) return SendClientMessageEx(playeridCOLOR_WHITE"USAGE: (/newb)ie [text]");
    if(
PlayerInfo[playerid][pHelper]<1&&PlayerInfo[playerid][pAdmin] < 1)
    {
        
NewbieTimer[playerid] = 50;
    }
    if(
PlayerInfo[playerid][pHelper]<1&&PlayerInfo[playerid][pAdmin]<1)
    {
        
format(stringsizeof(string), "** Newbie %s [%d]: %s"GetPlayerNameEx(playerid), playeridparams);
    }
    if(
PlayerInfo[playerid][pHelper] == 1&& PlayerInfo[playerid][pAdmin]<2)
    {
        
format(stringsizeof(string), "** Junior Moderator %s [%d]: %s"GetPlayerNameEx(playerid), playeridparams);
    }
    if(
PlayerInfo[playerid][pAdmin] == 1)
    {
        
format(stringsizeof(string), "** Server Moderator %s [%d]: %s"GetPlayerNameEx(playerid), playeridparams);
    }
    if(
PlayerInfo[playerid][pHelper] == 2&&PlayerInfo[playerid][pAdmin]<2)
    {
        
format(stringsizeof(string), "** Moderator %s [%d]: %s"GetPlayerNameEx(playerid), playeridparams);
    }
    if(
PlayerInfo[playerid][pHelper] == 3&&PlayerInfo[playerid][pAdmin]<2)
    {
        
format(stringsizeof(string), "** Senior Moderator %s: %s"GetPlayerNameEx(playerid), params);
    }
    if(
PlayerInfo[playerid][pHelper] == 4&&PlayerInfo[playerid][pAdmin]<2)
    {
        
format(stringsizeof(string), "** Chief Moderator %s: %s"GetPlayerNameEx(playerid), params);
    }
    if(
PlayerInfo[playerid][pHelper] == 5&&PlayerInfo[playerid][pAdmin]<2)
    {
        
format(stringsizeof(string), "** Lead Chief Moderator %s: %s"GetPlayerNameEx(playerid), params);
    }
    if(
PlayerInfo[playerid][pAdmin] >= 2)
    {
        
format(stringsizeof(string), "** Admin %s: %s"GetPlayerNameEx(playerid), params);
    }
    
SendClientMessage(playeridCOLOR_NEWBIE"Your Message, %s was sent to Moderators Team."string);
    foreach(
Playern)
    {
        if (
PlayerInfo[n][pAdmin] >= || PlayerInfo[n][pHelper] >= 1)
        {
            
SendClientMessageEx(nCOLOR_NEWBIEstring);
        }
    }
    return 
1;

also can you make it like if player is Moderator(helper) or admin, he get message like usage:/newb [playerid][help text] so that he has to use it in that format? thanks!!
Reply
#2

That is working? Wow
Код:
if(gPlayerLogged{playerid} == 0) // Maybe: gPlayerLogged[playerid] not {playerid}?
    { 
        SendClientMessageEx(playerid, COLOR_GREY, "You're not logged in."); 
        return 1; 
    }
There's a problem:
Код:
foreach(Player, n) 
    { 
        if (PlayerInfo[n][pAdmin] >= 1 || PlayerInfo[n][pHelper] >= 1) 
        { 
            SendClientMessageEx(n, COLOR_NEWBIE, string); 
        } 
    }
Loop only for staff.
Код:
 if (PlayerInfo[n][pAdmin] >= 1 || PlayerInfo[n][pHelper] >= 1)
Код:
if(isnull(params)) return SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: (/newb)ie [text]");
Just put if construction to check player is staff and send message.
Like:
Код:
if(isnull(params))
{
     if(stuff) // Your variable
     {
          SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: (/newb)ie [playerid][helptext]"); 
     }
     else
     {
          SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: (/newb)ie [text]"); 
     }

     return 1;
}
Reply
#3

Thanks dude
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)