[Cerere Pulgin] Promo Code Csgo

Categoria cu cereri de pluginuri si nu numai.

Moderators: Moderatori ajutatori, Moderatori, Echipa eXtreamCS.com

Forum rules
Accesează link-ul pentru a putea vedea regulile forumului

Daca doriti sa vi se modifice un plugin, va rugam postati aici .
User avatar
Reycku
Membru, skill 0
Membru, skill 0
Posts: 68
Joined: 26 Jan 2019, 02:11
Detinator Steam: Da
Detinator server CS: RESPAWN.PUBCS.RO
SteamID: reyck
Fond eXtream: 0
Been thanked: 3 times
Contact:

08 May 2019, 20:47

Ti-am specificat ca am 1.8.2 daca nu ai vazut+ te rog lasa fvault.inc( si lasa-mi ce sa scriu si in folderu.ini te rog)
RoyalServer 2
User avatar
Rainq
Membru, skill +2
Membru, skill +2
Posts: 681
Joined: 21 Jul 2015, 19:50
Detinator Steam: Da
CS Status: Retras
Detinator server CS: zm.extreamcs.com
SteamID: mrainq
Reputatie: Fost super moderator
Fost detinator ZM.eXtreamCS.COM
Fost Membru Club eXtreamCS (trei luni)
Fond eXtream: 0
Location: Bucharest
Discord: manuraiders
Has thanked: 29 times
Been thanked: 51 times
Contact:

08 May 2019, 20:57

Reycku wrote:
08 May 2019, 20:47
Ti-am specificat ca am 1.8.2 daca nu ai vazut+ te rog lasa fvault.inc( si lasa-mi ce sa scriu si in folderu.ini te rog)
fvault.inc

Code: Select all

#if defined _file_vault_included
	#endinput
#endif

#define _file_vault_included

/**
 * FVault was created by Exolent on 8/24/08
 * This vault system uses actual files and no modules
 * It is very flexible and has many features
 * Visit this page for more information: http://forums.alliedmods.net/showthread.php?t=76453
 */

#include <amxmodx>

stock const _vault_dir[] = "addons/amxmodx/data/file_vault";
stock const _temp_vault[] = "fvault_temp.txt";

/** 
 * Retrieves a key name specified by its number
 * 
 * @param vaultname	Vault name to look in
 * @param keynum	Key number within the vault to find key name
 * @param key		String which key name will be copied to
 * @param len		Length of key name
 * @return		Returns 1 on success, 0 on failue.
 */
stock fvault_get_keyname(const vaultname[], const keynum, key[], len)
{
	new filename[128];
	_FormatVaultName(vaultname, filename, sizeof(filename) - 1);
	
	if( !file_exists(filename) )
	{
		return 0;
	}
	
	new vault = fopen(filename, "rt");
	
	new _data[64], _other[3];
	
	new line = -1;
	
	while( !feof(vault) )
	{
		fgets(vault, _data, sizeof(_data) - 1);
		
		if( ++line == keynum )
		{
			parse(_data, key, len, _other, sizeof(_other) - 1);
			
			fclose(vault);
			
			return 1;
		}
	}
	
	fclose(vault);
	
	return 0;
}

/** 
 * Retrieves a key number specified by its name
 * 
 * @param vaultname	Vault name to look in
 * @param key		Key name to search for
 * @return		Returns key number on success, -1 on failure
 */
stock fvault_get_keynum(const vaultname[], const key[])
{
	new filename[128];
	_FormatVaultName(vaultname, filename, sizeof(filename) - 1);
	
	if( !file_exists(filename) )
	{
		return -1;
	}
	
	new vault = fopen(filename, "rt");
	
	new _data[70], _key[64], _other[3];
	
	new line = -1;
	
	while( !feof(vault) )
	{
		fgets(vault, _data, sizeof(_data) - 1);
		parse(_data, _key, sizeof(_key) - 1, _other, sizeof(_other) - 1);
		
		line++;
		
		if( equal(_key, key) )
		{
			fclose(vault);
			
			return line;
		}
	}
	
	fclose(vault);
	
	return -1;
}

