Modificare gloante arma.

Modificari necesare ale pluginurilor

Moderators: Moderatori ajutatori, Moderatori, Echipa eXtreamCS.com

Cosmin
Fost moderator
Fost moderator
Posts: 9366
Joined: 06 Jul 2013, 21:08
Detinator Steam: Da
Detinator server CS: Nu
Reputatie: Fost eXtream Mod
Fost Scripter eXtreamCS
Nume anterior: scosmynnnn
Has thanked: 492 times
Been thanked: 546 times

07 Dec 2013, 22:06

UPDATE :D
Rapidserver
User avatar
FaTzZu
Fost moderator
Fost moderator
Posts: 1206
Joined: 22 Dec 2012, 18:37
Detinator Steam: Da
Reputatie: Fost moderator ajutator
Has thanked: 114 times
Been thanked: 168 times
Contact:

08 Dec 2013, 01:42

| Afiseaza codul
#include <amxmodx>
#include <fun>
#include <cstrike>
#include <hamsandwich>
#include <engine>

#define PLUGIN "Vip Hns"
#define VERSION "1.1"
#define AUTHOR "C0sm1N"
#define nr_maxim 3 // de aici modifici de cate ori sa poata folosii /vipmenu pe runda !

new g_iRunda[ 33 ];
new gmsgSayText
new iTask = 112112
static const COLOR[] = "^x04"

