Iperiux

Del scripting ShowHud

Recommended Posts


Apie tai kalbi?

#include 
#include 

#define PLUGIN_NAME	"Show Hud Message"
#define PLUGIN_VERSION	"1.0"
#define PLUGIN_AUTHOR	"AMX Mod X"

new g_CmdLevel_sync

public plugin_init()
{
register_plugin(PLUGIN_NAME, PLUGIN_VERSION, PLUGIN_AUTHOR)

register_clcmd("say /level", "CmdLevel")

g_CmdLevel_sync = CreateHudSyncObj()
}

public CmdLevel(id)
{
new g_LevelMsg[] = "!!! TAVO UZRASAS !!!"

/*
new r = random(255)
new g = random(255)
new b = random(255)
set_hudmessage(r, g, b, 0.05, 0.65, 2, 0.1, 6.0, 0.02, 0.02, -1)
*/

set_hudmessage(130, 180, 255, 0.05, 0.65, 2, 0.1, 6.0, 0.02, 0.02, -1)
ShowSyncHudMsg(id, g_CmdLevel_sync, g_LevelMsg)

/*
client_print(id, print_chat, g_LevelMsg)
client_print(id, print_center, g_LevelMsg)
*/

return PLUGIN_CONTINUE
}

Dalintis šį pranešimą


Nuoroda iki šio pranešimo
Dalintis per kitą puslapį
Apie tai kalbi?

#include 
#include 

#define PLUGIN_NAME	"Show Hud Message"
#define PLUGIN_VERSION	"1.0"
#define PLUGIN_AUTHOR	"AMX Mod X"

new g_CmdLevel_sync

public plugin_init()
{
register_plugin(PLUGIN_NAME, PLUGIN_VERSION, PLUGIN_AUTHOR)

register_clcmd("say /level", "CmdLevel")

g_CmdLevel_sync = CreateHudSyncObj()
}

public CmdLevel(id)
{
new g_LevelMsg[] = "!!! TAVO UZRASAS !!!"

/*
new r = random(255)
new g = random(255)
new b = random(255)
set_hudmessage(r, g, b, 0.05, 0.65, 2, 0.1, 6.0, 0.02, 0.02, -1)
*/

set_hudmessage(130, 180, 255, 0.05, 0.65, 2, 0.1, 6.0, 0.02, 0.02, -1)
ShowSyncHudMsg(id, g_CmdLevel_sync, g_LevelMsg)

/*
client_print(id, print_chat, g_LevelMsg)
client_print(id, print_center, g_LevelMsg)
*/

return PLUGIN_CONTINUE
}

apie tai, o cia rasys chate ?

Dalintis šį pranešimą


Nuoroda iki šio pranešimo
Dalintis per kitą puslapį
Aisku, bet man reiketu kad chate rodytu taip:

"[Level: %i/19]^n[XP: %i]^n[Rank]" ir uzrasas butu spalvotas

Kokio cia modo Leveliai ir XP?

Nuva kodas:

#include 
#include 
#include 
#include 
#include 
#include 

new const RANKS[7][] = {
"First", // 0 Level
"Super Natural", // 3 Level
"Tank", // 6 Level
"Boomer", // 9 Level
"Hiper Electro", // 12 Level
"Smoker", // 15 Level
"Runner" // 19 Level
}

new const LEVELS[20] = {
100, // "First", // 0 Level
300, // "First", // 1 Level
600, // "First", // 2 Level
1000, // "Super Natural", // 3 Level
1500, // "Super Natural", // 4 Level
2100, // "Super Natural", // 5 Level
2800, // "Tank", // 6 Level
3600, // "Tank", // 7 Level
4500, // "Tank", // 8 Level
5500, // "Boomer", // 9 Level
6600, // "Boomer", // 10 Level
7800, // "Boomer", // 11 Level
9100, // "Smoker", // 12 Level
10500, // "Smoker", // 13 Level
12000, // "Smoker", // 14 Level
13600, // "Hiper Electro", // 15 Level
15400, // "Hiper Electro", // 16 Level
17300, // "Hiper Electro", // 17 Level
19300, // "Runner", // 18 Level
21400 // "Runner" // 19 Level
}

