Read flags [Problema minora]

Modificari necesare ale pluginurilor

Moderators: Moderatori ajutatori, Moderatori, Echipa eXtreamCS.com

Post Reply
User avatar
pigmy
Membru, skill +2
Membru, skill +2
Posts: 594
Joined: 14 Dec 2007, 17:49
Detinator Steam: Da
CS Status: PEACE!
Has thanked: 2 times
Been thanked: 23 times

27 Aug 2010, 18:24

O intrebare, minora...pentru un scripter ce le are, mai bine ca mine...
De ce imi citeste doar primul? De ce nu imi citeste urmatorul?

Code: Select all

new const Nume[2][] =
{
	"Marsal",
	"General"
}
new const Flag[2][] =
{
	"abcdefghijklmnopqrstu",
	"abcdefijmnopqrstu"
}
public plugin_init()
{
	register_plugin("Flag", "1.0", "Autor");
	
	register_clcmd("say", "say");
}

public say(id)
{
	for (new i = 0; i < 2; i++)
	{
		if(get_user_flags(id) == read_flags(Flag[i]))
		{
				chat(0, "!y[%s] !g%s !y: !g%s", Nume[i], nume, mesaj);
		}
	}
	return PLUGIN_HANDLED;
}
Reptile
Membru, skill +1
Membru, skill +1
Posts: 245
Joined: 12 Nov 2008, 14:11
Detinator Steam: Nu
Reputatie: Fost manager
Been thanked: 23 times

27 Aug 2010, 21:50

Code: Select all

new const Nume[2][] =
{
   "Marsal",
   "General"
}
new const Flag[2][] =
{
   "abcdefghijklmnopqrstu",
   "abcdefijmnopqrstu"
}
public plugin_init()
{
   register_plugin("Flag", "1.0", "Autor");
   
   register_clcmd("say", "say");
}

public say(id)
{
   for (new i = 0; i < sizeof( Flag ); i++)
   {
      if(get_user_flags(id) == read_flags(Flag[i]))
      {
            chat(0, "!y[%s] !g%s !y: !g%s", Nume[i], nume, mesaj);
      }
   }
   return PLUGIN_HANDLED;
}
User avatar
pigmy
Membru, skill +2
Membru, skill +2
Posts: 594
Joined: 14 Dec 2007, 17:49
Detinator Steam: Da
CS Status: PEACE!
Has thanked: 2 times
Been thanked: 23 times

28 Aug 2010, 00:42

Tot nu functioneaza...de ce? :(
User avatar
Arion
Scripter eXtreamCS
Scripter eXtreamCS
Posts: 3316
Joined: 15 May 2008, 20:19
Detinator Steam: Da
SteamID: arion1338
Reputatie: Fost Mapper eXtreamCS
Fost Detinator HNS.eXtreamCS.com
Nume anterior : Seekers
Scripter Echipa eXtreamCS
Fost Moderator jutator
Location: Copenhagen
Has thanked: 400 times
Been thanked: 412 times
Contact:

28 Aug 2010, 07:43

Code: Select all

#include <amxmodx>
#include <amxmisc>

#define GRUPE 2

new const Nume[GRUPE][] = {
	"Marsal",
	"General"
};

new const Flag[GRUPE][] = {
	"abcdefghijklmnopqrstu",
	"abcdefijmnopqrstu"
};

public plugin_init() {
	register_plugin("Flag", "1.0", "Autor");
   
	register_clcmd("say", "hook_say");
}

public hook_say(id) {
	for (new i = 0; i < (GRUPE + 1); i++) {
		if(get_user_flags(id) == read_flags(Flag[i])) {
			chat(0, "!y[%s] !g%s !y: !g%s", Nume[i], nume, mesaj);
		}
	}
	
	return PLUGIN_HANDLED;
}
Deci tu in for tau ai pus asa:

Code: Select all

for (new i = 0; i < 2; i++)
Traducem:

Code: Select all

pentru ( nou creat i care este 0; atata timp cat este mai mic decat 2; i sa creasca)
Problema este ca tu ai 2 grupuri si ai pus sa fie mai mic decat 2, de aceea trebuie sa fie cu un numar mai mare decat grupurile tale !, cel mai classic folosesti un #define :D
Join the biggest end-game club in Trove
Image
User avatar
pigmy
Membru, skill +2
Membru, skill +2
Posts: 594
Joined: 14 Dec 2007, 17:49
Detinator Steam: Da
CS Status: PEACE!
Has thanked: 2 times
Been thanked: 23 times

28 Aug 2010, 13:49

Ex3cuTioN: Tocmai chiar am vrut sa ocolesc aceasta metoda, nu vreau sa lungesc pluginul, ci sa-l fac mic si functionabil.
User avatar
Arion
Scripter eXtreamCS
Scripter eXtreamCS
Posts: 3316
Joined: 15 May 2008, 20:19
Detinator Steam: Da
SteamID: arion1338
Reputatie: Fost Mapper eXtreamCS
Fost Detinator HNS.eXtreamCS.com
Nume anterior : Seekers
Scripter Echipa eXtreamCS
Fost Moderator jutator
Location: Copenhagen
Has thanked: 400 times
Been thanked: 412 times
Contact:

31 Aug 2010, 13:18

pigmy wrote:Ex3cuTioN: Tocmai chiar am vrut sa ocolesc aceasta metoda, nu vreau sa lungesc pluginul, ci sa-l fac mic si functionabil.
Pai asta e metoda cea mai scurta, si oricum exista pluginuri de peste 5.000 de randuri, oricum nu conteaza cat de lung este pluginul :)
Join the biggest end-game club in Trove
Image
User avatar
Ciprian
Fost administrator
Fost administrator
Posts: 5172
Joined: 10 May 2008, 20:29
Detinator Steam: Da
CS Status: ^^
SteamID: crazycipry
Reputatie: Fost administrator
Fost Scripter eXtreamCS
Fost Supervizor CS.eXtreamCS.com
Fost Unbanner ZM.eXtreamCS.com
Fost Contribuitor
Nume anterior: crazy.cipry
Location: Baia Mare
Has thanked: 176 times
Been thanked: 401 times
Contact:

31 Aug 2010, 15:28

pigmy wrote:Ex3cuTioN: Tocmai chiar am vrut sa ocolesc aceasta metoda, nu vreau sa lungesc pluginul, ci sa-l fac mic si functionabil.
Ce vrei tu sa faci se numeste Hard Coded Paths si in general se recomanda sa eviti acest fel de a scripta.
http://forums.alliedmods.net/showthread ... ight=paths
User avatar
pigmy
Membru, skill +2
Membru, skill +2
Posts: 594
Joined: 14 Dec 2007, 17:49
Detinator Steam: Da
CS Status: PEACE!
Has thanked: 2 times
Been thanked: 23 times

31 Aug 2010, 16:13

Ciprian: Sunt prea obisnuit asa sa el codez...cat mai simple si mai eficiente :-"
Post Reply

Return to “Modificari pluginuri”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 9 guests