Medic Radio Message problems
#1

Hello, I'm trying to make a medic radio message. I copied some codes from my police radio codes.

First, this is my police radio message command/script (Sorry for the indentation >_<)

Quote:
Код:
   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[255];
	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);
    }
    }
    }
    return 1;
    }
This is my medic radio message (based on my police radio message script)
Quote:
Код:
    if (strcmp("/mm", 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] == Medic)
    SendClientMessage(playerid,COLOR_ROYALBLUE,"You are not a Medic!");
    }
    if(strlen(cmdtext) <= 4) {
    SendClientMessage(playerid,COLOR_ERROR,"USAGE: /mm [Medic Message]");
    return 1;
    }
	else{
	new output[255];
	new pname[24];
	GetPlayerName(playerid, pname, 24);
    strmid(output,cmdtext,3,strlen(cmdtext));
    format(string, sizeof(string), "[MEDIC RADIO] - %s (%d): %s",pname,playerid,output);
    printf("%s", string);
    for(new i=0;i<MAX_PLAYERS;i++)
	{
    if(gTeam[i] == Medic)
    format(string, sizeof(string), "[MEDIC RADIO] - %s (%d): %s",pname,playerid,output);
    SendClientMessage(i,COLOR_ROYALBLUE,string);
    }
    }
    }
    return 1;
    }
I compiled, then the pawno stopped working? Is there any problems with the command?
Reply
#2

pawn Код:
if (strcmp("/mm", 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] == Medic)
        {
            SendClientMessage(playerid,COLOR_ROYALBLUE,"You are not a Medic!");
        }
        if(strlen(cmdtext) <= 4)
        {
            SendClientMessage(playerid,COLOR_ERROR,"USAGE: /mm [Medic Message]");
            return 1;
        }
        else
        {
            new output[255];
            new pname[24];
            GetPlayerName(playerid, pname, 24);
            strmid(output,cmdtext,3,strlen(cmdtext));
            format(string, sizeof(string), "[MEDIC RADIO] - %s (%d): %s",pname,playerid,output);
            printf("%s", string);
            for(new i=0;i<MAX_PLAYERS;i++)
        }
        if(gTeam[i] == Medic)
        {
            format(string, sizeof(string), "[MEDIC RADIO] - %s (%d): %s",pname,playerid,output);
            SendClientMessage(i,COLOR_ROYALBLUE,string);
        }
        return 1;
    }
Have not tested this but it should work
Reply
#3

Quote:
Originally Posted by Don_Cage
Посмотреть сообщение
pawn Код:
if (strcmp("/mm", 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] == Medic)
        {
            SendClientMessage(playerid,COLOR_ROYALBLUE,"You are not a Medic!");
        }
        if(strlen(cmdtext) <= 4)
        {
            SendClientMessage(playerid,COLOR_ERROR,"USAGE: /mm [Medic Message]");
            return 1;
        }
        else
        {
            new output[255];
            new pname[24];
            GetPlayerName(playerid, pname, 24);
            strmid(output,cmdtext,3,strlen(cmdtext));
            format(string, sizeof(string), "[MEDIC RADIO] - %s (%d): %s",pname,playerid,output);
            printf("%s", string);
            for(new i=0;i<MAX_PLAYERS;i++)
        }
        if(gTeam[i] == Medic)
        {
            format(string, sizeof(string), "[MEDIC RADIO] - %s (%d): %s",pname,playerid,output);
            SendClientMessage(i,COLOR_ROYALBLUE,string);
        }
        return 1;
    }
Have not tested this but it should work
Not working, many errors. (conflicts, maybe?)

Quote:

C:\Users\USER\Desktop\SERVERSKCNR\gamemodes\CNR.pw n(158 : error 017: undefined symbol "GetPlayer2DZone"
C:\Users\USER\Desktop\SERVERSKCNR\gamemodes\CNR.pw n(1611) : error 017: undefined symbol "GetWeaponModel"
C:\Users\USER\Desktop\SERVERSKCNR\gamemodes\CNR.pw n(1626) : error 017: undefined symbol "GetWeaponModel"
C:\Users\USER\Desktop\SERVERSKCNR\gamemodes\CNR.pw n(1641) : error 017: undefined symbol "GetWeaponModel"
C:\Users\USER\Desktop\SERVERSKCNR\gamemodes\CNR.pw n(1656) : error 017: undefined symbol "GetWeaponModel"
C:\Users\USER\Desktop\SERVERSKCNR\gamemodes\CNR.pw n(3101) : error 017: undefined symbol "UcideMasinileBoule"
C:\Users\USER\Desktop\SERVERSKCNR\gamemodes\CNR.pw n(3104) : error 004: function "terminarMission" is not implemented
C:\Users\USER\Desktop\SERVERSKCNR\gamemodes\CNR.pw n(3109) : error 004: function "terminarMission2" is not implemented
C:\Users\USER\Desktop\SERVERSKCNR\gamemodes\CNR.pw n(3124) : error 017: undefined symbol "ReturnPlayerName"
C:\Users\USER\Desktop\SERVERSKCNR\gamemodes\CNR.pw n(3134) : error 017: undefined symbol "HideDraw"
C:\Users\USER\Desktop\SERVERSKCNR\gamemodes\CNR.pw n(3295) : error 017: undefined symbol "HideDraw"
C:\Users\USER\Desktop\SERVERSKCNR\gamemodes\CNR.pw n(3305) : error 017: undefined symbol "ReturnPlayerName"
C:\Users\USER\Desktop\SERVERSKCNR\gamemodes\CNR.pw n(3313) : error 017: undefined symbol "ReturnPlayerName"
C:\Users\USER\Desktop\SERVERSKCNR\gamemodes\CNR.pw n(3337) : error 017: undefined symbol "MissionIni2"
C:\Users\USER\Desktop\SERVERSKCNR\gamemodes\CNR.pw n(333 : error 017: undefined symbol "HideDraw"
C:\Users\USER\Desktop\SERVERSKCNR\gamemodes\CNR.pw n(3347) : error 017: undefined symbol "HideDraw"
C:\Users\USER\Desktop\SERVERSKCNR\gamemodes\CNR.pw n(3356) : error 017: undefined symbol "HideDraw"
C:\Users\USER\Desktop\SERVERSKCNR\gamemodes\CNR.pw n(3365) : error 017: undefined symbol "HideDraw"
C:\Users\USER\Desktop\SERVERSKCNR\gamemodes\CNR.pw n(3376) : error 017: undefined symbol "HideDraw"
C:\Users\USER\Desktop\SERVERSKCNR\gamemodes\CNR.pw n(3394) : error 017: undefined symbol "Announce"
C:\Users\USER\Desktop\SERVERSKCNR\gamemodes\CNR.pw n(3402) : error 017: undefined symbol "SendRadioMessageToCops"
C:\Users\USER\Desktop\SERVERSKCNR\gamemodes\CNR.pw n(3420) : error 017: undefined symbol "Announce"
C:\Users\USER\Desktop\SERVERSKCNR\gamemodes\CNR.pw n(342 : error 017: undefined symbol "SendRadioMessageToCops"
C:\Users\USER\Desktop\SERVERSKCNR\gamemodes\CNR.pw n(3446) : error 017: undefined symbol "Announce"
C:\Users\USER\Desktop\SERVERSKCNR\gamemodes\CNR.pw n(3454) : error 017: undefined symbol "SendRadioMessageToCops"
C:\Users\USER\Desktop\SERVERSKCNR\gamemodes\CNR.pw n(3472) : error 017: undefined symbol "Announce"

Compilation aborted.Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


26 Errors.

Reply
#4

I'm going to bed right now but my best guess is a missing bracket ( } or { )
Reply
#5

First remove this cmd or cut and paste to any notpad and see if you doesn't get any error then try this:
pawn Код:
if (strcmp("/mm", 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] != Medic) // it means if player is medic change == to !=
{    SendClientMessage(playerid,COLOR_ROYALBLUE,"You are not a Medic!");
 }
   if(strlen(cmdtext) <= 4) {
    SendClientMessage(playerid,COLOR_ERROR,"USAGE: /mm [Medic Message]");    return 1;    } else
{
    new output[255];   
      new pname[24];   
GetPlayerName(playerid, pname, 24);    strmid(output,cmdtext,3,strlen(cmdtext));
    format(string, sizeof(string), "[MEDIC RADIO] - %s (%d):%s",pname,playerid,output);    printf("%s", string);    for(new i=0;i<MAX_PLAYERS;i++)
    {
    if(gTeam[i] == Medic)    format(string, sizeof(string), "[MEDIC RADIO] - %s (%d):%s",pname,playerid,output);    SendClientMessage(i,COLOR_ROYALBLUE,string);    }
   }
    }
    return 1;    }
Reply
#6

I managed to fix errors, yes there's another missing bracket then i add it,

Updated code:

Quote:

if(strcmp("/mm", 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] == Medic)
{
SendClientMessage(playerid,COLOR_ROYALBLUE,"You are not a Medic!");
}
if(strlen(cmdtext) <= 4)
{
SendClientMessage(playerid,COLOR_ERROR,"USAGE: /mm [Medic Message]");
return 1;
}
else
{
new output[255];
new pname[24];
GetPlayerName(playerid, pname, 24);
strmid(output,cmdtext,3,strlen(cmdtext));
format(string, sizeof(string), "[MEDIC RADIO] - %s (%d): %s",pname,playerid,output);
printf("%s", string);
for(new i=0;i<MAX_PLAYERS;i++)
}
if(gTeam[i] == Medic)

{
format(string, sizeof(string), "[MEDIC RADIO] - %s (%d): %s",pname,playerid,output);
SendClientMessage(i,COLOR_ROYALBLUE,string);
}
}
return 1;
}