public plugin_init () {
	register_plugin ("PLUGIN", "VERSION", "AUTHOR");
	register_clcmd ("say /vipmenu","HnsVip");
	register_event("HLTV", "roundstart", "a", "1=0", "2=0")
	RegisterHam(Ham_Spawn, "player", "fwHamPlayerSpawnPost", 1);
	register_clcmd("say /vips","showvips")
	gmsgSayText = get_user_msgid("SayText");
	register_event("ResetHUD", "ev_resethud", "be")
}
public HnsVip ( id )
{
	if (Vip(id))
	{
		ShowMenu(id);
	}
	else
	{
		chat_color(id, "!g[VIP] !yNu ai acces la /vipmenu,cumpara vip !")
	}
}
public roundstart( )
{
	new iPlayers[ 32 ], iNum;
	
	get_players( iPlayers, iNum, "c" );
	
	for( new i = 0; i < iNum; i++ )
	{
		g_iRunda[ iPlayers[ i ] ] = 0;
	}
}
public ShowMenu ( id )
{
	if(g_iRunda[id] >= nr_maxim)
	{
		chat_color(id,"!g[VIP] !yAi folosit de %i ori aceasta comanda, !teamasteapta pana runda urmatoare.",nr_maxim);
		return 1;
	}
	
	if (!is_user_alive ( id ) || is_user_bot ( id ))
		return 1;
	
	static menu;
	menu = menu_create ("\ Meniu vip","meniu_vip");
	
	menu_additem ( menu,"\g Deagle \r[2Gloante]","1", 0 );
	menu_additem ( menu,"\g Invizibilitate \r[15 Secunde]","2", 0 );
	menu_additem ( menu,"\g Gravitatie \r[10 Secunde]","3", 0 );
	menu_additem ( menu,"\g GodMode \r[10 Secunde]","4", 0 );
	
	menu_setprop ( menu, MPROP_NUMBER_COLOR,"\y");
	menu_setprop ( menu, MPROP_EXIT, MEXIT_ALL );
	
	g_iRunda[id]++
	
	menu_display ( id, menu, 0 );
	return 0;
}
public meniu_vip ( id, menu, item )
{
	if ( item == MENU_EXIT )
	{
		menu_destroy ( menu );
		return 1;
	}
	
	new data [ 6 ], szName [ 64 ];
	new access, callback;
	
	menu_item_getinfo ( menu, item, access, data, charsmax ( data ), szName, charsmax ( szName ), callback );
	
	new key = str_to_num ( data );
	
	switch ( key )
	{
		case 1:
		{
			chat_color(id,"!g[MeniuVip] !yTi-ai ales !teamdeagle cu !y2 gloante.")
			
			cs_set_weapon_ammo(give_item(id, "weapon_deagle"), 3)
			cs_set_user_bpammo(id, CSW_DEAGLE, 0);
		}
		case 2:
		{
			chat_color(id,"!g[MeniuVip] !yTi-ai ales !teaminvizibilitate !y10 secunde.")
			set_user_rendering(id, kRenderFxGlowShell, 0, 0, 0, kRenderTransAlpha, 0);  
			set_task(15.0, "remove_invizibility",id);  
		} 
		case 3:
		{
			chat_color(id,"!g[MeniuVip] !yTi-ai ales !teamgravitatie !y10 secunde.")
			set_user_gravity( id, 0.6 );
			set_task(10.0, "remove_gravity",id);
		}
		case 4:
		{
			chat_color(id,"!g[MeniuVip] !yTi-ai ales !teamGodMode !y10 secunde.")
			set_user_godmode ( id, 1 );
			set_task ( 10.0,"remove_godmode", id );
		}
	}
	menu_destroy ( menu );
	return 1;
}
public remove_invizibility(id){
	set_user_rendering(id, kRenderFxGlowShell, 0, 0, 0, kRenderTransAlpha, 255);  
	chat_color(id, "!g[MeniuVip] !yTi-a expirat !teaminvizibilitatea.")
} 
public remove_gravity(id){
	set_user_gravity( id, 1.0 );
	chat_color(id, "!g[MeniuVip] !yTi-a expirat !teamgravitatia.")
}
public remove_godmode(id){
	set_user_godmode ( id, 0 );
	chat_color(id, "!g[MeniuVip] !yTi-a expirat !teamgodmode-ul.")
}
public fwHamPlayerSpawnPost(id) {
	if (Vip(id) && is_user_alive(id))
	{
		set_user_health(id, get_user_health(id) + 25)
		give_item ( id,"weapon_hegrenade" );
		give_item ( id,"weapon_flashbang" );
		give_item ( id,"weapon_flashbang" );
		give_item ( id,"weapon_smokegrenade" );
		g_iRunda[ id ] = false
	}                     
}
stock bool:Vip(id)
{
	if(get_user_flags(id) & read_flags("t"))
		return true
	
	return false;
}
public client_putinserver( id )
{
	if(Vip(id))
	{
		new name[32]
		get_user_name(id,name,31)
		chat_color(0, "!team[VIP]!g%s !yse conecteaza !",name)
	}
}
public client_disconnect(id)
{
	if(Vip(id))
	{
		new name[32]
		get_user_name(id,name,31)
		chat_color(0,"!team[VIP]!g%s a iesit dupa server",name)
	}
}
public ev_resethud(id)
{
	set_task(1.0,"tabscore1",id + iTask)
}
public tabscore1( taskid )
{
	new id = taskid - iTask
	
	if(Vip(id) && is_user_connected(id))
	{
		message_begin( MSG_ALL, get_user_msgid("ScoreAttrib") )
		
		write_byte( id )
		write_byte( 4 )
		message_end( )
	}
}
public showvips(user) 
{
	new adminnames[33][32]
	new message[256]
	new id, count, x, len
	new maxplayers = get_maxplayers()
	for(id = 1 ; id <= maxplayers ; id++)
		if(is_user_connected(id))
		if(Vip(id))
		get_user_name(id, adminnames[count++], 31)
	
	len = format(message, 255, "%s VIP ONLINE: ",COLOR)
	if(count > 0) {
		for(x = 0 ; x < count ; x++) {
			len += format(message[len], 255-len, "%s%s ", adminnames[x], x < (count-1) ? ", ":"")
			if(len > 96 ) {
				print_message(user, message)
				len = format(message, 255, "%s ",COLOR)
			}
		}
		print_message(user, message)
	}
	else {
		len += format(message[len], 255-len, "No VIP online.")
		print_message(user, message)
	}
}

print_message(id, msg[]) {
	message_begin(MSG_ONE, gmsgSayText, {0,0,0}, id)
	write_byte(id)
	write_string(msg)
	message_end()
}

stock chat_color(const id, const input[], any:...)
{
	new count = 1, players[32]
	static msg[191]
	vformat(msg, 190, input, 3)
	
	replace_all(msg, 190, "!g", "^4")
	replace_all(msg, 190, "!y", "^1")
	replace_all(msg, 190, "!team", "^3")
	
	if (id) players[0] = id; else get_players(players, count, "ch")
	{
	for (new i = 0; i < count; i++)
	{
		if (is_user_connected(players))
		{
			message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("SayText"), _, players)
			write_byte(players);
			write_string(msg);
			message_end();
		}
	}
}
}
A fool's brain digests philosophy into folly, science into superstition, and art into pedantry.