/** 
 * Retrieves data specified by a key
 * 
 * @param vaultname	Vault name to look in
 * @param key		Key name to look for the data
 * @param data		String which data will be copied to
 * @param len		Length of data
 * @param timestamp	The unix time of when the data was last set ( -1 if permanent data, 0 if old fvault version ) ( optional param )
 * @return		Returns 1 on success, 0 on failue.
 */
stock fvault_get_data(const vaultname[], const key[], data[], len, &timestamp=0)
{
	new filename[128];
	_FormatVaultName(vaultname, filename, sizeof(filename) - 1);
	
	if( !file_exists(filename) )
	{
		return 0;
	}
	
	new vault = fopen(filename, "rt");
	
	new _data[512], _key[64], _time[32];
	
	while( !feof(vault) )
	{
		fgets(vault, _data, sizeof(_data) - 1);
		parse(_data, _key, sizeof(_key) - 1);
		
		if( equal(_key, key) )
		{
			new _len = strlen(_key) + 4; // + 2 = quotes on key, + 1 = space, + 1 = first quote
			for( new i = copy(data, len, _data[_len]) - 1; i > 0; i-- )
			{
				if( data[i] == '"' ) break;
				
				if( data[i] == ' '
				&& data[i - 1] == '"' )
				{
					data[i - 1] = '^0';
					
					copy(_time, sizeof(_time) - 1, data[i + 1]);
					timestamp = str_to_num(_time);
					break;
				}
			}
			
			fclose(vault);
			
			return 1;
		}
	}
	
	fclose(vault);
	
	copy(data, len, "");
	
	return 0;
}

/** 
 * Sets data of a key with current timestamp
 * 
 * @param vaultname	Vault name to look in
 * @param key		Key name to which data will be set
 * @param data		Data to set to key
 * @return		Does not return a value.
 */
stock fvault_set_data(const vaultname[], const key[], const data[])
{
	_fvault_set_data(vaultname, key, data, get_systime());
}

/** 
 * Sets data of a key permanently (can't be removed with fvault_prune)
 * 
 * @param vaultname	Vault name to look in
 * @param key		Key name to which data will be set
 * @param data		Data to set to key
 * @return		Does not return a value.
 */
stock fvault_pset_data(const vaultname[], const key[], const data[])
{
	_fvault_set_data(vaultname, key, data, -1);
}

_fvault_set_data(const vaultname[], const key[], const data[], const timestamp)
{
	new file = fopen(_temp_vault, "wt");
	
	new filename[128];
	_FormatVaultName(vaultname, filename, sizeof(filename) - 1);
	
	new vault = fopen(filename, "rt");
	
	new _data[512], _key[64], _other[3];
	
	new bool:replaced = false;
	
	while( !feof(vault) )
	{
		fgets(vault, _data, sizeof(_data) - 1);
		parse(_data, _key, sizeof(_key) - 1, _other, sizeof(_other) - 1);
		
		if( equal(_key, key) && !replaced )
		{
			fprintf(file, "^"%s^" ^"%s^" %i^n", key, data, timestamp);
			
			replaced = true;
		}
		else
		{
			fputs(file, _data);
		}
	}
	
	fclose(file);
	fclose(vault);
	
	if( !replaced )
	{
		file = fopen(filename, "a+");
		fprintf(file, "^"%s^" ^"%s^" %i^n", key, data, timestamp);
		fclose(file);
		
		delete_file(_temp_vault);
	}
	else
	{
		delete_file(filename);
		
		while( !rename_file(_temp_vault, filename, 1) ) { }
	}
}

/** 
 * Removes a key from a vault
 * 
 * @param vaultname	Vault name to look in
 * @param key		Key to remove
 * @return		No return
 */