4 errors left

Quote:

C:\Users\USER\Desktop\SERVERSKCNR\gamemodes\CNR.pw n(5167) : error 029: invalid expression, assumed zero
C:\Users\USER\Desktop\SERVERSKCNR\gamemodes\CNR.pw n(5167 -- 516 : warning 215: expression has no effect
C:\Users\USER\Desktop\SERVERSKCNR\gamemodes\CNR.pw n(516 : error 001: expected token: ";", but found "if"
C:\Users\USER\Desktop\SERVERSKCNR\gamemodes\CNR.pw n(516 : error 017: undefined symbol "i"
C:\Users\USER\Desktop\SERVERSKCNR\gamemodes\CNR.pw n(516 : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


4 Errors.

The errors came from this

5167: }
5168: if(gTeam[i] == Medic)

}
if(gTeam[i] == Medic)
{
Reply
#7

Hey you forget to change first time ==(if player is) to !=(if player is not) use this it will resolve ur probs
pawn Код:
if(gTeam[playerid] != Medic)    SendClientMessage(playerid,COLOR_ROYALBLUE,"You are not a medic....
Reply
#8

Quote:
Originally Posted by PrinceKumar
Посмотреть сообщение
Hey you forget to change first time ==(if player is) to !=(if player is not) use this it will resolve ur probs
pawn Код:
if(gTeam[playerid] != Medic)    SendClientMessage(playerid,COLOR_ROYALBLUE,"You are not a medic....
Changed, still.
Reply
#9

pawn Код:
if(strcmp("/mm", 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] == Medic)
    {
        SendClientMessage(playerid,COLOR_ROYALBLUE,"You are not a Medic!");
    }
    if(strlen(cmdtext) <= 4)
    {
        SendClientMessage(playerid,COLOR_ERROR,"USAGE: /mm [Medic Message]");
    return 1;
    }
    else
    {
        new output[255];
        new pname[24];
        GetPlayerName(playerid, pname, 24);
        strmid(output,cmdtext,3,strlen(cmdtext));
        format(string, sizeof(string), "[MEDIC RADIO] - %s (%d): %s",pname,playerid,output);
        printf("%s", string);
        for(new i=0;i<MAX_PLAYERS;i++)
        {
            if(gTeam[i] == Medic)
            {
                format(string, sizeof(string), "[MEDIC RADIO] - %s (%d): %s",pname,playerid,output);
                SendClientMessage(i,COLOR_ROYALBLUE,string);
            }
        }
    }
    return 1;
}
of course you'll get an error you blocked your loop,this will work
Reply
#10

Quote:
Originally Posted by PrinceKumar
Посмотреть сообщение
Hey you forget to change first time ==(if player is) to !=(if player is not) use this it will resolve ur probs
pawn Код:
if(gTeam[playerid] != Medic)    SendClientMessage(playerid,COLOR_ROYALBLUE,"You are not a medic....
Ah, great! Thanks for telling me this > ==(if player is) to !=(if player is not)
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)