COMMAND:radio(playerid, params[])
#1

Trying to make a radio chat inside teams. There is something im doing wrong and i dont know what lol
What i can understand, this code will send the message to all players in the server, and not just only to the team when use (SendClientMessageToAll) ?


It looks like this
pawn Код:
468COMMAND:radio(playerid, params[])
469{
470   GetPlayerName(playerid,pname,sizeof(pname));
471   if(Leader[playerid] == 3)
472   {
473       format(String,MAX_PLAYERS, "** Command Chief Master  %s: %s, over **",pname);
474       SendClientMessageToAll(0x8F8F8FFF,String);
475       return 1;
476   }
477       else if Member[playerid] == 3)
478   {
479        format(String,MAX_PLAYERS, "** Member  %s: %s, over **",pname);
480        SendClientMessageToAll(0x8F8F8FFF,String);
481        return 1;
482    }
483     return 1;
484}
Errors/Warnings
pawn Код:
(477) : error 001: expected token: "*then", but found ")"
(477) : error 029: invalid expression, assumed zero
(483) : warning 225: unreachable code
(483) : warning 217: loose indentation
Reply
#2

pawn Код:
COMMAND:radio(playerid, params[])
{
    new name[MAX_PLAYER_NAME],string[128];
    GetPlayerName(playerid,pname,sizeof(pname));
    if(Leader[playerid] == 3)
    {
        format(string,MAX_PLAYERS, "** Command Chief Master  %s: %s, over **",pname);
        SendClientMessageToAll(0x8F8F8FFF,string);
    }
    else if(Member[playerid] == 3)
    {
        format(string,MAX_PLAYERS, "** Member  %s: %s, over **",pname);
        SendClientMessageToAll(0x8F8F8FFF,string);
    }
    return 1;
}
Reply
#3

Quote:
Originally Posted by Schurman
Посмотреть сообщение
pawn Код:
COMMAND:radio(playerid, params[])
{
    new name[MAX_PLAYER_NAME],string[128];
    GetPlayerName(playerid,pname,sizeof(pname));
    if(Leader[playerid] == 3)
    {
        format(string,MAX_PLAYERS, "** Command Chief Master  %s: %s, over **",pname);
        SendClientMessageToAll(0x8F8F8FFF,string);
    }
    else if(Member[playerid] == 3)
    {
        format(string,MAX_PLAYERS, "** Member  %s: %s, over **",pname);
        SendClientMessageToAll(0x8F8F8FFF,string);
    }
    return 1;
}
Thanks!
But no radio message appears at all
And i got this warning
pawn Код:
pwn(485) : warning 204: symbol is assigned a value that is never used: "name"
on
pawn Код:
new name[MAX_PLAYER_NAME],string[128];
I solved it with
pawn Код:
playername3
but there is no radio message, the code does do nothing...hmm
Reply
#4

My appologies, replace "name" in the new statement with "pname".
Reply
#5

Quote:
Originally Posted by Schurman
Посмотреть сообщение
My appologies, replace "name" in the new statement with "pname".
No worries
playername3 solved it, but the code seams to do nothing

EDIT: it do something...crashing the server lol :P
Reply
#6

maybe this

pawn Код:
COMMAND:radio(playerid, params[])
{
    if (!strlen(params[0])) return SendClientMessage(playerid,White,"Usage: /radio [Message]");
    new pname[MAX_PLAYER_NAME],string[128];
    GetPlayerName(playerid,pname,sizeof(pname));
    if(Leader[playerid] == 3)
    {
        format(string,sizeof (string), "** Command Chief Master  %s: %s, over **",pname, params[0]);
        SendClientMessageToAll(0x8F8F8FFF,string);
    }
    else if(Member[playerid] == 3)
    {
        format(string, sizeof (string), "** Member  %s: %s, over **",pname, params[0]);
        SendClientMessageToAll(0x8F8F8FFF,string);
    }
    return 1;
}
Reply
#7

Quote:
Originally Posted by Donya
Посмотреть сообщение
maybe this