new PlayerXP[33],PlayerLevel[33],PlayerRank[33]
new XP_Kill,XP_Knife,XP_Hs,SaveXP,g_vault

public plugin_init()
{
register_plugin("MysticDeath-XP", "1.0", "xFrost");

register_event("DeathMsg", "eDeath", "a")
RegisterHam(Ham_Spawn, "player", "fw_PlayerSpawn_Post", 1);

SaveXP = register_cvar("SaveXP","1")
XP_Kill=register_cvar("XP_per_kill", "10")
XP_Hs=register_cvar("XP_hs_bonus","15")
XP_Knife=register_cvar("XP_knife_bonus","10")
g_vault = nvault_open("animod")

register_clcmd("say level", "ShowLevel")
register_clcmd("say_team level", "ShowLevel")
}
public eDeath( ) 
{
new attacker = read_data( 1 )
new headshot = read_data( 3 )
new clip, ammo, weapon = get_user_weapon(attacker,clip,ammo);

PlayerXP[attacker] += get_pcvar_num(XP_Kill)

if(headshot)
PlayerXP[attacker] += get_pcvar_num(XP_Hs)

if(weapon == CSW_KNIFE)
PlayerXP[attacker] += get_pcvar_num(XP_Knife)

while(PlayerXP[attacker] >= LEVELS[PlayerLevel[attacker]])
{
client_print(attacker, print_chat, "[^x01MysticDeath-XP^x03]^x01 Congratulations!^x04 You are a level^x01 %i %s!^x03",PlayerLevel[attacker],RANKS[PlayerRank[attacker]])
PlayerLevel[attacker] = 0
}

ShowLevel(attacker)
SaveData(attacker)
}

public ShowLevel(id)
{
set_hudmessage(0, 5, 255, 0.01, 0.31, 1, 0.01, 3.0, 0.01, 0.01, 2)
show_hudmessage(id, "[Level]^n[XP]^n[Rank]",PlayerLevel[id],PlayerXP[id],RANKS[PlayerRank[id]])
}

public client_connect(id)
{
if(get_pcvar_num(SaveXP) == 1)
{

LoadData(id)
}
}
public client_disconnect(id)
{
if(get_pcvar_num(SaveXP) == 1)
{

SaveData(id)
}
PlayerXP[id] = 0
PlayerLevel[id] = 0
PlayerRank[id] = 0
}
public SaveData(id)
{
new AuthID[35]
get_user_authid(id,AuthID,34)

new vaultkey[64],vaultdata[256]
format(vaultkey,63,"%s-Mod",AuthID)
format(vaultdata,255,"%i#%i#",PlayerXP[id],PlayerLevel[id])
nvault_set(g_vault,vaultkey,vaultdata)
return PLUGIN_CONTINUE
}
public LoadData(id)
{
new AuthID[35]
get_user_authid(id,AuthID,34)

new vaultkey[64],vaultdata[256]
format(vaultkey,63,"%s-Mod",AuthID)
format(vaultdata,255,"%i#%i#",PlayerXP[id],PlayerLevel[id])
nvault_get(g_vault,vaultkey,vaultdata,255)

replace_all(vaultdata, 255, "#", " ")

new playerxp[32], playerlevel[32]

parse(vaultdata, playerxp, 31, playerlevel, 31)

PlayerXP[id] = str_to_num(playerxp)
PlayerLevel[id] = str_to_num(playerlevel)

return PLUGIN_CONTINUE
}