stock fvault_remove_key(const vaultname[], const key[])
{
	new filename[128];
	_FormatVaultName(vaultname, filename, sizeof(filename) - 1);
	
	if( !file_exists(filename) )
	{
		return;
	}
	
	new file = fopen(_temp_vault, "wt");
	
	new vault = fopen(filename, "rt");
	
	new _data[512], _key[64], _other[3];
	new bool:found_key;
	
	while( !feof(vault) )
	{
		fgets(vault, _data, sizeof(_data) - 1);
		parse(_data, _key, sizeof(_key) - 1, _other, sizeof(_other) - 1);
		
		if( equal(_key, key) )
		{
			found_key = true;
			continue;
		}
		
		fputs(file, _data);
	}
	
	fclose(file);
	fclose(vault);
	
	if( found_key )
	{
		delete_file(filename);
		
		while( !rename_file(_temp_vault, filename, 1) ) { }
	}
	else
	{
		delete_file(_temp_vault);
	}
}

/**
 * Prunes the vault for keys that are within the given timestamps
 * 
 * @param vaultname	Vault name to look in
 * @param start		If timestamp is after this Unix Time (set -1 to prune from very start)
 * @param end		If timestamp is before this Unix Time (set -1 to prune to most time)
 * @return		Returns number of keys pruned
 */
stock fvault_prune(const vaultname[], const start=-1, const end=-1)
{
	if( start == -1 && end == -1 )
	{
		new keys = fvault_size(vaultname);
		if( keys )
		{
			fvault_clear(vaultname);
		}
		
		return keys;
	}
	
	new filename[128];
	_FormatVaultName(vaultname, filename, sizeof(filename) - 1);
	
	if( !file_exists(filename) )
	{
		return 0;
	}
	
	new file = fopen(_temp_vault, "wt");
	new vault = fopen(filename, "rt");
	
	new keys;
	
	new data[512], i, _time[32], timestamp;
	while( !feof(vault) )
	{
		fgets(vault, data, sizeof(data) - 1);
		
		if( data[0] )
		{
			_time[0] = 0;
			
			for( i = strlen(data) - 1; i >= 0; i-- )
			{
				if( data[i] == '"' ) break;
				
				if( data[i] == ' ' )
				{
					copy(_time, sizeof(_time) - 1, data[i + 1]);
					break;
				}
			}
			
			timestamp = str_to_num(_time);
			if( timestamp != -1 )
			{
				if( start == -1 && timestamp <= end
				|| end == -1 && timestamp >= start
				|| start <= timestamp <= end )
				{
					keys++;
					continue;
				}
			}
		}
		
		fputs(file, data);
	}
	
	fclose(file);
	fclose(vault);
	
	if( keys )
	{
		delete_file(filename);
		
		while( !rename_file(_temp_vault, filename, 1) ) { }
	}
	else
	{
		delete_file(_temp_vault);
	}
	
	return keys;
}

/**
 * Updates the timestamp on a key located within the vault
 * 
 * @param vaultname	Vault name to look in
 * @param key		Key to update timestamp (if it doesn't exist, a blank value will be set)
 * @param timestamp	Unix Time to set for the key (-1 for current time)
 * @return		Returns 2 on new entry, 1 on success, 0 on failure for the key having a permanent timestamp
 */
