Jump to content

Recommended Posts

Salut, am incercat si eu sa fac comanda /d, totul merge perfect dar ... cand dau /d si ai admin primesti de 2 ori textul, se poate sa se rezolve ?

PS : Primesti de 2 ori textul daca esti si admin si pd.

Comanda :

	YCMD:departments(playerid, params[], help) {
    new text[250],sendername[MAX_PLAYER_NAME],string[200];
    if(PlayerInfo[playerid][pMuted] == 1)
    {
        format(string, sizeof(string), "You can't talk right now! You are muted. (%d seconds)",PlayerInfo[playerid][pMuteTime]);
        SCM(playerid, COLOR_GREY, string);
        return true;
    }
    GetPlayerName(playerid, sendername, sizeof(sendername));
    if(sscanf(params, "s[250]", text)) return SCM(playerid, COLOR_GREY, "Syntax: {FFFFFF}/d <text>");
    if(FaceReclama(text)) return RemoveFunction(playerid, text);
    if(FaceReclama(text)) return Reclama(playerid, text);
    if(PlayerInfo[playerid][pMember] == 1 || PlayerInfo[playerid][pLeader] == 1) format(string, sizeof(string), "* %s %s: %s, over.", GetRankName(playerid), sendername, text);
    else if(PlayerInfo[playerid][pMember] == 2 || PlayerInfo[playerid][pLeader] == 2) format(string, sizeof(string), "* %s %s: %s, over.", GetRankName(playerid), sendername, text);
    else if(PlayerInfo[playerid][pMember] == 3 || PlayerInfo[playerid][pLeader] == 3) format(string, sizeof(string), "* %s %s: %s, over.", GetRankName(playerid), sendername, text);
    else if(PlayerInfo[playerid][pMember] == 13 || PlayerInfo[playerid][pLeader] == 13) format(string, sizeof(string), "* %s %s: %s, over.", GetRankName(playerid), sendername, text);
    else if(PlayerInfo[playerid][pMember] == 14 || PlayerInfo[playerid][pLeader] == 14) format(string, sizeof(string), "* %s %s: %s, over.", GetRankName(playerid), sendername, text);
    else if(PlayerInfo[playerid][pScripter] == 2) format(string, sizeof(string), "* Scripter %s: %s, over.", GetRankName(playerid), sendername, text);
    else if(PlayerInfo[playerid][pAdmin] != 0) format(string, sizeof(string), "* Admin %s: %s, over.", sendername, text);
    else return SCM(playerid, COLOR_GREY, "Nu faci parte din factiunea politiei.");
    SendTeamMessage(3, COLOR_DEPART2, string);
    SendTeamMessage(2, COLOR_DEPART2, string);
    SendTeamMessage(1, COLOR_DEPART2, string);
    SendTeamMessage(13, COLOR_DEPART2, string);
    SendTeamMessage(14, 0x2e64feFF, string);
    SendAdminMessage(COLOR_DEPART2, string, 1);
    return true;
}
	function SendUserMessage(color, text[], userid) {
    foreach(Player, i) {
        if(PlayerInfo[i][pSQLID] != userid)
            continue;
	        SCM(i, color, text);
    }
    return true;
}
	

Multumesc pentru atentie.

PS: Vreau in continuare sa apara mesajele si adminilor, dar sa nu mai apara 2 mesaje.

Edited by jumainkain
Link to post
Share on other sites
La 23.12.2019 la 22:49, jumainkain a spus:

Salut, am incercat si eu sa fac comanda /d, totul merge perfect dar ... cand dau /d si ai admin primesti de 2 ori textul, se poate sa se rezolve ?

PS : Primesti de 2 ori textul daca esti si admin si pd.

