radio faction problem
#1

i have problem with radio faction, if im compile no prolem but in game massage cannot show to faction member this my code
PHP код:
CMD:radio(playerid, params[])
{
    new 
string[128], text[128], ctext[60], pname[MAX_PLAYER_NAME+1];
    
GetPlayerName(playerid, pname, sizeof(pname));
    if(
sscanf(params, "s[128]", text)) return SendClientMessage(playerid, 0x46E850FF, "SERVER:{FFFFFF} /r(adio) [text]");
    if(
PlayerInfo[playerid][pFaction] == 1)
    {
        if(
PlayerData[playerid][pFacrank] == 1){ ctext = "Cadet"; }
        if(
PlayerData[playerid][pFacrank] == 2){ ctext = "Officer"; }
        if(
PlayerData[playerid][pFacrank] == 3){ ctext = "Senior Officer"; }
        if(
PlayerData[playerid][pFacrank] == 4){ ctext = "Corporal"; }
        if(
PlayerData[playerid][pFacrank] == 5){ ctext = "Sergeant"; }
        if(
PlayerData[playerid][pFacrank] == 6){ ctext = "Lieutenant"; }
        if(
PlayerData[playerid][pFacrank] == 7){ ctext = "Captain"; }
        if(
PlayerData[playerid][pFacrank] == 8){ ctext = "Commander"; }
        if(
PlayerData[playerid][pFacrank] == 9){ ctext = "Deputy Chief"; }
        if(
PlayerData[playerid][pFacrank] == 10){ ctext = "Jendral"; }
        
format(string, sizeof(string), "%s %s: %s", ctext, pname, text);
        if(
PlayerData[playerid][pFaction] > 0)
        {
            
SendCopMessage(COLOR_PDRAD, string);
        }
 return 
1;
    } 
and this stock for SendCopMessage
PHP код:
stock SendCopMessage(col, string[])
{
    for(new 
i = 0; i < MAX_PLAYERS; i++)
    {
        if(
PlayerData[i][pFaction] == 1)
            
SendClientMessage(i, col, string);     
    return 
1;
} 
where is my mistake??
sory for my bad english
Reply
#2

Try to change your if condition in SendCopMessage to this:
PHP код:
stock SendCopMessage(col, string[]) 
{ 
    for(new 
i = 0; i < MAX_PLAYERS; i++) 
    { 
        if(
PlayerInfo[i][pFaction] == 1) 
            
SendClientMessage(i, col, string);      
    }
    return 
1; 
} 
Reply
#3

I fix themselves,
Quote:

if(PlayerInfo[playerid][pFaction] == 1)

just change to
Quote:

if(PlayerData[playerid][pFaction] == 1)

im forget declaration for pFaction change to PlayerData hehe


BTW thank for your help dude
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)