#RETIRED.
Cosmin
Fost moderator
Fost moderator
Posts: 9366
Joined: 06 Jul 2013, 21:08
Detinator Steam: Da
Detinator server CS: Nu
Reputatie: Fost eXtream Mod
Fost Scripter eXtreamCS
Nume anterior: scosmynnnn
Has thanked: 492 times
Been thanked: 546 times

08 Dec 2013, 12:20

Code: Select all

L 12/08/2013 - 12:19:35: [CSTRIKE] Non-player entity -1 out of range
L 12/08/2013 - 12:19:35: [AMXX] Displaying debug trace (plugin "HnsVip.amxx")
L 12/08/2013 - 12:19:35: [AMXX] Run time error 10: native error (native "cs_set_weapon_ammo")
L 12/08/2013 - 12:19:35: [AMXX]    [0] HnsVip.sma::meniu_vip (line 95)
Lafel face,prima oara imi da 7 gloante si cand aleg a 2-a oara tot in aceeasi runda imi da 7 gloante ;))
User avatar
R1kKk-
Membru, skill +1
Membru, skill +1
Posts: 178
Joined: 12 Apr 2013, 15:57
Detinator Steam: Da
CS Status: Batman!
Detinator server CS: HNS.JOINET.RO
SteamID: Privat...
Has thanked: 20 times
Been thanked: 17 times
Contact:

10 Dec 2013, 01:30

Trebuie sa arunci arma ca sa-ti dea tot 2 gloante cand iei din nou.
Nu stiu sigur daca este vre-o rezolvare la acest "bug". Nu prea se poate numii bug, dar e cv asemanator :)
Image Image Image
Cosmin
Fost moderator
Fost moderator
Posts: 9366
Joined: 06 Jul 2013, 21:08
Detinator Steam: Da
Detinator server CS: Nu
Reputatie: Fost eXtream Mod
Fost Scripter eXtreamCS
Nume anterior: scosmynnnn
Has thanked: 492 times
Been thanked: 546 times

10 Dec 2013, 15:45

R1kKk- wrote:Trebuie sa arunci arma ca sa-ti dea tot 2 gloante cand iei din nou.
Nu stiu sigur daca este vre-o rezolvare la acest "bug". Nu prea se poate numii bug, dar e cv asemanator :)
Nu ai inteles :))

Deci pentru cei care nu au inteles fac asa:

Eu am un vip care am accesul la /vipmenu de 3 ori pe runda,ok pana aici.Imi aleg prima oara deagle , imi da 2 gloante cate vreau eu,dar daca aleg inca odata din meniu chiar daca il am in mana deagleul care mi l-am ales prima oara se creeaza bug si imi da 7 gloante,daca le consum mai intai pe alea 2 si imi iau din meniu deagle imi da 2 gloante..trebuie pusa o verificatie :D
| Afiseaza codul
#include <amxmodx>
#include <fun>
#include <cstrike>
#include <hamsandwich>
#include <engine>

#define PLUGIN "Vip Hns"
#define VERSION "1.1"
#define AUTHOR "C0sm1N"
#define nr_maxim 3 // de aici modifici de cate ori sa poata folosii /vipmenu pe runda !

new g_iRunda[ 33 ];
new gmsgSayText
new iTask = 112112
static const COLOR[] = "^x04"