pawn Код:
COMMAND:radio(playerid, params[])
{
    if (!strlen(params[0])) return SendClientMessage(playerid,White,"Usage: /radio [Message]");
    new pname[MAX_PLAYER_NAME],string[128];
    GetPlayerName(playerid,pname,sizeof(pname));
    if(Leader[playerid] == 3)
    {
        format(string,sizeof (string), "** Command Chief Master  %s: %s, over **",pname, params[0]);
        SendClientMessageToAll(0x8F8F8FFF,string);
    }
    else if(Member[playerid] == 3)
    {
        format(string, sizeof (string), "** Member  %s: %s, over **",pname, params[0]);
        SendClientMessageToAll(0x8F8F8FFF,string);
    }
    return 1;
}
It works perfect! but "SendClientMessageToAll" must be changed to something else, bc everyone on the server gets the message, not just the team.
Reply
#8

you need to show your team defines etc,
Reply
#9

Quote:
Originally Posted by Donya
Посмотреть сообщение
you need to show your team defines etc,
The teams are made like this etc
pawn Код:
COMMAND:setleader(playerid, params[])
{
    new id,oleader;
    if(!IsPlayerAdmin(playerid))return SendClientMessage(playerid, 0xFF0000FF, "Only RCON admins can use this command!!");
    if(sscanf(params,"ui", id,oleader))return SendClientMessage(playerid, 0x33CCFFAA, "Usage: /setleader [PlayerID] [TeamID 1 - 3] Teams: ID 1: Airwolves. ID 2: Bluefoxes. ID 3: Thunderbirds");
    if(oleader > 9)return SendClientMessage(playerid,red,"Please type /orgids");
    if(oleader == 1)//Set Leader to Airwolves.
    {
        GetPlayerName(playerid, Name, sizeof(Name));
        format(String, sizeof(String), "%s has set you the leader of Airwolves.",Name);
        SendClientMessage(id,green, String);
        SetPlayerColor(id,COLOR_GREY);
        SetPlayerTeam(id, 1);
        SetPlayerSkin(id, 61);
        SetPlayerPos(id, 1607.7803,1169.4840,14.2188);
        GivePlayerWeapon(id,36, 75); //HS Rocket Launcher **
        GivePlayerWeapon(id,27, 100); //Combat Shotgun
        GivePlayerWeapon(id, 38, 100); //Minigun
        GivePlayerWeapon(id, 30, 350); //AK-47
        Leader[id] = 1;
        Member[id] = 1;
        IsInOrg[id] = 1;
        OrgId[id] = 1;
        IsLaw[id] = 0;
        IsPriv[id] = 1;
        IsGang[id] = 0;
        IsRequesting[id] = 0;
        request[id] = 0;
        format(String, sizeof(String), "You have set a new leader for Airwolves.",Name);
        SendClientMessage(playerid,green, String);
    }
And members like this (same way)
pawn Код:
public OnPlayerSpawn(playerid)
{
    SetPlayerPos(playerid, 414.6559,2531.7651,19.1601);
    GivePlayerWeapon(playerid,36,60); //HS Rocket Launcher **
    GivePlayerWeapon(playerid,30,200); //AK-47
    SetPlayerTeam(playerid, 0);
    SetPlayerColor(playerid, COLOR_RED);
    FSave[playerid] = SetTimerEx("Save",1000,true,"i",playerid);//This creates a timer when the player spawns and it saves the file ever 1 second.
    if(Member[playerid] == 1)
    {
        SetPlayerColor(playerid,COLOR_GREY);
        SetPlayerTeam(playerid, 1);
        SetPlayerSkin(playerid, 255);
        SetPlayerPos(playerid, 1607.7803,1169.4840,14.2188);
        GivePlayerWeapon(playerid,36,60); //HS Rocket Launcher **
        GivePlayerWeapon(playerid,27,100); //Combat Shotgun
        GivePlayerWeapon(playerid,30,200); //AK-47
        SendClientMessage(playerid,COLOR_GREY,"Combat Team: Airwolves.");
    }
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)