Help with a command
#1

So i have
a inside game radio managment

which you can play music for other player while you are ingame

what i want is the if i am the owner of radio #1 and a player is listening to Radio #1
and i type /microfono1 (message) it will send a message to all player listening to radio #1


so this is what i was trying to do



pawn Код:
if (strcmp("/Microfono1", cmdtext, true, 11) == 0)
    {
        if(strlen(cmdtext) <= 11)
        {
            SendClientMessage(playerid,0xC7C7C7FF,"USAGE: /microfono1 (message)  -  Enter A Valid Cop Message.");
            return 1;
        }
        else
        {
            new output[255];
            new string[128];
            strmid(output,cmdtext,3,strlen(cmdtext));
            format(string, sizeof(string), "[Locutor de Radio %d]: %s", Emisser[1],output);
            for(new i = 0; i < MAX_PLAYERS; i++)
            {
                checkindex(playerid);
                if(GetVar(playerid, "pvar1") == 1)
                {
                    format(string, sizeof(string), "[Locutor de Radio %s]: %s",Emisser[1],output);
                    Microfono1(blue,string);
                    //SendClientMessage(i,blue,string);
                    return 1;
                }
                else
                {
                    if(isnull(cmdtext)) return SendClientMessage(playerid,0xC7C7C7FF,"usted no es locutor de radio.");
                    SendClientMessage(playerid,0xC7C7C7FF,"usted no es locutor de radio.");
                    return 1;
                }
            }
        }
    }


    forward Microfono1(color,const string[]);
    public Microfono1(color,const string[])
{
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        new pvar1 = GetPVarInt(i,"pvar1");
        if(IsPlayerConnected(i) == 1) if(pvar1==pvar1) SendClientMessage(i,color,string);
    }
    return 1;
}

Help Help Help please!!!

If you help me i will give you the filterscript (If you want)
Reply
#2

So what's your problem? and I don't really see a point of having all of those return 1 in your code. Your code is similar to this:

pawn Код:
if(.....)
 {
    // do stuff
    return 1;
  }
else {
  if(....)
   {
     //do stuff
     return 1;
     }
instead have it like this, it won't make a difference:

pawn Код:
if(....)
 {
   // do stuff
  }
else {
 if(....)
 {
  // do stuff
  }
return 1;
And not that I mean anything but you should use zcmd or ycmd, strcmp is an old method.
Good Day
Reply
#3

O wuao i didn't post the erros

pawn Код:
C:\Users\Android\Desktop\Maclao Stuff\Android Roleplay\filterscripts\emisser.pwn(118) : error 017: undefined symbol "Emisser"
C:\Users\Android\Desktop\Maclao Stuff\Android Roleplay\filterscripts\emisser.pwn(118) : warning 215: expression has no effect
C:\Users\Android\Desktop\Maclao Stuff\Android Roleplay\filterscripts\emisser.pwn(118) : error 001: expected token: ";", but found "]"
C:\Users\Android\Desktop\Maclao Stuff\Android Roleplay\filterscripts\emisser.pwn(118) : error 029: invalid expression, assumed zero
C:\Users\Android\Desktop\Maclao Stuff\Android Roleplay\filterscripts\emisser.pwn(118) : fatal error 107: too many error messages on one line
Reply
#4

can you tell me which is line 118?
Reply
#5

pawn Код:
format(string, sizeof(string), "[Locutor de Radio %d]: %s", Emisser[1],output);
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)