public plugin_init () {
	register_plugin ("PLUGIN", "VERSION", "AUTHOR");
	register_clcmd ("say /vipmenu","HnsVip");
	register_event("HLTV", "roundstart", "a", "1=0", "2=0")
	RegisterHam(Ham_Spawn, "player", "fwHamPlayerSpawnPost", 1);
	register_clcmd("say /vips","showvips")
	gmsgSayText = get_user_msgid("SayText");
	register_event("ResetHUD", "ev_resethud", "be")
}
public HnsVip ( id )
{
	if (Vip(id))
	{
		ShowMenu(id);
	}
	else
	{
		chat_color(id, "!g[VIP] !yNu ai acces la /vipmenu,cumpara vip !")
	}
}
public roundstart( )
{
	new iPlayers[ 32 ], iNum;
	
	get_players( iPlayers, iNum, "c" );
	
	for( new i = 0; i < iNum; i++ )
	{
		g_iRunda[ iPlayers[ i ] ] = 0;
	}
}
public ShowMenu ( id )
{
	if(g_iRunda[id] >= nr_maxim)
	{
		chat_color(id,"!g[VIP] !yAi folosit de %i ori aceasta comanda, !teamasteapta pana runda urmatoare.",nr_maxim);
		return 1;
	}
	
	if (!is_user_alive ( id ) || is_user_bot ( id ))
		return 1;
	
	static menu;
	menu = menu_create ("\ Meniu vip","meniu_vip");
	
	menu_additem ( menu,"\g Deagle \r[2Gloante]","1", 0 );
	menu_additem ( menu,"\g Invizibilitate \r[15 Secunde]","2", 0 );
	menu_additem ( menu,"\g Gravitatie \r[10 Secunde]","3", 0 );
	menu_additem ( menu,"\g GodMode \r[10 Secunde]","4", 0 );
	
	menu_setprop ( menu, MPROP_NUMBER_COLOR,"\y");
	menu_setprop ( menu, MPROP_EXIT, MEXIT_ALL );
	
	g_iRunda[id]++
	
	menu_display ( id, menu, 0 );
	return 0;
}
public meniu_vip ( id, menu, item )
{
	if ( item == MENU_EXIT )
	{
		menu_destroy ( menu );
		return 1;
	}
	
	new data [ 6 ], szName [ 64 ];
	new access, callback;
	
	menu_item_getinfo ( menu, item, access, data, charsmax ( data ), szName, charsmax ( szName ), callback );
	
	new key = str_to_num ( data );
	
	switch ( key )
	{
		case 1:
		{
			chat_color(id,"!g[MeniuVip] !yTi-ai ales !teamdeagle cu !y2 gloante.")
			
			give_item( id, "weapon_deagle" );
			
			new ent = find_ent_by_owner( -1, "weapon_deagle", id );
			
			if( ent ) 
			{
				cs_set_weapon_ammo( ent, 2 );
			}
		}
		case 2:
		{
			chat_color(id,"!g[MeniuVip] !yTi-ai ales !teaminvizibilitate !y10 secunde.")
			set_user_rendering(id, kRenderFxGlowShell, 0, 0, 0, kRenderTransAlpha, 0);  
			set_task(15.0, "remove_invizibility",id);  
		} 
		case 3:
		{
			chat_color(id,"!g[MeniuVip] !yTi-ai ales !teamgravitatie !y10 secunde.")
			set_user_gravity( id, 0.6 );
			set_task(10.0, "remove_gravity",id);
		}
		case 4:
		{
			chat_color(id,"!g[MeniuVip] !yTi-ai ales !teamGodMode !y10 secunde.")
			set_user_godmode ( id, 1 );
			set_task ( 10.0,"remove_godmode", id );
		}
	}
	menu_destroy ( menu );
	return 1;
}
public remove_invizibility(id){
	set_user_rendering(id, kRenderFxGlowShell, 0, 0, 0, kRenderTransAlpha, 255);  
	chat_color(id, "!g[MeniuVip] !yTi-a expirat !teaminvizibilitatea.")
} 
public remove_gravity(id){
	set_user_gravity( id, 1.0 );
	chat_color(id, "!g[MeniuVip] !yTi-a expirat !teamgravitatia.")
}
public remove_godmode(id){
	set_user_godmode ( id, 0 );
	chat_color(id, "!g[MeniuVip] !yTi-a expirat !teamgodmode-ul.")
}
public fwHamPlayerSpawnPost(id) {
	if (Vip(id) && is_user_alive(id))
	{
		set_user_health(id, get_user_health(id) + 25)
		give_item ( id,"weapon_hegrenade" );
		give_item ( id,"weapon_flashbang" );
		give_item ( id,"weapon_flashbang" );
		give_item ( id,"weapon_smokegrenade" );
		g_iRunda[ id ] = false
	}                     
}
stock bool:Vip(id)
{
	if(get_user_flags(id) & read_flags("t"))
		return true
	
	return false;
}
public client_putinserver( id )
{
	if(Vip(id))
	{
		new name[32]
		get_user_name(id,name,31)
		chat_color(0, "!team[VIP]!g%s !yse conecteaza !",name)
	}
}
public client_disconnect(id)
{
	if(Vip(id))
	{
		new name[32]
		get_user_name(id,name,31)
		chat_color(0,"!team[VIP]!g%s a iesit dupa server",name)
	}
}
public ev_resethud(id)
{
	set_task(1.0,"tabscore1",id + iTask)
}
public tabscore1( taskid )
{
	new id = taskid - iTask
	
	if(Vip(id) && is_user_connected(id))
	{
		message_begin( MSG_ALL, get_user_msgid("ScoreAttrib") )
		
		write_byte( id )
		write_byte( 4 )
		message_end( )
	}
}
public showvips(user) 
{
	new adminnames[33][32]
	new message[256]
	new id, count, x, len
	new maxplayers = get_maxplayers()
	for(id = 1 ; id <= maxplayers ; id++)
		if(is_user_connected(id))
		if(Vip(id))
		get_user_name(id, adminnames[count++], 31)
	
	len = format(message, 255, "%s VIP ONLINE: ",COLOR)
	if(count > 0) {
		for(x = 0 ; x < count ; x++) {
			len += format(message[len], 255-len, "%s%s ", adminnames[x], x < (count-1) ? ", ":"")
			if(len > 96 ) {
				print_message(user, message)
				len = format(message, 255, "%s ",COLOR)
			}
		}
		print_message(user, message)
	}
	else {
		len += format(message[len], 255-len, "No VIP online.")
		print_message(user, message)
	}
}