stock fvault_touch(const vaultname[], const key[], const timestamp=-1)
{
	new filename[128];
	_FormatVaultName(vaultname, filename, sizeof(filename) - 1);
	
	static new_time;
	if( (new_time = timestamp) == -1 )
	{
		new_time = get_systime();
	}
	
	if( !file_exists(filename) )
	{
		new vault = fopen(filename, "wt");
		fprintf(vault, "^"%s^" ^"^" %i^n", key, new_time);
		fclose(vault);
		return 2;
	}
	
	new file = fopen(_temp_vault, "wt");
	new vault = fopen(filename, "rt");
	
	new bool:updated;
	
	new data[512], _key[64], len, i, _time[32];
	while( !feof(vault) )
	{
		fgets(vault, data, sizeof(data) - 1);
		parse(data, _key, sizeof(_key) - 1);
		
		if( equal(_key, key) )
		{
			_time[0] = 0;
			
			for( i = strlen(data) - 1; i >= 0; i-- )
			{
				if( data[i] == '"' ) break;
				
				if( data[i] == ' ' )
				{
					data[i] = '^0';
					copy(_time, sizeof(_time) - 1, data[i + 1]);
					break;
				}
			}
			
			if( str_to_num(_time) == -1 )
			{
				fclose(file);
				fclose(vault);
				
				delete_file(_temp_vault);
				
				return 0;
			}
			
			fprintf(file, "%s %i^n", data, new_time);
			
			updated = true;
		}
		else
		{
			fputs(file, data);
		}
	}
	
	if( !updated )
	{
		fprintf(file, "^"%s^" ^"^" %i^n", key, new_time);
	}
	
	fclose(file);
	fclose(vault);
	
	delete_file(filename);
	
	while( !rename_file(_temp_vault, filename, 1) ) { }
	
	return (_:(!updated) + 1);
}

/** 
 * Retrieves total keys located within the vault
 * 
 * @param vaultname	Vault name to look in
 * @return		Returns amount of keys in vault
 */
stock fvault_size(const vaultname[])
{
	new filename[128];
	_FormatVaultName(vaultname, filename, sizeof(filename) - 1);
	
	return file_exists(filename) ? file_size(filename, 1) - 1 : 0;
}

/** 
 * Clears all key entries for a vault
 * 
 * @param vaultname	Vault name to erase
 * @return		No return
 */
stock fvault_clear(const vaultname[])
{
 	new filename[128];
	_FormatVaultName(vaultname, filename, sizeof(filename) - 1);
	
	fclose(fopen(filename, "wt"));
}

/** 
 * Retrieves a vault name specified by its number
 * 
 * @param vaultnum	Vault number to find the vault name
 * @param vaultname	String which vault name will be copied to
 * @param len		Length of vault name
 * @return		Returns 1 on success, 0 on failue.
 */
stock fvault_get_vaultname(const vaultnum, vaultname[], len)
{
	if( !dir_exists(_vault_dir) )
	{
		mkdir(_vault_dir);
		return 0;
	}
	
	new filenum;
	
	new dir = open_dir(_vault_dir, vaultname, len);
	
	do
	{
		if( equal(vaultname, ".") || equal(vaultname, "..") )
		{
			continue;
		}
		
		if( filenum == vaultnum )
		{
			close_dir(dir);
			
			replace(vaultname, len, ".txt", "");
			
			return 1;
		}
		
		++filenum;
	}
	while( next_file(dir, vaultname, len) );
	
	close_dir(dir);
	
	copy(vaultname, len, "");
	
	return 0;
}

/** 
 * Retrieves a vault number specified by its name
 * 
 * @param vaultname	Vault name to find the number
 * @return		Returns vault number on success, -1 on failure
 */
stock fvault_get_vaultnum(const vaultname[])
{
	if( !dir_exists(_vault_dir) )
	{
		mkdir(_vault_dir);
		return -1;
	}
	
	new filename[128], filenum;
	
	new dir = open_dir(_vault_dir, filename, sizeof(filename) - 1);
	
	do
	{
		if( equal(filename, ".") || equal(filename, "..") )
		{
			continue;
		}
		
		replace(filename, sizeof(filename) - 1, ".txt", "");
		
		if( equal(filename, vaultname) )
		{
			close_dir(dir);
			
			return filenum;
		}
		
		++filenum;
	}
	while( next_file(dir, filename, sizeof(filename) - 1) );
	
	close_dir(dir);
	
	copy(vaultname, len, "");
	
	return -1;
}

/** 
 * Retrieves total vaults ever created
 * 
 * @return		Returns amount of vaults
 */
