←  Pytania

AMXX.pl: Support AMX Mod X i SourceMod

»

Cvary nie czaje :D

Locked

Skull3D's Photo Skull3D 18.08.2011

Mam pytanie

Mogę mieć tak:

register_cvar("exp_kill", "20");
	register_cvar("exp_hs","10");
	register_cvar("exp_headsplash","20");
	register_cvar("exp_vip","15");


Czy musze miec tak

register_cvar("exp_kill", "20");
	register_cvar("exp_hs","10");
	register_cvar("exp_headsplash","20");
	register_cvar("exp_vip","15");
	
	exp_kill     =     get_cvar_num("xp_kill");
	exp_hs         =     get_cvar_num("xp_hs");
	exp_headsplash     =     get_cvar_num("xp_headsplash");
	exp_vip     =     get_cvar_num("xp_headsplash");

I może mi ktoś wytłumaczyć na czym to polega w 2 sposobie bo w tutku o cvarach nie widziałem albo pominalem to
Quote

  • +
  • -
speedkill's Photo speedkill 18.08.2011

Możesz mieć tak :
register_cvar("exp_kill", "20");
	register_cvar("exp_hs","10");
	register_cvar("exp_headsplash","20");
	register_cvar("exp_vip","15");
Potem tylko w jakimś publicu new cos = get_pcvar_num( exp_hs )
i reszta kodu ;]
Quote

Skull3D's Photo Skull3D 18.08.2011

A zaczaiłem to jest tak jakby rejestrowanie
Można zamknąć jeśli zrozumiałem :.
Quote

  • +
  • -
GeDox's Photo GeDox 18.08.2011

Możesz mieć tak :

register_cvar("exp_kill", "20");
	register_cvar("exp_hs","10");
	register_cvar("exp_headsplash","20");
	register_cvar("exp_vip","15");
Potem tylko w jakimś publicu new cos = get_pcvar_num( exp_hs )
i reszta kodu ;]

A nie przypadkiem get_cvar_num("exp_hs") ?

@edit
Faila strzeliłem, zapomniałem o "" ;)
Edited by Kamurizu, 18.08.2011 20:55.
Quote

  • +
  • -
speedkill's Photo speedkill 18.08.2011

Sprawdź ja robiłem kiedyś get_pcvar_num
Quote

  • +
  • -
A może sma?'s Photo A może sma? 18.08.2011

Jeżeli zrobisz
register_cvar("exp_vip","15");

to get_cvar_costam(exp_vip)
a jeżeli
exp_kill = get_cvar_num("xp_kill");

to get_pcvar_costam(exp_kill)

Chyba :D
Quote

  • +
  • -
GeDox's Photo GeDox 18.08.2011

Jeżeli zrobisz

register_cvar("exp_vip","15");

to get_cvar_costam(exp_vip)
a jeżeli
exp_kill = get_cvar_num("xp_kill");

to get_pcvar_costam(exp_kill)

Chyba :D

W przypadku get_cvar(...) CVAR pobierany jest nazwą.
Zaś get_pcvar(...) pobiera przez wskaźnik, który zwraca register_cvar ;)
Quote

  • +
  • -
speedkill's Photo speedkill 19.08.2011

Proszę bardzo przykład z pcvarem hp za headshota
tu są zmienne potem zmienna=register_cvar()
i jest get_pcvar_num
#include <amxmodx>
#include <fun>

#define PLUGIN "New Plug-In"
#define VERSION "1.0"
#define AUTHOR "Administrator"

new health_add
new health_hs_add
new health_max
new nKiller
new nKiller_hp
new nHp_add
new nHp_max

public plugin_init() {
	register_plugin(PLUGIN, VERSION, AUTHOR)
	health_add = register_cvar("amx_vip_hp", "10")
         health_hs_add = register_cvar("amx_vip_hp_hs", "25")
         health_max = register_cvar("amx_vip_max_hp", "220")
         register_event("DeathMsg", "hook_death", "a", "1>0")
}
public hook_death()
{
   nKiller = read_data(1)
   
   if ( (read_data(3) == 1) && (read_data(5) == 0) )
   {
      nHp_add = get_pcvar_num (health_hs_add)
   }
   else
      nHp_add = get_pcvar_num (health_add)
   nHp_max = get_pcvar_num (health_max)
   if(!(get_user_flags(nKiller) & ADMIN_LEVEL_H))
   return;

   nKiller_hp = get_user_health(nKiller)
   nKiller_hp += nHp_add
   if (nKiller_hp > nHp_max) nKiller_hp = nHp_max
   set_user_health(nKiller, nKiller_hp)

}
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ ansicpg1250\\ deff0\\ deflang1045{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ f0\\ fs16 \n\\ par }
*/
Quote

Skull3D's Photo Skull3D 19.08.2011

Zrozumiałem do zamknięcia.
Quote

Adminek AMXX.PL's Photo Adminek AMXX.PL 19.08.2011

Wiadomość wygenerowana automatycznie


Ten temat został zamknięty przez moderatora.

Powód: "Do zamkniecia"

Jeśli się z tym nie zgadzasz, Dołączona grafika raportuj ten post, a moderator lub administrator rozpatrzy go ponownie.


Z pozdrowieniami,
Zespół AMXX.PL
Quote
Locked