Help please
#1

Hey guys.
I want to make a radio for the mechanics.
how to do this?
I can't just use SendClientMessageToAll.
Because then everyone sees it.I want only that mechanics sees it.

if(mechanic[playerid] >=1)

thats what I use with mechanics.
Please help
Reply
#2

pawn Код:
stock SendClientMessageToMechanics(color, msg[])
{
  for(new i; i < MAX_PLAYERS; i++)
  {
    if(!IsPlayerConnect(playerid) || mechanic[playerid] == 0) continue
    SendClientMessage(color, msg);
  }
}
Reply
#3

And now how make a cmd for it?:P

I have this:
pawn Код:
if(strcmp(cmd, "/r", true) == 0)
{

new text;
new sendername[MAX_PLAYER_NAME];
format(string, sizeof(string), "Mechanic %s Says: %s", sendername, text);
SendClientMessageToMechanics(COLOR_YELLOW, string);
return 1;
}
doesnt work
Thanks btw
Reply
#4

You should really try and use DCMD or ZCMD that's a lot easier for new scripters.
Reply
#5

well, I really want to keep doing strcmp. Don't wanna use anything else :P
Reply
#6

Ah okay, well best of luck
Reply
#7

pawn Код:
if(!strcmp(cmdtext, "/r", true, 2))
    {
        if(mechanic[playerid] < 1) return SendClientMessage(playerid,RED,"You are not a mechanic!");
        if(!cmdtext[2]) return SendClientMessage(playerid, RED, "USAGE: /r [chat]");
        new string[128],name[24];
        GetPlayerName(playerid,name,sizeof(name));
        for(new mechanics;mechanics < MAX_PLAYERS; mechanics++)
        {
            if(IsPlayerConnected(mechanics))
            {
                if(mechanic[mechanics] >= 1)
                {
                    format(string,sizeof(string),"Mechanic %s Says: %s",name,cmdtext[3]);
                    SendClientMessage(mechanics,color,string);
                }
             }
         }
         return 1;
     }
That is basically creating a loop trough all players which are connected,and checks if they are mechanics,if they are,it sends them the message,if they aren't,nothing happens.
Reply
#8

Thanks XST. It works fine
Reply
#9

Quote:
Originally Posted by bartje01
Посмотреть сообщение
Thanks XST. It works fine
No problem,but you really should consider starting to work with dcmd+sscanf.
Believe me,I was against moving to it too,but as soon as I did,it became much easier for me.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)