SA-MP Forums Archive
Cop Message Radio - text label - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Cop Message Radio - text label (/showthread.php?tid=461064)



Cop Message Radio - text label - Uberanwar - 31.08.2013

Hi guys I'm trying to add text label on the cop's head if they use /cm.

Here's my code,

I added this

pawn Код:
format(string, sizeof(output), "(radio) %s", params);
        SetPlayerChatBubble(playerid,output,COLOR_WHITE,5.0,5000);

pawn Код:
if(strcmp("/cm", cmdtext, true, 3) == 0)
{
new string[128];
if(IsSpawned[playerid] == 0) {
    SendClientMessage(playerid, COLOR_ERROR, "You are dead. You cannot use this command");
    return 1;
}
if(gTeam[playerid] != COP && gTeam[playerid] != SWAT && gTeam[playerid] != ARMY && gTeam[playerid] != FBI) {
    SendClientMessage(playerid,COLOR_ROYALBLUE,"You are not a Police Officer!");
}
if(strlen(cmdtext) <= 4) {
    SendClientMessage(playerid,COLOR_ERROR,"USAGE: /cm [Message]");
    return 1;
}
else{
    new output[128];
    new pname[24];
    GetPlayerName(playerid, pname, 24);
    strmid(output,cmdtext,3,strlen(cmdtext));
    format(string, sizeof(string), "[COP RADIO] - %s (%d): %s",pname,playerid,output);
    printf("%s", string);
    for(new i=0;i<MAX_PLAYERS;i++)
    {
        if(gTeam[i] == COP || gTeam[i] == SWAT || gTeam[i] == ARMY || gTeam[i] == FBI) {
        format(string, sizeof(string), "[COP RADIO] - %s (%d): %s",pname,playerid,output);
        SendClientMessage(i,COLOR_ROYALBLUE,string);
        [B]format(string, sizeof(output), "(radio) %s", params);
        SetPlayerChatBubble(playerid,output,COLOR_WHITE,5.0,5000);[/B]
        }
    }
}
return 1;



Re: Cop Message Radio - text label - QuaTTrO - 31.08.2013

And whats the problem?


Re: Cop Message Radio - text label - Uberanwar - 31.08.2013

Is it correct and btw
It says error undefined symbol: params

Quote:

format(string, sizeof(output), "(radio) %s", params);




Re: Cop Message Radio - text label - QuaTTrO - 31.08.2013

You should put that code outside the loop.
pawn Код:
if(strcmp("/cm", cmdtext, true, 3) == 0)
{
new string[128];
if(IsSpawned[playerid] == 0) {
    SendClientMessage(playerid, COLOR_ERROR, "You are dead. You cannot use this command");
    return 1;
}
if(gTeam[playerid] != COP && gTeam[playerid] != SWAT && gTeam[playerid] != ARMY && gTeam[playerid] != FBI) {
    SendClientMessage(playerid,COLOR_ROYALBLUE,"You are not a Police Officer!");
}
if(strlen(cmdtext) <= 4) {
    SendClientMessage(playerid,COLOR_ERROR,"USAGE: /cm [Message]");
    return 1;
}
else{
    new output[128];
    new pname[24];
    GetPlayerName(playerid, pname, 24);
    strmid(output,cmdtext,3,strlen(cmdtext));
    format(string, sizeof(string), "[COP RADIO] - %s (%d): %s",pname,playerid,output);
    printf("%s", string);
    for(new i=0;i<MAX_PLAYERS;i++)
    {
        if(gTeam[i] == COP || gTeam[i] == SWAT || gTeam[i] == ARMY || gTeam[i] == FBI) {
        format(string, sizeof(string), "[COP RADIO] - %s (%d): %s",pname,playerid,output);
        SendClientMessage(i,COLOR_ROYALBLUE,string);
        }
    }
        format(string, sizeof(output), "(radio) %s", output); //params to output
        SetPlayerChatBubble(playerid,output,COLOR_WHITE,5.0,5000);
}
return 1;
}
About the param error:
Replace params with output


Re: Cop Message Radio - text label - Uberanwar - 01.09.2013

Theres a problem, it actually doesn't show (radio) on player's head, but it shows the text message.
format(string, sizeof(output), "(radio) %s", output);
any help?