←  Multilingual

AMXX.pl: Support AMX Mod X i SourceMod

»

help with prefix ADMIN

Zablokowany

  • +
  • -
amateuer - zdjęcie amateuer 14.08.2010

hello,

I have some problem with my script.

i have when player got before name ADMIN he can control cwtg plugin.

if(containi(name, "ADMIN"))

but its possible to change from "before name" to accross name, because some ppls gor before name CLAN TAG.

Thank you.
Odpowiedz

  • +
  • -
DarkGL - zdjęcie DarkGL 15.08.2010

This method of searching isn't good
before
	if(equali(name, "ADMIN"),5){
                            //he have ADMIN before name
        }

accross

        new iSize = strlen(name) - 5;
	if(iSize > 0){
		if(equali(name[iSize], "ADMIN")){
			//also he have ADMIN but on end
                }
        }

Użytkownik DarkGL edytował ten post 15.08.2010 08:40
Odpowiedz

  • +
  • -
amateuer - zdjęcie amateuer 15.08.2010

doesnt work :( .Now u can start knife with or without "ADMIN"


public nozik(id) {
        new name[32]
        new auth[64]
        get_user_name(id, name, 31)
        get_user_authid (id, auth, 63)
        new iSize = strlen(name) - 5;
        if(iSize > 0){
                if(equali(name[iSize], "ADMIN")){
        }
}
        if (g_match_inprogress != 1) {
                g_match_inprogress = 0

                set_task(1.0, "restart_round", 0, "1", 1)
                set_task(2.0, "mp_startmoney", 800, "800", 800)
                set_cvar_num("mp_freezetime", 10)
                set_task(3.0, "strip_weapons")
                set_task(4.0, "knife_msg")
                client_print (0, print_chat, "%L", id, "noze", name, auth)
        } else {
                client_print(id, print_chat, "%L", id, "nelze_noze")
        }

        return PLUGIN_HANDLED
}

Odpowiedz

  • +
  • -
R3X - zdjęcie R3X 15.08.2010

You put condition in place with no influence on function, try this
public nozik(id) {
        new name[32]
        new auth[64]
        get_user_name(id, name, 31)
        get_user_authid (id, auth, 63)

        new iSize = strlen(name) - 5;
        if(iSize <= 0 || !equali(name[iSize], "ADMIN") )
		client_print(id, print_chat, "No access!");
        	return PLUGIN_HANDLED
	}

        if (g_match_inprogress != 1) {
                g_match_inprogress = 0

                set_task(1.0, "restart_round", 0, "1", 1)
                set_task(2.0, "mp_startmoney", 800, "800", 800)
                set_cvar_num("mp_freezetime", 10)
                set_task(3.0, "strip_weapons")
                set_task(4.0, "knife_msg")
                client_print (0, print_chat, "%L", id, "noze", name, auth)
        } else {
                client_print(id, print_chat, "%L", id, "nelze_noze")
        }

        return PLUGIN_HANDLED
}
Odpowiedz

  • +
  • -
amateuer - zdjęcie amateuer 16.08.2010

Thank you, your code help me a lot (i did same changes) but coding help me.Thank you again, btw. its possible add some condition that can be only one player with "ADMIN"
Odpowiedz

  • +
  • -
R3X - zdjęcie R3X 16.08.2010

only with loop for each player


for make it easier create function
bool:has_admin_name(id){
	new name[32];
	get_user_name(id, name, 31);

	new iSize = strlen(name) - 5;
        if(iSize > 0 && equali(name[iSize], "ADMIN") )  	
		return true;

	return false;
}

and check number of ADMINS
new count = 0;
new iMax = get_playersnum();
for(new i=1;<=iMax;i++){
	if(is_user_connected(i) && has_admin_name(i)) count++;
}

client_print(0, print_chat, "Found %d admins there", count);

you could get admins num on client_putinserver and client_infochanged to kick player, who is trying to get ADMIN status as second person
Odpowiedz

  • +
  • -
amateuer - zdjęcie amateuer 18.08.2010

doesnt work :( .Now u can start knife with or without "ADMIN"


public nozik(id) {
        new name[32]
        new auth[64]
        get_user_name(id, name, 31)
        get_user_authid (id, auth, 63)

        new iSize = strlen(name) - 5;
        if(iSize <= 0 || !equali(name[iSize], "ADMIN") )
		client_print(id, print_chat, "No access!");
        	return PLUGIN_HANDLED
	}

        if (g_match_inprogress != 1) {
                g_match_inprogress = 0

                set_task(1.0, "restart_round", 0, "1", 1)
                set_task(2.0, "mp_startmoney", 800, "800", 800)
                set_cvar_num("mp_freezetime", 10)
                set_task(3.0, "strip_weapons")
                set_task(4.0, "knife_msg")
                client_print (0, print_chat, "%L", id, "noze", name, auth)
        } else {
                client_print(id, print_chat, "%L", id, "nelze_noze")
        }

        return PLUGIN_HANDLED
}



something strange, when i used it my global chat was blocked, did i something wrong?
Użytkownik amateuer edytował ten post 18.08.2010 16:50
Odpowiedz

  • +
  • -
R3X - zdjęcie R3X 18.08.2010

if nozik handles chat its normal
register_clcmd("say", "nozik");
then
return PLUGIN_HANDLED
block your chat messages
Odpowiedz

  • +
  • -
amateuer - zdjęcie amateuer 19.08.2010

ah! mistake was in different code in my plugin, which disabled my chat :)

I will try find any solution.

26 sierpień 2010 - 18:23:
Close please, thank you.Sorry for delay.
Użytkownik amateuer edytował ten post 19.08.2010 21:47
Odpowiedz

Adminek AMXX.PL - zdjęcie Adminek AMXX.PL 26.08.2010

Wiadomość wygenerowana automatycznie


Ten temat został zamknięty przez moderatora.

Powód: Problem solved

Jeśli się z tym nie zgadzasz, Dołączona grafika raportuj ten post, a moderator lub administrator rozpatrzy go ponownie.


Z pozdrowieniami,
Zespół AMXX.PL
Odpowiedz
Zablokowany