[HELP] else not working
#1

pawn Код:
CMD:g(playerid,params[])
{
    new rank[50],name[50],text[200],msg[250];
    if(sscanf(params,"s[200]",text)) return SendClientMessage(playerid,-1,"USAGE: /g [text]");
    GetPlayerName(playerid,name,sizeof(name));
    if(PlayerInfo[playerid][pAdmin] > 0)
     {
     format(rank,sizeof(rank),"Admin",name,text);
     }
    else if(PlayerInfo[playerid][pHelper] > 0)
     {
     format(rank,sizeof(rank),"Helper");
     }
    else if(PlayerInfo[playerid][pDonateRank] > 0)
     {
     format(rank,sizeof(rank),"V.I.P.");
     }
    else if(PlayerInfo[playerid][pAdmin] < 0)
     {
     format(rank,sizeof(rank),"Player");
     }
    format(msg,sizeof(msg),"(( %s %s: %s ))",rank,name,text);
    for(new i=0;i<=MAX_PLAYERS;i++)
    {
        if(toggc[i] == 1)
        {
            SendClientMessage(i,COLOR_ORANGE,msg);
        }
        else
        {
         if(toggc[i] == 0)
          {
          SendClientMessage(playerid, COLOR_RED, "======== Use /toggc First! ========");
          }
        }
    }
return 1;
}
Everything works there just on annoying thing it sends the error message even when the msg has been sent i putted it in else it is still showing up
Reply
#2

bump
Reply
#3

Well if i write /g blabla, it should write something like: (( Player Matess: blabla )) and send it to some team?
Command "g" should be only for these who wrote /toggc before?
Reply
#4

it would send it to every one but i get this
PHP код:
(( Player KaitoBlabla ))
======== Use /
toggc First! ======== 
On the chat
Reply
#5

they could enable /g chat using /toggc and when they disconnect it returns to false thus disabling /g chat
the only problem is it shows the error that shows up wehn /toggc is off even when it works and enabled
Reply
#6

So liek this?

pawn Код:
CMD:g(playerid,params[])
{
if(toggc[playerid] == 0) return SendClientMessage(playerid, COLOR_RED, "======== Use /toggc First! ========");
 
    new rank[50],name[50],text[200],msg[250];
    if(sscanf(params,"s[200]",text)) return SendClientMessage(playerid,-1,"USAGE: /g [text]");
    GetPlayerName(playerid,name,sizeof(name));
    if(PlayerInfo[playerid][pAdmin] > 0)
     {
     format(rank,sizeof(rank),"Admin",name,text);
     }
    else if(PlayerInfo[playerid][pHelper] > 0)
     {
     format(rank,sizeof(rank),"Helper");
     }
    else if(PlayerInfo[playerid][pDonateRank] > 0)
     {
     format(rank,sizeof(rank),"V.I.P.");
     }
    else if(PlayerInfo[playerid][pAdmin] < 0)
     {
     format(rank,sizeof(rank),"Player");
     }
    format(msg,sizeof(msg),"(( %s %s: %s ))",rank,name,text);
    for(new i=0;i<=MAX_PLAYERS;i++)
    {
        if(toggc[i] == 1)
        {
            SendClientMessage(i,COLOR_ORANGE,msg);
        }
    }
return 1;
}
Reply
#7

ill try that Thanks!
Reply
#8

It sends but after the message it says
pawn Код:
SERVER: Unknown command. Please use /help to list all available commands.
Reply
#9

@Matess Please help
i used the one you edited but it shows unknown command but it works
Reply
#10

pawn Код:
CMD:g(playerid,params[])
{
    new rank[50],name[50],text[200],msg[250];
    if(sscanf(params,"s[200]",text)) return SendClientMessage(playerid,-1,"USAGE: /g [text]");
    GetPlayerName(playerid,name,sizeof(name));
    if(PlayerInfo[playerid][pAdmin] > 0){rank ="Admin";}
    if(PlayerInfo[playerid][pHelper] > 0){rank ="Helper";}
    if(PlayerInfo[playerid][pDonateRank] > 0){rank ="V.I.P.";}
    if(PlayerInfo[playerid][pAdmin] < 0 || PlayerInfo[playerid][pHelper] < 0 || PlayerInfo[playerid][pDonateRank] < 0) {rank ="Player";}
    format(msg,sizeof(msg),"(( %s %s: %s ))",rank,name,text);
    for(new i=0;i<=MAX_PLAYERS;i++)
    {
        if(toggc[i] == 1)
        {
            SendClientMessage(i,COLOR_ORANGE,msg);
        }
        else{SendClientMessage(playerid, COLOR_RED, "======== Use /toggc First! ========");}
    }
    return 1;
}
Try it now, should work
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)