stock fvault_total()
{
	if( !dir_exists(_vault_dir) )
	{
		mkdir(_vault_dir);
		return 0;
	}
	
	new vaultname[128], filename[128];
	new dir = open_dir(_vault_dir, vaultname, sizeof(vaultname) - 1);
	
	new filenum;
	do
	{
		if( equal(vaultname, ".") || equal(vaultname, "..") )
		{
			continue;
		}
		
		formatex(filename, sizeof(filename) - 1, "%s/%s", _vault_dir, vaultname);
		if( file_exists(filename) )
		{
			++filenum;
		}
	}
	while( next_file(dir, vaultname, sizeof(vaultname) - 1) );
	
	close_dir(dir);
	
	return filenum;
}

/**
 * Gets all vault keys, data, and timestamps
 * 
 * @param		vaultname - Vault name to look in
 * @param		keys - cellarray holding all of the keys
 * @param		datas - cellarray holding all of the data values
 * @param		timestamps - cellarray holding all of the timestamps
 * 
 * @return		Returns total number of entries in vault
 * 
 * @note		keys needs to be created like this: ArrayCreate(64)
 * 			datas needs to be created like this: ArrayCreate(512)
 * 			timestamps need to be created like this: ArrayCreate()
 */
stock fvault_load(const vaultname[], Array:keys=Invalid_Array, Array:datas=Invalid_Array, Array:timestamps=Invalid_Array)
{
	new filename[128];
	_FormatVaultName(vaultname, filename, 127);
	
	if( !file_exists(filename) )
	{
		return 0;
	}
	
	new vault = fopen(filename, "rt");
	
	new array_size;
	
	new filedata[1024];
	new key[64], data[512], timestamp[32];
	while( !feof(vault) )
	{
		fgets(vault, filedata, 1023);
		
		if( parse(filedata, key, 63, data, 511, timestamp, 31) < 2 )
		{
			continue;
		}
		
		if( keys != Invalid_Array )
		{
			ArrayPushString(keys, key);
		}
		if( datas != Invalid_Array )
		{
			ArrayPushString(datas, data);
		}
		if( timestamps != Invalid_Array )
		{
			ArrayPushCell(timestamps, str_to_num(timestamp));
		}
		
		array_size++;
	}
	
	fclose(vault);
	
	return array_size;
}
 
stock _FormatVaultName(const vaultname[], filename[], len)
{
	static const invalid_chars[][] =
	{
		"/", "\", "*", ":", "?", "^"", "<", ">", "|"
	};
	
	static tempvault[128], i;
	copy(tempvault, sizeof(tempvault) - 1, vaultname);
	
	for( i = 0; i < sizeof(invalid_chars); i++ )
	{
		replace_all(tempvault, sizeof(tempvault) - 1, invalid_chars[i], "");
	}
	
	if( !dir_exists(_vault_dir) )
	{
		mkdir(_vault_dir);
	}
	
	formatex(filename, len, "%s/%s.txt", _vault_dir, tempvault);
}
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1033\\ f0\\ fs16 \n\\ par }
*/
Image
User avatar
Reycku
Membru, skill 0
Membru, skill 0
Posts: 68
Joined: 26 Jan 2019, 02:11
Detinator Steam: Da
Detinator server CS: RESPAWN.PUBCS.RO
SteamID: reyck
Fond eXtream: 0
Been thanked: 3 times
Contact:

08 May 2019, 21:29

Nu merge lasa-ti asa(nu functioneaza nimic cand scriu /promocode)

T/C va rog
User avatar
1TAP GOD
Membru, skill +1
Membru, skill +1
Posts: 152
Joined: 03 Sep 2018, 00:20
Detinator Steam: Da
SteamID: /id/assasinssmdfk
Fond eXtream: 0
Has thanked: 16 times
Been thanked: 16 times

09 May 2019, 15:42