public fw_PlayerSpawn_Post(id)
{
switch (PlayerLevel[id]) 
{ 
case 0:
{
give_item (id, "weapon_glock18") 
client_cmd (id, "slot1; drop") 
give_item( id, "ammo_9mm") 
give_item( id, "ammo_9mm") 
give_item( id, "ammo_9mm") 
give_item( id, "ammo_9mm") 
give_item( id, "ammo_9mm") 
} 
case 1: 
{ 
give_item (id, "weapon_usp"); 
client_cmd (id, "slot1; drop")
give_item( id, "ammo_45acp") 
give_item( id, "ammo_45acp") 
give_item( id, "ammo_45acp") 
give_item( id, "ammo_45acp") 
give_item( id, "ammo_45acp") 
give_item(id, "weapon_smokegrenade")
} 
case 2: 
{ 
give_item (id, "weapon_p228"); 
client_cmd (id, "slot1; drop") 
give_item( id, "ammo_350sig") 
give_item( id, "ammo_350sig") 
give_item( id, "ammo_350sig") 
give_item( id, "ammo_350sig") 
give_item( id, "ammo_350sig")
give_item(id, "weapon_smokegrenade")
} 
case 3: 
{ 
give_item (id, "weapon_fiveseven");
client_cmd (id, "slot1; drop") 
give_item( id, "ammo_57mm") 
give_item( id, "ammo_57mm") 
give_item( id, "ammo_57mm") 
give_item( id, "ammo_57mm") 
give_item( id, "ammo_57mm")
give_item(id, "weapon_smokegrenade")
} 
case 4: 
{ 
give_item (id, "weapon_deagle");
client_cmd (id, "slot2; drop") 
give_item( id, "ammo_50ae") 
give_item( id, "ammo_50ae") 
give_item( id, "ammo_50ae") 
give_item( id, "ammo_50ae") 
give_item( id, "ammo_50ae")
give_item(id, "weapon_flashbang")
give_item(id, "weapon_flashbang")
} 
case 5: 
{ 
give_item (id, "weapon_elite");
client_cmd (id, "slot2; drop") 
give_item( id, "ammo_9mm") 
give_item( id, "ammo_9mm") 
give_item( id, "ammo_9mm") 
give_item( id, "ammo_9mm") 
give_item( id, "ammo_9mm")
give_item(id, "weapon_hegrenade")
} 
case 6: 
{ 
give_item (id, "weapon_tmp");
client_cmd (id, "slot1; drop") 
give_item( id, "ammo_9mm") 
give_item( id, "ammo_9mm")
give_item( id, "ammo_9mm")
give_item( id, "ammo_9mm")
give_item( id, "ammo_9mm")
give_item(id, "weapon_smokegrenade")
}
case 7: 
{ 
give_item (id, "weapon_mac10");
client_cmd (id, "slot1; drop") 
give_item( id, "ammo_45acp") 
give_item( id, "ammo_45acp") 
give_item( id, "ammo_45acp") 
give_item( id, "ammo_45acp") 
give_item( id, "ammo_45acp")
give_item(id, "weapon_smokegrenade")
} 
case 8: 
{ 
give_item (id, "weapon_ump45");
client_cmd (id, "slot1; drop")
give_item( id, "ammo_45acp")
give_item( id, "ammo_45acp") 
give_item( id, "ammo_45acp") 
give_item( id, "ammo_45acp") 
give_item( id, "ammo_45acp")
give_item(id, "weapon_smokegrenade")
} 
case 9: 
{ 
give_item (id, "weapon_mp5navy");
client_cmd (id, "slot1; drop") 
give_item( id, "ammo_9mm")
give_item( id, "ammo_9mm")
give_item( id, "ammo_9mm")
give_item( id, "ammo_9mm")
give_item( id, "ammo_9mm")
give_item(id, "weapon_smokegrenade")
} 
case 10: 
{ 
give_item (id, "weapon_p90");
client_cmd (id, "slot1; drop") 
give_item( id, "ammo_57mm")
give_item( id, "ammo_57mm")
give_item( id, "ammo_57mm")
give_item( id, "ammo_57mm")
give_item( id, "ammo_57mm")
give_item(id, "weapon_smokegrenade")
} 
case 11: 
{ 
give_item (id, "weapon_famas");
client_cmd (id, "slot1; drop") 
give_item( id, "ammo_556nato")
give_item( id, "ammo_556nato")
give_item( id, "ammo_556nato")
give_item( id, "ammo_556nato")
give_item( id, "ammo_556nato")
give_item(id, "weapon_hegrenade")
} 
case 12: 
{ 
give_item (id, "weapon_galil");
client_cmd (id, "slot1; drop")
give_item( id, "ammo_556nato")
give_item( id, "ammo_556nato")
give_item( id, "ammo_556nato")
give_item( id, "ammo_556nato")
give_item( id, "ammo_556nato")
give_item(id, "weapon_smokegrenade")
} 
case 13: 
{ 
give_item (id, "weapon_m3");
client_cmd (id, "slot1; drop") 
give_item( id, "ammo_buckshot")
give_item( id, "ammo_buckshot")
give_item( id, "ammo_buckshot")
give_item( id, "ammo_buckshot")
give_item( id, "ammo_buckshot")
give_item(id, "weapon_flashbang")
give_item(id, "weapon_flashbang")
} 
case 14: 
{ 
give_item (id, "weapon_ak47");
client_cmd (id, "slot1; drop")
give_item( id, "ammo_762nato")
give_item( id, "ammo_762nato")
give_item( id, "ammo_762nato")
give_item( id, "ammo_762nato")
give_item( id, "ammo_762nato")
give_item(id, "weapon_smokegrenade")
} 
case 15: 
{ 
give_item (id, "weapon_m4a1");
client_cmd (id, "slot1; drop")
give_item( id, "ammo_556nato")
give_item( id, "ammo_556nato")
give_item( id, "ammo_556nato")
give_item( id, "ammo_556nato")
give_item( id, "ammo_556nato")
give_item(id, "weapon_smokegrenade")
} 
case 16:
{
give_item (id, "weapon_sg550");
client_cmd (id, "slot1; drop")
give_item( id, "ammo_556nato")
give_item( id, "ammo_556nato")
give_item( id, "ammo_556nato")
give_item( id, "ammo_556nato")
give_item( id, "ammo_556nato")
give_item(id, "weapon_smokegrenade")
} 
case 17: 
{ 
give_item (id, "weapon_g3sg1");
client_cmd (id, "slot1; drop") 
give_item( id, "ammo_762nato")
give_item( id, "ammo_762nato")
give_item( id, "ammo_762nato")
give_item( id, "ammo_762nato")
give_item( id, "ammo_762nato")
give_item(id, "weapon_hegrenade")
give_item(id, "weapon_smokegrenade")
} 
case 18: 
{ 
give_item (id, "weapon_sg552");
client_cmd (id, "slot1; drop")
give_item( id, "ammo_556nato")
give_item( id, "ammo_556nato")
give_item( id, "ammo_556nato")
give_item( id, "ammo_556nato")
give_item( id, "ammo_556nato")
give_item(id, "weapon_flashbang")
give_item(id, "weapon_flashbang")
give_item(id, "weapon_smokegrenade")
} 
case 19:
{
give_item (id, "weapon_m249");
client_cmd (id, "slot1; drop")
give_item( id, "ammo_556natobox")
give_item( id, "ammo_556natobox")
give_item( id, "ammo_556natobox")
give_item( id, "ammo_556natobox")
give_item( id, "ammo_556natobox")
give_item(id, "weapon_smokegrenade")
give_item(id, "weapon_hegrenade")
give_item(id, "weapon_flashbang")
give_item(id, "weapon_flashbang")
}
}
}

Dalintis šį pranešimą


Nuoroda iki šio pranešimo
Dalintis per kitą puslapį

Prisijungti prie diskusijos

Palikti atsakymą galite iš karto, o užsiregistruoti vėliau. Jeigu jau turite paskyrą mūsų forume, Prisijunkite.

Svečias
Atsakyti šioje temoje...

×   Įklijuotas tekstas turi teksto formatavimą.   Pašalinti teksto formatavimą

  Galimi tik 75 veidukai.

×   Nuoroda buvo automatiškai įterpta.   Įterpti nuorodą paprastai

×   Jūsų ankstesnis pranešimas buvo atkurtas.   Išvalyti redaktorių

×   You cannot paste images directly. Upload or insert images from URL.


  • Šiame puslapyje naršo:   0 nariai

    Nėra registruotų narių peržiūrinčių šį forumą.

  • eneba
  • eneba
  • eneba



  • SuperGames programele
  • SuperGames programele