Hi, need help with this
#1

Hello, I need help with this, I have /r (radio chat) for factions only and have /fr for family I can make /fr & /r in one cmd /r?

/r codes
Код:
CMD:r(playerid, params[]) {

	new
		iGroupID = PlayerInfo[playerid][pMember],
		iRank = PlayerInfo[playerid][pRank];

	if (0 <= iGroupID < MAX_GROUPS) {
 		if (iRank >= arrGroupData[iGroupID][g_iRadioAccess]) {
			if(GetPVarInt(playerid, "togRadio") == 0) {
				if(!isnull(params))
				{
					new string[128], employer[GROUP_MAX_NAME_LEN], rank[GROUP_MAX_RANK_LEN], division[GROUP_MAX_DIV_LEN];
					format(string, sizeof(string), "(radio) %s", params);
					SetPlayerChatBubble(playerid, string, COLOR_WHITE, 15.0, 5000);
					GetPlayerGroupInfo(playerid, rank, division, employer);
					format(string, sizeof(string), "** [%s] %s (%s) %s: %s **", PlayerInfo[playerid][pBadge], rank, division, GetPlayerNameEx(playerid), params);
					foreach(new i: Player)
					{
						if(GetPVarInt(i, "togRadio") == 0)
						{
							if(PlayerInfo[i][pMember] == iGroupID && iRank >= arrGroupData[iGroupID][g_iRadioAccess]) {
								SendClientMessageEx(i, arrGroupData[iGroupID][g_hRadioColour] * 256 + 255, string);
							}
							if(GetPVarInt(i, "BigEar") == 1 || GetPVarInt(i, "BigEar") == 4 && GetPVarInt(i, "BigEarGroup") == iGroupID) {
								new szBigEar[128];
								format(szBigEar, sizeof(szBigEar), "(BE) %s", string);
								SendClientMessageEx(i, arrGroupData[iGroupID][g_hRadioColour] * 256 + 255, szBigEar);
							}
						}
					}
				}
				else return SendClientMessageEx(playerid, COLOR_GREY, "USAGE: (/r)adio [radio chat]");
			}
			else return SendClientMessageEx(playerid, COLOR_GREY, "Your radio is currently turned off, type /togradio to turn it back on.");
		}
		else return SendClientMessageEx(playerid, COLOR_GREY, "You do not have access to this radio frequency.");
	}
	else return SendClientMessageEx(playerid, COLOR_GREY, "You are not in a group.");
	return 1;
}
/fr codes
Код:
CMD:fr(playerid, params[])
{
	if(gFam[playerid] == 1)
	{
		SendClientMessageEx(playerid, COLOR_GRAD2, "You have your family chat disabled. /togfamily!");
		return 1;
	}

    new fam = PlayerInfo[playerid][pFMember];
	new string[128];
	if(isnull(params)) return SendClientMessageEx(playerid, COLOR_GREY, "USAGE: (/f)amily [family chat]");

	if(IsAHitman(playerid))
	{
		format(string, sizeof(string), "** (%d) %s %s: %s **", PlayerInfo[playerid][pRank], arrGroupRanks[PlayerInfo[playerid][pMember]][PlayerInfo[playerid][pRank]], GetPlayerNameEx(playerid), params);
		SendFamilyMessage(PlayerInfo[playerid][pMember], FamilyInfo[fam][FamilyColor], string);
	}
	else if(PlayerInfo[playerid][pFMember] < INVALID_FAMILY_ID)
	{
	    if(0 <= PlayerInfo[playerid][pDivision] < 5)
	    {
	        new division[GROUP_MAX_DIV_LEN];
	        format(division, sizeof(division), "%s", FamilyDivisionInfo[PlayerInfo[playerid][pFMember]][PlayerInfo[playerid][pDivision]]);
		    format(string, sizeof(string), "** (%i) %s (%s) %s: %s **", PlayerInfo[playerid][pRank], FamilyRankInfo[fam][PlayerInfo[playerid][pRank]], division, GetPlayerNameEx(playerid), params);
			SendNewFamilyMessage(fam, FamilyInfo[fam][FamilyColor], string);
		}
		else
		{
		    format(string, sizeof(string), "** (%i) %s %s: %s **", PlayerInfo[playerid][pRank], FamilyRankInfo[fam][PlayerInfo[playerid][pRank]], GetPlayerNameEx(playerid), params);
			SendNewFamilyMessage(fam, FamilyInfo[fam][FamilyColor], string);
		}
	}
	else
	{
		SendClientMessageEx(playerid, COLOR_GRAD2, "You're not a part of a Family!");
	}
	return 1;
}
Thanks
Reply
#2

