SA-MP Forums Archive
radio faction problem - 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: radio faction problem (/showthread.php?tid=600974)



radio faction problem - ratxrat - 15.02.2016

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(playeridparams[])
{
    new 
string[128], text[128], ctext[60], pname[MAX_PLAYER_NAME+1];
    
GetPlayerName(playeridpnamesizeof(pname));
    if(
sscanf(params"s[128]"text)) return SendClientMessage(playerid0x46E850FF"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(stringsizeof(string), "%s %s: %s"ctextpnametext);
        if(
PlayerData[playerid][pFaction] > 0)
        {
            
SendCopMessage(COLOR_PDRADstring);
        }
 return 
1;
    } 
and this stock for SendCopMessage
PHP код:
stock SendCopMessage(colstring[])
{
    for(new 
0MAX_PLAYERSi++)
    {
        if(
PlayerData[i][pFaction] == 1)
            
SendClientMessage(icolstring);     
    return 
1;

where is my mistake??
sory for my bad english


Re: radio faction problem - valych - 15.02.2016

Try to change your if condition in SendCopMessage to this:
PHP код:
stock SendCopMessage(colstring[]) 

    for(new 
0MAX_PLAYERSi++) 
    { 
        if(
PlayerInfo[i][pFaction] == 1
            
SendClientMessage(icolstring);      
    }
    return 
1




Re: radio faction problem - ratxrat - 15.02.2016

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