Are dreptate am testat si eu pe 1.8.1 si cand dau/promocode nu se intampla nimic in consola sv zice ceva de un array
----------------Steam----------------
-----------------------------------------------------------
Image
And she be actin' funny, probably think a nigga need her
I thought I was faithful, she say I'm a cheater
They thought I was taken, I'm ready to mingle
The Kalu
Fost administrator
Fost administrator
Posts: 13708
Joined: 09 Oct 2010, 12:39
Detinator Steam: Da
CS Status: In grajd!
SteamID: kalulord
Reputatie: Fost Administrator
Fost membru Club eXtreamCS (6 luni)
Nume anterior: Terra
Location: Romania, Ploiesti
Has thanked: 328 times
Been thanked: 646 times
Contact:

09 May 2019, 18:11

1TAP GOD wrote:
09 May 2019, 15:42
Are dreptate am testat si eu pe 1.8.1 si cand dau/promocode nu se intampla nimic in consola sv zice ceva de un array
Lasa eroarea aici
Image
User avatar
1TAP GOD
Membru, skill +1
Membru, skill +1
Posts: 152
Joined: 03 Sep 2018, 00:20
Detinator Steam: Da
SteamID: /id/assasinssmdfk
Fond eXtream: 0
Has thanked: 16 times
Been thanked: 16 times

09 May 2019, 19:53

fara debug

Code: Select all

L 05/09/2019 - 19:48:18: Invalid array handle provided (0)
L 05/09/2019 - 19:48:18: [AMXX] Run time error 10 (plugin "promo.amxx") (native "ArraySize") - debug not enabled!
L 05/09/2019 - 19:48:18: [AMXX] To enable debug mode, add "debug" after the plugin name in plugins.ini (without quotes).
cu debug

Code: Select all

L 05/09/2019 - 19:50:46: Invalid array handle provided (0)
L 05/09/2019 - 19:50:46: [AMXX] Displaying debug trace (plugin "promo.amxx")
L 05/09/2019 - 19:50:46: [AMXX] Run time error 10: native error (native "ArraySize")
L 05/09/2019 - 19:50:46: [AMXX]    [0] promo.sma::handle_say (line 73)
----------------Steam----------------
-----------------------------------------------------------
Image
And she be actin' funny, probably think a nigga need her
I thought I was faithful, she say I'm a cheater
They thought I was taken, I'm ready to mingle
User avatar
levin
Scripter eXtreamCS
Scripter eXtreamCS
Posts: 3844
Joined: 24 Aug 2011, 12:24
Detinator Steam: Da
CS Status:
Detinator server CS: ☯∴
SteamID: riseofevo
Reputatie: Scripter eXtreamCS
Nume anterior: Adryyy
Location: ҳ̸Ҳ̸ҳ
Discord: devilclass
Has thanked: 36 times
Been thanked: 594 times
Contact:

09 May 2019, 22:18

totu depinde cum vă faceți voi ini
Pentru ajutor, faceți cerere bine detaliată, completând și respectând modelul corespunzător.
Nu-mi mai dați cereri doar pentru a mă avea în lista de prieteni.
Dacă te ajut, și mă ignori/etc > te adaug în „foe”.
Aveți grijă la cei ce încearcă să mă copieze sau să dea drept mine..Puteți lua legătura cu mine prin STEAM dacă aveți o problemă/nelămurire în acest caz! Cont de forum am doar aici.
În cazul în care utilizați ceva din ce am postat(ex: aici), e bine să fiți la curent cu modificările aduse și de aici, iar dacă sunt ceva probleme nu ezitați să luați legătura cu mine. Actualizarea unor coduri nu se vor afișa public, doar dacă se găsește ceva critic/urgent de remediat, unele fiind coduri vechi iar unele refăcute chiar recent dar private.
* Nume pe cs1.6: eVoLuTiOn \ Nume vechi: eVo
* Atelierul meu - post2819572.html#p2819572 (închis, click link ca să vedeți de ce)
User avatar
Reycku
Membru, skill 0
Membru, skill 0
Posts: 68
Joined: 26 Jan 2019, 02:11
Detinator Steam: Da
Detinator server CS: RESPAWN.PUBCS.RO
SteamID: reyck
Fond eXtream: 0
Been thanked: 3 times
Contact:

09 May 2019, 22:46

Ne-ai zis ceva de .ini?si nu stie?
User avatar
Reycku
Membru, skill 0
Membru, skill 0
Posts: 68
Joined: 26 Jan 2019, 02:11
Detinator Steam: Da
Detinator server CS: RESPAWN.PUBCS.RO
SteamID: reyck
Fond eXtream: 0
Been thanked: 3 times
Contact:

19 Jul 2019, 15:14

Ce trebuie pus in .ini?
User avatar
levin
Scripter eXtreamCS
Scripter eXtreamCS
Posts: 3844
Joined: 24 Aug 2011, 12:24
Detinator Steam: Da
CS Status:
Detinator server CS: ☯∴
SteamID: riseofevo
Reputatie: Scripter eXtreamCS
Nume anterior: Adryyy
Location: ҳ̸Ҳ̸ҳ
Discord: devilclass
Has thanked: 36 times
Been thanked: 594 times
Contact:

19 Jul 2019, 21:59

"codul tău" "suma pentru cod"

Code: Select all

#include <amxmodx>
#include <amxmisc>

#include <fvault>
// Pruning player agree/decline after 15 days of not being updated
//	15 days * 24 hours * 60 minutes * 60 seconds = 15 days in seconds(24x8600ms)
//		15 * 24 * 60 * 60
#define ZILE_CURATARE	15	//dupa 15 zile ii sterge pe cei care au folosit un cod din promo, ca sa poata folosii altul dinou

#include <csgo_remake>

new const FVN[] = "PCodes";
//enum data [35]
new Array: g_PromoCodes/*=Invalid_Array*/;
new Array: g_PromoCodesPoints;

new cod_folosit[33];
new name[33] [32];

new const pCMD [] = "/promocode";

public plugin_cfg()
{
	new ConfigsDir[128], File
	get_configsdir(ConfigsDir, charsmax(ConfigsDir));
	add(ConfigsDir, charsmax(ConfigsDir), "/promocode.ini");

	if(!file_exists(ConfigsDir))
	{
		new form[100];
		formatex(form, charsmax(form), "Couldn't find ^"%s^". I will write a new one...", ConfigsDir);
		log_amx(form);
		server_print(form);
		//set_fail_state(form);

		File = fopen(ConfigsDir, "w");
		fputs(File, ";Aici treci codurile si premiul lor.^n");
		fputs(File, "; EX: ^"COD^" ^"SUMA^"^n");
		fputs(File, ";Suma reprezinta cifrele care se adauga ca si puncte...^n^n");
		fclose(File);
		//return;
	}

	g_PromoCodes = ArrayCreate(15);
	g_PromoCodesPoints = ArrayCreate(1);//1,32

	File = fopen(ConfigsDir, "r");//csf
	if(!File)	return;//...
	if(File)
	{
		new Buffer[120], CodeName[10], CodePoints[10];
		while(!feof(File))
		{
			fgets(File, Buffer, charsmax(Buffer))
			if(!Buffer[0] || Buffer[0] == ';' || Buffer[0] == '#' || Buffer[0] == '/' && Buffer[1] == '/')	continue;
			trim(Buffer); //xd
			parse(Buffer, CodeName, charsmax(CodeName), CodePoints, charsmax(CodePoints));
			//if(parse(Buffer) != 3 || !strlen(Buffer))	continue;

			for(new x; x < sizeof(CodeName); x++)	ArrayPushString(g_PromoCodes, CodeName[x]);
			for(new a; a < sizeof(CodePoints); a++)	ArrayPushCell(g_PromoCodesPoints, str_to_num(CodePoints[a]));//generare random xd
		}
		fclose(File);
	}
}

public plugin_init()	register_clcmd("say", "handle_say"),register_clcmd("say_team", "handle_say");

public client_authorized(id)	get_user_name(id, name[id], charsmax(name [])),LoadData(id);