you still need an identifier if its /fr or /r under /r like if you use /r f [tex] sent this text to family because one person can be in both a family and faction. Try using sscanf for that extra "f" identifier variable.
Reply
#3

I didn't understand much but if you mean to make /fr and /r the same command, to work the same then here you go:

PHP код:
CMD:fr(playeridparams[]) {
    return 
cmd_r(playeridparams);

then put this under the /fr command:

PHP код:
CMD:r(playeridparams[]) {
    new
        
iGroupID PlayerInfo[playerid][pMember],
        
iRank PlayerInfo[playerid][pRank];
    if (
<= iGroupID MAX_GROUPS) {
         if (
iRank >= arrGroupData[iGroupID][g_iRadioAccess]) {
            if(
GetPVarInt(playerid"togRadio") == 0) {
                if(!
isnull(params))
                {
                    new 
string[128], employer[GROUP_MAX_NAME_LEN], rank[GROUP_MAX_RANK_LEN], division[GROUP_MAX_DIV_LEN];
                    
format(stringsizeof(string), "(radio) %s"params);
                    
SetPlayerChatBubble(playeridstringCOLOR_WHITE15.05000);
                    
GetPlayerGroupInfo(playeridrankdivisionemployer);
                    
format(stringsizeof(string), "** [%s] %s (%s) %s: %s **"PlayerInfo[playerid][pBadge], rankdivisionGetPlayerNameEx(playerid), params);
                    foreach(new 
iPlayer)
                    {
                        if(
GetPVarInt(i"togRadio") == 0)
                        {
                            if(
PlayerInfo[i][pMember] == iGroupID && iRank >= arrGroupData[iGroupID][g_iRadioAccess]) {
                                
SendClientMessageEx(iarrGroupData[iGroupID][g_hRadioColour] * 256 255string);
                            }
                            if(
GetPVarInt(i"BigEar") == || GetPVarInt(i"BigEar") == && GetPVarInt(i"BigEarGroup") == iGroupID) {
                                new 
szBigEar[128];
                                
format(szBigEarsizeof(szBigEar), "(BE) %s"string);
                                
SendClientMessageEx(iarrGroupData[iGroupID][g_hRadioColour] * 256 255szBigEar);
                            }
                        }
                    }
                }
                else return 
SendClientMessageEx(playeridCOLOR_GREY"USAGE: (/r)adio [radio chat]");
            }
            else return 
SendClientMessageEx(playeridCOLOR_GREY"Your radio is currently turned off, type /togradio to turn it back on.");
        }
        else return 
SendClientMessageEx(playeridCOLOR_GREY"You do not have access to this radio frequency.");
    }
    else return 
SendClientMessageEx(playeridCOLOR_GREY"You are not in a group.");
    return 
1;

Reply
#4

Nah mate, I mean like how factions/familes can use same cmd /giverank , /invite now i want make family can talk on radio by /r not /fr
Reply
#5

if factions and families are different than eachother you have to use something like:
Код:
CMD:/r(playerid,params[])
{
    if(iGroupID = PlayerInfo[playerid][pMember]==0,PlayerInfo[playerid][pFMember]!=0)
    {
        ////do only family chat
    }
    if(iGroupID = PlayerInfo[playerid][pMember]!=0,PlayerInfo[playerid][pFMember]==0)
    {
        ////do only faction chat
    }
    new text[128],identifier[3];
    if(sscanf(params,"s[1]s[128]",identifier,text)) return //dosomething
    if(strcmp(identifier,"fam")==0)
    {
         ///dooo youur stuff for family chat
    }
    if(strcmp(identifier,"fac")==0)
    {
        ///dooo youur stuff for faction chat
    } 
}
now your commands for radio would be like:
Код:
/r fam [text] ///this is message to your family radio
/r fac [text] ///this is message to your faction radio
as one person can be in both a family and a faction you wouldnt want a message to go to both. Also if you mean if the player is not in both you can check it like:
Reply
#6

Quote:
Originally Posted by grymtn
Посмотреть сообщение
if factions and families are different than eachother you have to use something like:
Код:
CMD:/r(playerid,params[])
{
    new text[128],identifier[3];
    if(sscanf(params,"s[1]s[128]",identifier,text)) return //dosomething
    if(strcmp(identifier,"fam")==0)
    {
         ///dooo youur stuff for family chat
    }
    if(strcmp(identifier,"fac")==0)
    {
        ///dooo youur stuff for faction chat
    } 
}
now your commands for radio would be like:
Код:
/r fam [text] ///this is message to your family radio
/r fac [text] ///this is message to your faction radio
Give me errors, not like that man
Reply
#7

Код:
CMD:/r(playerid,params[])
{
    if(iGroupID = PlayerInfo[playerid][pMember]==0,PlayerInfo[playerid][pFMember]!=0)
    {
        ////do only family chat
    }
    if(iGroupID = PlayerInfo[playerid][pMember]!=0,PlayerInfo[playerid][pFMember]==0)
    {
        ////do only faction chat
    }
    new text[128],identifier[3];
    if(sscanf(params,"s[1]s[128]",identifier,text)) return //dosomething
    if(strcmp(identifier,"fam")==0)
    {
         ///dooo youur stuff for family chat
    }
    if(strcmp(identifier,"fac")==0)
    {
        ///dooo youur stuff for faction chat
    } 
}
also this is for if person is only in famly or only in faction. Also ofcourse it will give errors this is just basic example you need to edit all your commands. If i did them all for you whats the point ?
Reply
#8

do them for me then <3

this /fr for family
Код:
CMD:fr(playerid, params[])
{
	if(gFam[playerid] == 1)
	{
		SendClientMessageEx(playerid, COLOR_GRAD2, "You have your family chat disabled. /togfamily!");
		return 1;
	}

    new fam = PlayerInfo[playerid][pFMember];
	new string[128];
	if(isnull(params)) return SendClientMessageEx(playerid, COLOR_GREY, "USAGE: (/f)amily [radio chat]");

	if(IsAHitman(playerid))
	{
		format(string, sizeof(string), "** (%d) %s %s: %s **", PlayerInfo[playerid][pRank], arrGroupRanks[PlayerInfo[playerid][pMember]][PlayerInfo[playerid][pRank]], GetPlayerNameEx(playerid), params);
		SendFamilyMessage(PlayerInfo[playerid][pMember], FamilyInfo[fam][FamilyColor], string);
	}
	else if(PlayerInfo[playerid][pFMember] < INVALID_FAMILY_ID)
	{
	    if(0 <= PlayerInfo[playerid][pDivision] < 5)
	    {
	        new division[GROUP_MAX_DIV_LEN];
	        format(division, sizeof(division), "%s", FamilyDivisionInfo[PlayerInfo[playerid][pFMember]][PlayerInfo[playerid][pDivision]]);
		    format(string, sizeof(string), "** (%i) %s (%s) %s: %s **", PlayerInfo[playerid][pRank], FamilyRankInfo[fam][PlayerInfo[playerid][pRank]], division, GetPlayerNameEx(playerid), params);
			switch(FamilyInfo[fam][FamilyColor])
	        {
				case 0: // Black
				{
					SendNewFamilyMessage(PlayerInfo[playerid][pFMember], COLOR_BLACK, string);
				}
				case 1: // White
				{
					SendNewFamilyMessage(PlayerInfo[playerid][pFMember], COLOR_WHITE, string);
				}
				case 2: // Red
				{
					SendNewFamilyMessage(PlayerInfo[playerid][pFMember], COLOR_TWRED, string);
				}
				case 3: // Blue
				{
					SendNewFamilyMessage(PlayerInfo[playerid][pFMember], COLOR_TWBLUE, string);
				}
				case 4: // Yellow
				{
					SendNewFamilyMessage(PlayerInfo[playerid][pFMember], COLOR_TWYELLOW, string);
				}
				case 5: // Purple
				{
					SendNewFamilyMessage(PlayerInfo[playerid][pFMember], COLOR_TWPURPLE, string);
				}
				case 6: // Pink
				{
					SendNewFamilyMessage(PlayerInfo[playerid][pFMember], COLOR_TWPINK, string);
				}
				case 7: // Brown
				{
					SendNewFamilyMessage(PlayerInfo[playerid][pFMember], COLOR_TWBROWN, string);
				}
				case 8: // Gray
				{
					SendNewFamilyMessage(PlayerInfo[playerid][pFMember], COLOR_TWGRAY, string);
				}
				case 9: // Olive
				{
					SendNewFamilyMessage(PlayerInfo[playerid][pFMember], COLOR_TWOLIVE, string);
				}
				case 10: // Tan
				{
				    SendNewFamilyMessage(PlayerInfo[playerid][pFMember], COLOR_TWTAN, string);
				}
				case 11: // Aqua
				{
					SendNewFamilyMessage(PlayerInfo[playerid][pFMember], COLOR_TWAQUA, string);
				}
				case 12: // Orange
				{
					SendNewFamilyMessage(PlayerInfo[playerid][pFMember], COLOR_TWORANGE, string);
				}
				case 13: // Azure
				{
					SendNewFamilyMessage(PlayerInfo[playerid][pFMember], COLOR_TWAZURE, string);
				}
				case 14: // Green
				{
					SendNewFamilyMessage(PlayerInfo[playerid][pFMember], COLOR_TWGREEN, string);
					
				}
			}
		}
		else
		{
		    format(string, sizeof(string), "** (%i) %s %s: %s **", PlayerInfo[playerid][pRank], FamilyRankInfo[fam][PlayerInfo[playerid][pRank]], GetPlayerNameEx(playerid), params);
			switch(FamilyInfo[fam][FamilyColor])
	        {
				case 0: // Black
				{
					SendNewFamilyMessage(PlayerInfo[playerid][pFMember], COLOR_BLACK, string);
				}
				case 1: // White
				{
					SendNewFamilyMessage(PlayerInfo[playerid][pFMember], COLOR_WHITE, string);
				}
				case 2: // Red
				{
					SendNewFamilyMessage(PlayerInfo[playerid][pFMember], COLOR_TWRED, string);
				}
				case 3: // Blue
				{
					SendNewFamilyMessage(PlayerInfo[playerid][pFMember], COLOR_TWBLUE, string);
				}
				case 4: // Yellow
				{
					SendNewFamilyMessage(PlayerInfo[playerid][pFMember], COLOR_TWYELLOW, string);
				}
				case 5: // Purple
				{
					SendNewFamilyMessage(PlayerInfo[playerid][pFMember], COLOR_TWPURPLE, string);
				}
				case 6: // Pink
				{
					SendNewFamilyMessage(PlayerInfo[playerid][pFMember], COLOR_TWPINK, string);
				}
				case 7: // Brown
				{
					SendNewFamilyMessage(PlayerInfo[playerid][pFMember], COLOR_TWBROWN, string);
				}
				case 8: // Gray
				{
					SendNewFamilyMessage(PlayerInfo[playerid][pFMember], COLOR_TWGRAY, string);
				}
				case 9: // Olive
				{
					SendNewFamilyMessage(PlayerInfo[playerid][pFMember], COLOR_TWOLIVE, string);
				}
				case 10: // Tan
				{
				    SendNewFamilyMessage(PlayerInfo[playerid][pFMember], COLOR_TWTAN, string);
				}
				case 11: // Aqua
				{
					SendNewFamilyMessage(PlayerInfo[playerid][pFMember], COLOR_TWAQUA, string);
				}
				case 12: // Orange
				{
					SendNewFamilyMessage(PlayerInfo[playerid][pFMember], COLOR_TWORANGE, string);
				}
				case 13: // Azure
				{
					SendNewFamilyMessage(PlayerInfo[playerid][pFMember], COLOR_TWAZURE, string);
				}
				case 14: // Green
				{
					SendNewFamilyMessage(PlayerInfo[playerid][pFMember], COLOR_TWGREEN, string);

				}
			}
		}
	}
	else
	{
		SendClientMessageEx(playerid, COLOR_GRAD2, "You are not in a family.");
	}
	return 1;
}
this /r for faction
Код:
CMD:r(playerid, params[]) {

	new
		iGroupID = PlayerInfo[playerid][pMember],
		iRank = PlayerInfo[playerid][pRank];

	if (0 <= iGroupID < MAX_GROUPS) {
 		if (iRank >= arrGroupData[iGroupID][g_iRadioAccess]) {
			if(GetPVarInt(playerid, "togRadio") == 0) {
				if(!isnull(params))
				{
					new string[128], employer[GROUP_MAX_NAME_LEN], rank[GROUP_MAX_RANK_LEN], division[GROUP_MAX_DIV_LEN];
					format(string, sizeof(string), "(radio) %s", params);
					SetPlayerChatBubble(playerid, string, COLOR_WHITE, 15.0, 5000);
					GetPlayerGroupInfo(playerid, rank, division, employer);
					format(string, sizeof(string), "** [%s] %s (%s) %s: %s **", PlayerInfo[playerid][pBadge], rank, division, GetPlayerNameEx(playerid), params);
					foreach(new i: Player)
					{
						if(GetPVarInt(i, "togRadio") == 0)
						{
							if(PlayerInfo[i][pMember] == iGroupID && iRank >= arrGroupData[iGroupID][g_iRadioAccess]) {
								SendClientMessageEx(i, arrGroupData[iGroupID][g_hRadioColour] * 256 + 255, string);
							}
							if(GetPVarInt(i, "BigEar") == 1 || GetPVarInt(i, "BigEar") == 4 && GetPVarInt(i, "BigEarGroup") == iGroupID) {
								new szBigEar[128];
								format(szBigEar, sizeof(szBigEar), "(BE) %s", string);
								SendClientMessageEx(i, arrGroupData[iGroupID][g_hRadioColour] * 256 + 255, szBigEar);
							}
						}
					}
				}
				else return SendClientMessageEx(playerid, COLOR_GREY, "USAGE: (/r)adio [radio chat]");
			}
			else return SendClientMessageEx(playerid, COLOR_GREY, "Your radio is currently turned off, type /togradio to turn it back on.");
		}
		else return SendClientMessageEx(playerid, COLOR_GREY, "You do not have access to this radio frequency.");
	}
	else return SendClientMessageEx(playerid, COLOR_GREY, "You are not in a group.");
	return 1;
}
Reply
#9

Please?
Reply
#10

You mean family & faction in /radio chat ?
Reply
#11

I never understood why some scripts make families and factions different while it'd be so much easier to use "factions" as a base for both illegal and legal factions. I feel like it'd be much easier for you to simply remove families and stick only to factions.
Reply
#12

Quote:
Originally Posted by thefirestate
Посмотреть сообщение
I never understood why some scripts make families and factions different while it'd be so much easier to use "factions" as a base for both illegal and legal factions. I feel like it'd be much easier for you to simply remove families and stick only to factions.
Because you can't be undercover without setting the tags for both the gang you are in and the faction...
Reply
#13

I've seen quite a few servers where they have faction instead of families and factions and they do just fine tho'
Reply
#14

Quote:
Originally Posted by thefirestate
Посмотреть сообщение
I've seen quite a few servers where they have faction instead of families and factions and they do just fine tho'
if you are using same faction variable for both a crime family and and a police faction, a person cant be in a crime family and going undercover police working for his crime family. And that could happen in real life. Well instead of liek this i use my radio chat like
Код:
/setchannel [radiochannel]
/r [text goes to radio channel he selected]
its more easy to use as he has a secondary job and lets say he is trucker and theres also radio channel for truckers too. He can just do /setchannel and directly talk with other people in that channel.
Reply
#15

Quote:
Originally Posted by thefirestate
Посмотреть сообщение
I've seen quite a few servers where they have faction instead of families and factions and they do just fine tho'
So you know what variables they use, by just playing on them.... Riiiggghhhttt....
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)