Register Dictionary

Tutoriale scripting, cod si portiuni de cod.

Moderators: Moderatori ajutatori, Moderatori, Echipa eXtreamCS.com

Post Reply
User avatar
Adventx
Membru, skill +4
Membru, skill +4
Posts: 1785
Joined: 17 Sep 2013, 20:44
Detinator Steam: Da
Reputatie: Fost moderator ajutator
Has thanked: 125 times
Been thanked: 142 times
Contact:

27 Dec 2013, 20:33

Image
Salut, astazi vreau sa va arat cum sa inregistrati un dictionary, adica sa citeasca mesajele dintr-un fisier .txt, mai pe scurt sa citeasca un fisier din data/lang/nume_dictionary.txt :P

1. Creeam un plugin nou

Code: Select all

/* Plugin generated by AMXX-Studio */

#include <amxmodx>

#define PLUGIN "Tutorial: Register Dictionary"
#define VERSION "1.0"
#define AUTHOR "Adventx"


public plugin_init() {
	register_plugin(PLUGIN, VERSION, AUTHOR)
	
	// Add your code here...
}

2. Inregistram fisierul

Code: Select all

/* Plugin generated by AMXX-Studio */

#include <amxmodx>

#define PLUGIN "Tutorial: Register Dictionary"
#define VERSION "1.0"
#define AUTHOR "Adventx"


public plugin_init() {
	register_plugin(PLUGIN, VERSION, AUTHOR)
	
	register_dictionary("nume_dictionary.txt")
}

3. Sa afisam un mesaj la conectare care o sa fie ales din fisierul nume_dictionary.txt care se afla in data/lang

Code: Select all

/* Plugin generated by AMXX-Studio */

#include <amxmodx>

#define PLUGIN "Tutorial: Register Dictionary"
#define VERSION "1.0"
#define AUTHOR "Adventx"


public plugin_init() {
	register_plugin(PLUGIN, VERSION, AUTHOR)
	
	register_dictionary("nume_dictionary.txt")
}

public client_connect(id)
{
	client_print(id, print_chat, "%L", id, "USER_CONNECTED")
}
4. Fisierul nume_dictionary.txt trebue sa arate asa

Code: Select all

[en]
USER_CONNECTED = Welcome to eXtreamCS.Com

[ro]
USER_CONNECTED = Bine ati venit pe eXtreamCS.Com
5. Tot asa putem defini mai multe intr-un singur rind

Code: Select all

/* Plugin generated by AMXX-Studio */

#include <amxmodx>

#define PLUGIN "Tutorial: Register Dictionary"
#define VERSION "1.0"
#define AUTHOR "Adventx"


public plugin_init() {
	register_plugin(PLUGIN, VERSION, AUTHOR)
	
	register_dictionary("nume_dictionary.txt")
}

public client_connect(id)
{
	client_print(id, print_chat, "%L", id, "USER_CONNECTED, COMMUNITY_NAME")
}
6. Fisierul nume_dictionary.txt trebue sa arate asa

Code: Select all

[en]
USER_CONNECTED = Welcome to
COMMUNITY_NAME = eXtreamCS.Com

[ro]
USER_CONNECTED = Bine ati venit pe
COMMUNITY_NAME = eXtreamCS.Com
Mulumesc lui CryWolf pentru corectare register_library in register_dictionary
Scuzati daca nu am explicat bine, nu am limbajul Pawn bine dezvoltat :">
Last edited by Adventx on 29 Dec 2013, 12:21, edited 4 times in total.
Rapidserver
LordOfNothing
Membru, skill +1
Membru, skill +1
Posts: 387
Joined: 19 Jul 2013, 14:51
Detinator Steam: Nu
Reputatie: Restrictie PM
Has thanked: 11 times
Been thanked: 34 times

29 Dec 2013, 10:07

defapt library e fisier .inc unde scrii functii si eventuri , ar trebui sa denumesti tutorialul in "multi language"
User avatar
CryWolf
Fost moderator
Fost moderator
Posts: 6343
Joined: 07 Aug 2008, 15:33
Detinator Steam: Da
Reputatie: Administrator
Fost Scripter
Detinator ZM.eXtream.Ro
Fost manager CS.eXtream.Ro
Fost manager CSGO.eXtream.Ro
Fost manager global
Location: Botosani
Has thanked: 185 times
Been thanked: 821 times
Contact:

29 Dec 2013, 10:31

LordOfNothing wrote:defapt library e fisier .inc unde scrii functii si eventuri , ar trebui sa denumesti tutorialul in "multi language"
Eu cred ca numele corect este "dictionary" ? de ce folosesti register_dictionary ?

Apropo ai gresit trebuie sa folsesti register_library ( "nume_librarie.txt ") cu register_dictionary ( "nume_librarie.txt" )
:P Multumim de tutorial multora le va fi util!
De vanzare Zombie Sparkle++- O imbunatatita versiunde de ZP
MetaMod Enhanced v1.0.0 - O versiune de metamod fara meta list si Updatata in ultimul SDK
Vrei un CS fara binduri, slowhack, si curat din SteamPipe? Counter-Strike UPDATE 9.March.2017
munir
Membru eXtream
Membru eXtream
Posts: 3193
Joined: 30 Aug 2012, 21:16
Detinator Steam: Da
CS Status: Fost scripter
Detinator server CS: Nu
SteamID: -
Reputatie: Fost super moderator
Restrictie schimbare nume
Nume anterior: falseq, cruyff
Location: Bucuresti
Has thanked: 335 times
Been thanked: 570 times
Contact:

29 Dec 2013, 11:28

Felicitari, foarte util tutorialul.
Retras
User avatar
Adventx
Membru, skill +4
Membru, skill +4
Posts: 1785
Joined: 17 Sep 2013, 20:44
Detinator Steam: Da
Reputatie: Fost moderator ajutator
Has thanked: 125 times
Been thanked: 142 times
Contact:

29 Dec 2013, 12:19

CryWolf wrote:
LordOfNothing wrote:defapt library e fisier .inc unde scrii functii si eventuri , ar trebui sa denumesti tutorialul in "multi language"
Eu cred ca numele corect este "dictionary" ? de ce folosesti register_dictionary ?

Apropo ai gresit trebuie sa folsesti register_library ( "nume_librarie.txt ") cu register_dictionary ( "nume_librarie.txt" )
:P Multumim de tutorial multora le va fi util!
Multumesc CryWolf, ma bucur sa aud asta :">
User avatar
Adventx
Membru, skill +4
Membru, skill +4
Posts: 1785
Joined: 17 Sep 2013, 20:44
Detinator Steam: Da
Reputatie: Fost moderator ajutator
Has thanked: 125 times
Been thanked: 142 times
Contact:

29 Dec 2013, 12:19

cruyff wrote:Felicitari, foarte util tutorialul.
Multumesc cruyff :)
LordOfNothing
Membru, skill +1
Membru, skill +1
Posts: 387
Joined: 19 Jul 2013, 14:51
Detinator Steam: Nu
Reputatie: Restrictie PM
Has thanked: 11 times
Been thanked: 34 times

27 Mar 2014, 10:40

Apropo, pentru variabile :

Code: Select all

public client_connect(id)
{
   new value = 5;

   client_print(id, print_chat, "%L", id, "MY_NUMBER", value)
}

Code: Select all

[en]
MY_NUMBER = My favorite number is %i

[ro]
MY_NUMBER = Numarul meu favorit este %i
Ati inteles voi nu ii asa ?
Post Reply

Return to “Scripting”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 3 guests