get_cvar_num in chat

Pluginuri pentru modul AmxModX.

Moderators: Moderatori ajutatori, Moderatori, Echipa eXtreamCS.com

Post Reply
User avatar
lexzor
Membru, skill 0
Membru, skill 0
Posts: 14
Joined: 15 Jan 2020, 23:45
Detinator Steam: Da
CS Status: www.districth.ro/forum
SteamID: lexzor
Fond eXtream: 0
Has thanked: 3 times
Been thanked: 1 time

17 Apr 2020, 15:58

Salut, sunt incepator si am facut si eu un mic plugin care alege un player random de pe server si ii da hp si ap in functie de valoarea pe care o selectezi in chat, dar nu-mi apare in chat. In loc de numarul de hp si ap pe care il da apare spatiu liber si nu inteleg de ce.

Code: Select all

/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <fun>
#include <colorchat>

#define PLUGIN "LuckyGuy"
#define VERSION "1.3"
#define AUTHOR "lexzor"




public plugin_init() 
{
	register_plugin(PLUGIN, VERSION, AUTHOR)    
	register_logevent("giveHealth", 2, "1=Round_Start") 
	register_cvar("amx_luckyguy", "1")
	register_cvar("amx_luckyguychat", "1")
	register_cvar("amx_luckyguy_hp", "25")
	register_cvar("amx_luckyguy_ap", "25")
	register_cvar("amx_luckyguy_vip", "0")
	
}



public giveHealth(){
	
	new iHealth = get_cvar_num("amx_luckyguy_hp")
	new iArmor = get_cvar_num("amx_luckyguy_ap")
	

	
	
	if(get_cvar_num("amx_luckyguy") == 1){
		new iPlayers[32] 
		new iNum
		get_players(iPlayers, iNum, "c")
		new iRandomPlayer = iPlayers[random_num(0, iNum - 1)]
		
		if(get_cvar_num("amx_luckyguy_vip") == 1){
			if(is_user_alive(iRandomPlayer))
			{
				new szName[32]
				get_user_name(iRandomPlayer, szName, charsmax(szName))
				set_user_health(iRandomPlayer, get_user_health(iRandomPlayer) + get_cvar_num("amx_luckyguy_hp"))
				set_user_armor(iRandomPlayer, get_user_armor(iRandomPlayer) + get_cvar_num("amx_luckyguy_hp"))
				
				if(get_cvar_num("amx_luckyguychat") ==1){
					ColorChat(0, GREEN, "[DISTRICTH]^x01 Jucatorul ^x04%s^x01 a primit^x04 %s HP^x01 si^x04 %s AM^x01!", szName, iHealth, iArmor)
				}
			}
		}
		
		if(get_cvar_num("amx_luckyguy_vip") == 0){
			if(get_user_flags(iRandomPlayer) & read_flags("r")) return 0
			
			
			if(is_user_alive(iRandomPlayer))
			{
				new szName[32]
				get_user_name(iRandomPlayer, szName, charsmax(szName))
				set_user_health(iRandomPlayer, get_user_health(iRandomPlayer) + get_cvar_num("amx_luckyguy_hp"))
				set_user_armor(iRandomPlayer, get_user_armor(iRandomPlayer) + get_cvar_num("amx_luckyguy_hp"))
				
				if(get_cvar_num("amx_luckyguychat") ==1){
					ColorChat(0, GREEN, "[DISTRICTH]^x01 Jucatorul ^x04%s^x01 a primit^x04 %s HP^x01 si^x04 %s AM^x01!", szName, iHealth, iArmor)
				}
			}			
		}
	}
	return 0
}
Zonek
ZackChoi
Membru, skill 0
Membru, skill 0
Posts: 55
Joined: 28 Dec 2019, 01:39
Detinator Steam: Da
CS Status: Citesc forumul eXtreamCS.com...!
Fond eXtream: 0
Has thanked: 1 time
Been thanked: 5 times

17 Apr 2020, 16:16

Code: Select all

ColorChat(0, GREEN, "[DISTRICTH]^x01 Jucatorul ^x04%s^x01 a primit^x04 %s HP^x01 si^x04 %s AM^x01!", szName, iHealth, iArmor)
->

Code: Select all

ColorChat(0, GREEN, "[DISTRICTH]^x01 Jucatorul ^x04%s^x01 a primit^x04 %d HP^x01 si^x04 %d AM^x01!", szName, iHealth, iArmor)
%s - string
%d - numar
%i - integer
%c - character
%f - float
User avatar
lexzor
Membru, skill 0
Membru, skill 0
Posts: 14
Joined: 15 Jan 2020, 23:45
Detinator Steam: Da
CS Status: www.districth.ro/forum
SteamID: lexzor
Fond eXtream: 0
Has thanked: 3 times
Been thanked: 1 time

17 Apr 2020, 17:24

Mersi mult le-am cautat ceva timp :))
Post Reply

Return to “AmxModX”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 6 guests