Comanda :

	YCMD:departments(playerid, params[], help) {
    new text[250],sendername[MAX_PLAYER_NAME],string[200];
    if(PlayerInfo[playerid][pMuted] == 1)
    {
        format(string, sizeof(string), "You can't talk right now! You are muted. (%d seconds)",PlayerInfo[playerid][pMuteTime]);
        SCM(playerid, COLOR_GREY, string);
        return true;
    }
    GetPlayerName(playerid, sendername, sizeof(sendername));
    if(sscanf(params, "s[250]", text)) return SCM(playerid, COLOR_GREY, "Syntax: {FFFFFF}/d <text>");
    if(FaceReclama(text)) return RemoveFunction(playerid, text);
    if(FaceReclama(text)) return Reclama(playerid, text);
    if(PlayerInfo[playerid][pMember] == 1 || PlayerInfo[playerid][pLeader] == 1) format(string, sizeof(string), "* %s %s: %s, over.", GetRankName(playerid), sendername, text);
    else if(PlayerInfo[playerid][pMember] == 2 || PlayerInfo[playerid][pLeader] == 2) format(string, sizeof(string), "* %s %s: %s, over.", GetRankName(playerid), sendername, text);
    else if(PlayerInfo[playerid][pMember] == 3 || PlayerInfo[playerid][pLeader] == 3) format(string, sizeof(string), "* %s %s: %s, over.", GetRankName(playerid), sendername, text);
    else if(PlayerInfo[playerid][pMember] == 13 || PlayerInfo[playerid][pLeader] == 13) format(string, sizeof(string), "* %s %s: %s, over.", GetRankName(playerid), sendername, text);
    else if(PlayerInfo[playerid][pMember] == 14 || PlayerInfo[playerid][pLeader] == 14) format(string, sizeof(string), "* %s %s: %s, over.", GetRankName(playerid), sendername, text);
    else if(PlayerInfo[playerid][pScripter] == 2) format(string, sizeof(string), "* Scripter %s: %s, over.", GetRankName(playerid), sendername, text);
    else if(PlayerInfo[playerid][pAdmin] != 0) format(string, sizeof(string), "* Admin %s: %s, over.", sendername, text);
    else return SCM(playerid, COLOR_GREY, "Nu faci parte din factiunea politiei.");
    SendTeamMessage(3, COLOR_DEPART2, string);
    SendTeamMessage(2, COLOR_DEPART2, string);
    SendTeamMessage(1, COLOR_DEPART2, string);
    SendTeamMessage(13, COLOR_DEPART2, string);
    SendTeamMessage(14, 0x2e64feFF, string);
    SendAdminMessage(COLOR_DEPART2, string, 1);
    return true;
}
	function SendUserMessage(color, text[], userid) {
    foreach(Player, i) {
        if(PlayerInfo[i][pSQLID] != userid)
            continue;
	        SCM(i, color, text);
    }
    return true;
}
	

Multumesc pentru atentie.

PS: Vreau in continuare sa apara mesajele si adminilor, dar sa nu mai apara 2 mesaje.

SendAdminMessage(COLOR_DEPART2, string, 1);

cred ca asta este problema, ai folosit aceeasi culoare, acelasi string si se trimite mesajul de 2 ori, sterge aceasta functie si incearca din nou

Link to post
Share on other sites
La 23.12.2019 la 22:49, jumainkain a spus:

Salut, am incercat si eu sa fac comanda /d, totul merge perfect dar ... cand dau /d si ai admin primesti de 2 ori textul, se poate sa se rezolve ?

PS : Primesti de 2 ori textul daca esti si admin si pd.