public handle_say(Player)
{
	new Args[125];
	read_args(Args, charsmax(Args));
	if(!Args[0])	return PLUGIN_CONTINUE;//xD
	remove_quotes(Args);//[0]

	new szCmd[32], szCode[10], szTemp[10];
	parse(Args, szCmd, charsmax(szCmd), szCode, charsmax(szCode));

	if(equal(szCmd, pCMD))
	{
		/*if(!ArraySize(g_PromoCodes))
		{
			client_print(Player, print_chat, "Probleme in citirea codurilor.");
			return PLUGIN_HANDLED
		}*/

		/*if(!csgor_is_user_logged(Player))
		{
			client_print(Player, print_chat, "Se pare ca nu esti logat.");
			return PLUGIN_HANDLED;
		}*/

		if(cod_folosit[Player] == 1)
		{
				client_print(Player, print_chat, "Se pare ca ai activat recent un cod. Asteapta sa expire.");
				return PLUGIN_HANDLED;
		}

		for(new b; b < ArraySize(g_PromoCodes); b++)
		{
			if(equal(szCode, ""))
			{
				client_print(Player, print_chat, "Folosire corecta: %s COD", pCMD);
				return PLUGIN_HANDLED;
			}

			ArrayGetString(g_PromoCodes, b, szTemp, charsmax(szTemp));

			if(equal(szCode, szTemp))
			{
				for(new c; c < ArraySize(g_PromoCodesPoints); c++)
				{
					client_print(Player, print_chat, "Felicitari! Ai activat cu succes codul ^"%s^" fiind unul valid, si ai primit +%d punct%s", szTemp, ArrayGetCell(g_PromoCodesPoints, c), ArrayGetCell(g_PromoCodesPoints, c) == 1 ? "" : "e");
					csgor_set_user_points(Player, csgor_get_user_points(Player) + ArrayGetCell(g_PromoCodesPoints, c));
					cod_folosit[Player] = 1;
					fvault_set_data(FVN, name[Player], cod_folosit[Player]);
					//ArrayClear(g_PromoCodes);
					break;
				}
				return PLUGIN_HANDLED;
			}
			else
			{
				client_print(Player, print_chat, "OOOOPS ! COD INVALID.");
				return PLUGIN_HANDLED;
			}
		}
	}
	return PLUGIN_CONTINUE;
}

public LoadData(id)
{
	new data[120];
	if(fvault_get_data(FVN, name[id], data, charsmax(data)))	cod_folosit[id] = str_to_num(data);
	else	cod_folosit[id] = 0;
}

public plugin_end()
{
	fvault_prune(FVN, _, get_systime() - (ZILE_CURATARE * 24 * 60 * 60));//0	road2cfg

	ArrayDestroy(g_PromoCodes);
	ArrayDestroy(g_PromoCodesPoints);
}
Pentru ajutor, faceți cerere bine detaliată, completând și respectând modelul corespunzător.
Nu-mi mai dați cereri doar pentru a mă avea în lista de prieteni.
Dacă te ajut, și mă ignori/etc > te adaug în „foe”.
Aveți grijă la cei ce încearcă să mă copieze sau să dea drept mine..Puteți lua legătura cu mine prin STEAM dacă aveți o problemă/nelămurire în acest caz! Cont de forum am doar aici.
În cazul în care utilizați ceva din ce am postat(ex: aici), e bine să fiți la curent cu modificările aduse și de aici, iar dacă sunt ceva probleme nu ezitați să luați legătura cu mine. Actualizarea unor coduri nu se vor afișa public, doar dacă se găsește ceva critic/urgent de remediat, unele fiind coduri vechi iar unele refăcute chiar recent dar private.
* Nume pe cs1.6: eVoLuTiOn \ Nume vechi: eVo
* Atelierul meu - post2819572.html#p2819572 (închis, click link ca să vedeți de ce)
Post Reply

Return to “Cereri”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 22 guests