print_message(id, msg[]) {
	message_begin(MSG_ONE, gmsgSayText, {0,0,0}, id)
	write_byte(id)
	write_string(msg)
	message_end()
}

stock chat_color(const id, const input[], any:...)
{
	new count = 1, players[32]
	static msg[191]
	vformat(msg, 190, input, 3)
	
	replace_all(msg, 190, "!g", "^4")
	replace_all(msg, 190, "!y", "^1")
	replace_all(msg, 190, "!team", "^3")
	
	if (id) players[0] = id; else get_players(players, count, "ch")
	{
	for (new i = 0; i < count; i++)
	{
		if (is_user_connected(players))
		{
			message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("SayText"), _, players)
			write_byte(players);
			write_string(msg);
			message_end();
		}
	}
}
}

M-am referit la metoda asta,m-a ajutat falseq dar mai are doar acel "bug" de l-am pomenit mai sus :)
Cosmin
Fost moderator
Fost moderator
Posts: 9366
Joined: 06 Jul 2013, 21:08
Detinator Steam: Da
Detinator server CS: Nu
Reputatie: Fost eXtream Mod
Fost Scripter eXtreamCS
Nume anterior: scosmynnnn
Has thanked: 492 times
Been thanked: 546 times

11 Dec 2013, 20:46

up. ..
Cosmin
Fost moderator
Fost moderator
Posts: 9366
Joined: 06 Jul 2013, 21:08
Detinator Steam: Da
Detinator server CS: Nu
Reputatie: Fost eXtream Mod
Fost Scripter eXtreamCS
Nume anterior: scosmynnnn
Has thanked: 492 times
Been thanked: 546 times

13 Dec 2013, 20:58

up .. .
Cosmin
Fost moderator
Fost moderator
Posts: 9366
Joined: 06 Jul 2013, 21:08
Detinator Steam: Da
Detinator server CS: Nu
Reputatie: Fost eXtream Mod
Fost Scripter eXtreamCS
Nume anterior: scosmynnnn
Has thanked: 492 times
Been thanked: 546 times

14 Dec 2013, 17:15

Up . . .
Cosmin
Fost moderator
Fost moderator
Posts: 9366
Joined: 06 Jul 2013, 21:08
Detinator Steam: Da
Detinator server CS: Nu
Reputatie: Fost eXtream Mod
Fost Scripter eXtreamCS
Nume anterior: scosmynnnn
Has thanked: 492 times
Been thanked: 546 times

20 Dec 2013, 01:14

up . . .
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

20 Dec 2013, 11:22

bugu ala nu merge rezolvat
User avatar
Fuffy
Membru, skill +1
Membru, skill +1
Posts: 299
Joined: 07 Jan 2016, 08:34
Detinator Steam: Da
CS Status: Citesc forumul eXtreamCS.com...!
Fond eXtream: 0
Contact:

29 Jan 2016, 11:01

scuze ca reinvii acest topic, dar pentru cei care-l gasesc si au aceiasi problema solutia e stock-ul asta: https://forums.alliedmods.net/showthread.php?t=278123

Problema adevarata e ca da errori atunci cand ai o arma , ex: dgl cu 3 glaonte(sa zicem) daca primesti iar deagle cu 3 gloante si tu ai deja o sa-ti apara errori.

Cu stock-ul asta poti face asa:

give_user_weapon( id, CSW_DEAGLE, 3, 0 );
AMXX Blue e acum doar pe github.
Post Reply

Return to “Modificari pluginuri”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 7 guests