Comanda :

	YCMD:departments(playerid, params[], help) {
    new text[250],sendername[MAX_PLAYER_NAME],string[200];
    if(PlayerInfo[playerid][pMuted] == 1)
    {
        format(string, sizeof(string), "You can't talk right now! You are muted. (%d seconds)",PlayerInfo[playerid][pMuteTime]);
        SCM(playerid, COLOR_GREY, string);
        return true;
    }
    GetPlayerName(playerid, sendername, sizeof(sendername));
    if(sscanf(params, "s[250]", text)) return SCM(playerid, COLOR_GREY, "Syntax: {FFFFFF}/d <text>");
    if(FaceReclama(text)) return RemoveFunction(playerid, text);
    if(FaceReclama(text)) return Reclama(playerid, text);
    if(PlayerInfo[playerid][pMember] == 1 || PlayerInfo[playerid][pLeader] == 1) format(string, sizeof(string), "* %s %s: %s, over.", GetRankName(playerid), sendername, text);
    else if(PlayerInfo[playerid][pMember] == 2 || PlayerInfo[playerid][pLeader] == 2) format(string, sizeof(string), "* %s %s: %s, over.", GetRankName(playerid), sendername, text);
    else if(PlayerInfo[playerid][pMember] == 3 || PlayerInfo[playerid][pLeader] == 3) format(string, sizeof(string), "* %s %s: %s, over.", GetRankName(playerid), sendername, text);
    else if(PlayerInfo[playerid][pMember] == 13 || PlayerInfo[playerid][pLeader] == 13) format(string, sizeof(string), "* %s %s: %s, over.", GetRankName(playerid), sendername, text);
    else if(PlayerInfo[playerid][pMember] == 14 || PlayerInfo[playerid][pLeader] == 14) format(string, sizeof(string), "* %s %s: %s, over.", GetRankName(playerid), sendername, text);
    else if(PlayerInfo[playerid][pScripter] == 2) format(string, sizeof(string), "* Scripter %s: %s, over.", GetRankName(playerid), sendername, text);
    else if(PlayerInfo[playerid][pAdmin] != 0) format(string, sizeof(string), "* Admin %s: %s, over.", sendername, text);
    else return SCM(playerid, COLOR_GREY, "Nu faci parte din factiunea politiei.");
    SendTeamMessage(3, COLOR_DEPART2, string);
    SendTeamMessage(2, COLOR_DEPART2, string);
    SendTeamMessage(1, COLOR_DEPART2, string);
    SendTeamMessage(13, COLOR_DEPART2, string);
    SendTeamMessage(14, 0x2e64feFF, string);
    SendAdminMessage(COLOR_DEPART2, string, 1);
    return true;
}
	function SendUserMessage(color, text[], userid) {
    foreach(Player, i) {
        if(PlayerInfo[i][pSQLID] != userid)
            continue;
	        SCM(i, color, text);
    }
    return true;
}
	

Multumesc pentru atentie.

PS: Vreau in continuare sa apara mesajele si adminilor, dar sa nu mai apara 2 mesaje.

Intrebarea este urmatoarea: adminul se afla in factiunile la care trimiti mesajul? Am o idee despre a folosi foreach si verifici daca playerii din foreach au admin si sa il trimiti cu scm.

Link to post
Share on other sites
Acum 17 ore, BaFFyJunior a spus:

Intrebarea este urmatoarea: adminul se afla in factiunile la care trimiti mesajul? Am o idee despre a folosi foreach si verifici daca playerii din foreach au admin si sa il trimiti cu scm.

Da, daca esti din factiunea de tip departament si esti si admin ,primesti de 2 ori textul.

Link to post
Share on other sites
Acum 9 ore, jumainkain a spus:

Da, daca esti din factiunea de tip departament si esti si admin ,primesti de 2 ori textul.

Pai deaia se trimite... ca idee:
fa cu foreach in loc de sendadminmessage cam asa:
 

foreach(new i:Player)
{
	if(PlayerInfo[i][pAdmin] > 0 && PlayerInfo[i][pMember] != 3) SCM ....
}

Sau fa o functie care sa verifice daca playerul e in departament:
 

function IsInDept(playerid)
{
  if(PlayerInfo[playerid][pMember] == 3 || PlayerInfo[playerid][pMember] == 2  || PlayerInfo[playerid][pMember] == 1 || PlayerInfo[playerid]   [pMember] == 13  || PlayerInfo[playerid][pMember] == 14)
  {
     return 1;
  }
  return 0;
}

Si faci asa:

in loc de SendAdminMessage pui:

foreach(new i:Player)
{
	if(PlayerInfo[i][pAdmin] > 0 && !IsInDept(i)) SCM ....
}
Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...

Important Information

This site uses cookies. By continuing browsing, you agree to the use of this information. For more details, see Terms of Use and Privacy Policy.