Ammo Pack ZP

Vaata eelmist teemat Vaata järgmist teemat Go down

ssand
ssand
Juunior
Liitus : 09/06/2016
Postitusi : 53

Postitaminessand 04.07.16 20:48

Hello i need plugin save ammo pack !

save ammo pack on Nick and IP and STEAM ID for dont lost Ammo pack

please can get this plugin , auto save ammo pack on nick , ip , steam id .

Thank You :) for Help !!
Lumistor
Lumistor

Liitus : 02/04/2015
Postitusi : 2771

PostitamineLumistor 04.07.16 20:50

what is your server ip and do you have a mysql server?
ssand
ssand
Juunior
Liitus : 09/06/2016
Postitusi : 53

Postitaminessand 04.07.16 21:15

i have Public IP : 185.34.52.145:27015
Soon ZP and i want know how to save ammo pack on ip , nick , steam id
can u told me how dude ? :)

Yes i have MySQL .
Lumistor
Lumistor

Liitus : 02/04/2015
Postitusi : 2771

PostitamineLumistor 04.07.16 21:19

can you shere your mod?
ssand
ssand
Juunior
Liitus : 09/06/2016
Postitusi : 53

Postitaminessand 04.07.16 21:21

can u told me now how save this ammo pack on nick , steam id , ip

maybe i will share all my mods
Tonight
Tonight

Ammo Pack ZP Vetera11
Liitus : 19/02/2012
Postitusi : 18000

PostitamineTonight 04.07.16 21:25

There are multiple threads about this @AMXX forums, for example: http://cs-bg.info/forum/viewtopic.php?f=50&t=52957
Kood:
#include <amxmodx>
#include <amxmisc>
#include <nvault>
#include <zombieplague>

enum Color {
   NORMAL = 1,
   GREEN,
   TEAM_COLOR,
   GREY,
   RED,
   BLUE,
}

new TeamName[][] = {
   "",
   "TERRORIST",
   "CT",
   "SPECTATOR"
}
/*END - From colorchat.inc by Numb */

new data_vault,
cvar_data_save_type, cvar_show_hp, cvar_give_ammo_public, cvar_ammo_limit
public plugin_init() {
   register_plugin("[ZP] Save-ammo by GM", "1.5", "GM")
   register_cvar("Save-ammo_version","1.4",FCVAR_SERVER | FCVAR_SPONLY)
   
   register_clcmd("say","hook_say")
   register_clcmd("say_team","hook_say")
   
   register_event("Damage","event_damage","b","2!0","3=0","4!0")
   
   cvar_data_save_type = register_cvar("Save-ammo_data_save_type","0")
   
   cvar_show_hp = register_cvar("Save-ammo_show_hp","3")
   
   cvar_give_ammo_public = register_cvar("Save-ammo_public","1")
   
   cvar_ammo_limit = register_cvar("Save-ammo_limit","0")
   
   data_vault = nvault_open("Save-ammo")
}

public hook_say(id)
{
   new args[129], arg_cmd[6],arg_name[32],arg_ap[10]
   read_args(args,128)
   remove_quotes(args)
   parse(args, arg_cmd,5, arg_name,31, arg_ap,9)
   
   if(equali(arg_cmd,"/give"))
   {
      new name[32],target_name[32],target, num_ap = str_to_num(arg_ap)
      get_user_name(id,name,31)
      target = cmd_target(id,arg_name,0)
      get_user_name(target,target_name,31)
      
      if(!target)
      {
         ColorChat(id,GREEN,"[ZP]^x01 nemo6e da se nameri igra4 s tova ima ^x04%s^x01 .",arg_name)
         return
      }
      
      if(equali(name,arg_name))
      {
         ColorChat(id,GREEN,"[ZP]^x01 vie nemo6e da dadete na ebe si.")
         return
      }
      
      if(zp_get_user_ammo_packs(id) < num_ap)
      {
         ColorChat(id,GREEN,"[ZP]^x01 vie nqmate ammota za da dadete.")
         return
      }
      
      if(num_ap <= 0)
      {
         ColorChat(id,GREEN,"[ZP]^x01 vie mo6e da davate samo polo6itelni ammota ot 1-10000.")
         return
      }
      
      zp_set_user_ammo_packs(id, zp_get_user_ammo_packs(id) - num_ap)
      zp_set_user_ammo_packs(target, zp_get_user_ammo_packs(target) + num_ap)
      
      ColorChat(id,GREEN,"[ZP]^x01 vie dadohte  ^x04%s^x01 ammo packs na ^x04%s^x01.",arg_ap,target_name)
      ColorChat(target,GREEN,"[ZP] %s^x01 vie polu4ihte ^x04%s^x01 ammo packs.",name,arg_ap)
      
      if(get_pcvar_num(cvar_give_ammo_public)) ColorChat(0,GREEN,"[ZP] %s^x01 gave ^x04%s^x01 ammo packs to ^x04%s^x01.",name,arg_ap,target_name)
   }
   
   if(equali(arg_cmd,"/ap")) ColorChat(id,GREEN,"[ZP]^x01 vie imate  ^x04%i^x01 ammo packs.",zp_get_user_ammo_packs(id))
}

public event_damage(id)
{
   new killer,hp
   killer = get_user_attacker(id)
   hp = get_user_health(id)
   
   if(!is_user_connected(killer) || !is_user_connected(id)) return
   
   if(hp > 0)
   {
      switch(get_pcvar_num(cvar_show_hp))
      {
         case 1: if(zp_get_user_zombie(id)) client_print(killer,print_center,"HP: %i",hp)
         case 2: if(zp_get_user_nemesis(id)) client_print(killer,print_center,"HP: %i",hp)
         case 3: if(zp_get_user_zombie(id) || zp_get_user_nemesis(id)) client_print(killer,print_center,"HP: %i",hp)
      }
   } else {
      switch(get_pcvar_num(cvar_show_hp))
      {
         case 1: if(zp_get_user_zombie(id)) client_print(killer,print_center,"KILLED!")
         case 2: if(zp_get_user_nemesis(id)) client_print(killer,print_center,"KILLED!")
         case 3: if(zp_get_user_zombie(id) || zp_get_user_nemesis(id)) client_print(killer,print_center,"KILLED!")
      }
   }
}

public client_putinserver(id)
{
   set_task(1.0,"load_user_data",id)
}

public client_disconnect(id)
{
   save_user_data(id)
}

public load_user_data(id)
{
   if(!is_user_connected(id)) return
   
   new user_data[64], vaultkey[64],vaultdata[256], data_ammo_packs[32],data_zombie_class[32]
   
   switch(get_pcvar_num(cvar_data_save_type))
   {
      case 1:
      {
         get_user_ip(id,user_data,63)
         format(vaultkey,63,"[ip]%s",user_data)
      }
      case 2:
      {
         get_user_authid(id,user_data,63)
         format(vaultkey,63,"[aulthid]%s",user_data)
      }
      default:
      {
         get_user_name(id,user_data,63)
         format(vaultkey,63,"[name]%s",user_data)
      }
   }
   
   format(vaultdata,255,"%i#%i#",zp_get_user_ammo_packs(id),zp_get_user_zombie_class(id))
   nvault_get(data_vault,vaultkey,vaultdata,255)
   replace_all(vaultdata,255,"#"," ")
   
   parse(vaultdata, data_ammo_packs,31, data_zombie_class,31)
   zp_set_user_ammo_packs(id, str_to_num(data_ammo_packs))
   zp_set_user_zombie_class(id, str_to_num(data_zombie_class))
   
   if(get_pcvar_num(cvar_ammo_limit) != 0 && zp_get_user_ammo_packs(id) > get_pcvar_num(cvar_ammo_limit)) zp_set_user_ammo_packs(id,get_pcvar_num(cvar_ammo_limit))
}

public save_user_data(id)
{
   new user_data[64], vaultkey[64],vaultdata[256]
   
   switch(get_pcvar_num(cvar_data_save_type))
   {
      case 1:
      {
         get_user_ip(id,user_data,63)
         format(vaultkey,63,"[ip]%s",user_data)
      }
      case 2:
      {
         get_user_authid(id,user_data,63)
         format(vaultkey,63,"[aulthid]%s",user_data)
      }
      default:
      {
         get_user_name(id,user_data,63)
         format(vaultkey,63,"[name]%s",user_data)
      }
   }
   
   format(vaultdata,255,"%i#%i#",zp_get_user_ammo_packs(id),zp_get_user_zombie_class(id))
   nvault_set(data_vault,vaultkey,vaultdata)
}

/*START - From colorchat.inc by Numb */
ColorChat(id, Color:type, const msg[], {Float, Sql, Result,_}:...) {
   new message[256]

   switch(type) {
      case NORMAL: message[0] = 0x01
      case GREEN: message[0] = 0x04
      default: message[0] = 0x03
   }

   vformat(message[1], 251, msg, 4)

   message[192] = '^0'

   new team, ColorChange, index, MSG_Type

   if(id) {
      MSG_Type = MSG_ONE
      index = id
   } else {
      index = FindPlayer()
      MSG_Type = MSG_ALL
   }

   team = get_user_team(index)
   ColorChange = ColorSelection(index, MSG_Type, type)

   ShowColorMessage(index, MSG_Type, message)

   if(ColorChange)
      Team_Info(index, MSG_Type, TeamName[team])
}

ShowColorMessage(id, type, message[]) {
   static bool:saytext_used
   static get_user_msgid_saytext

   if(!saytext_used) {
      get_user_msgid_saytext = get_user_msgid("SayText")
      saytext_used = true
   }

   message_begin(type, get_user_msgid_saytext, _, id)
   write_byte(id)
   write_string(message)
   message_end()
}

Team_Info(id, type, team[]) {
   static bool:teaminfo_used
   static get_user_msgid_teaminfo

   if(!teaminfo_used) {
      get_user_msgid_teaminfo = get_user_msgid("TeamInfo")
      teaminfo_used = true
   }

   message_begin(type, get_user_msgid_teaminfo, _, id)
   write_byte(id)
   write_string(team)
   message_end()

   return 1
}

ColorSelection(index, type, Color:Type) {
   switch(Type) {
      case RED: return Team_Info(index, type, TeamName[1])
      case BLUE: return Team_Info(index, type, TeamName[2])
      case GREY: return Team_Info(index, type, TeamName[0])
   }

   return 0
}

FindPlayer() {
   new i = -1

   while(i <= get_maxplayers()) {
      if(is_user_connected(++i))
         return i
   }

   return -1
}
Check cvar: Save-ammo_data_save_type "0/1/2"
0 = nick; 1 = IP; 2 = SteamID

Another example: https://forums.alliedmods.net/showthread.php?t=137423
ssand
ssand
Juunior
Liitus : 09/06/2016
Postitusi : 53

Postitaminessand 04.07.16 21:32

i have this , and this plugin i need choose on nick or ip or steam id
i want save ammo pack on 3 , nick and ip and steam id

he told MySQL what i need do guys ?
ssand
ssand
Juunior
Liitus : 09/06/2016
Postitusi : 53

Postitaminessand 04.07.16 21:42

Can Change This Lang To English i can't Understand it for changer :D
pls change it :)
Tonight
Tonight

Ammo Pack ZP Vetera11
Liitus : 19/02/2012
Postitusi : 18000

PostitamineTonight 04.07.16 21:45

@Wasti, tõlgi ära vene keelest. :D
ssand
ssand
Juunior
Liitus : 09/06/2016
Postitusi : 53

Postitaminessand 04.07.16 21:46

Tonight kirjutas:@Wasti, tõlgi ära vene keelest. :D

What :o ??
ssand
ssand
Juunior
Liitus : 09/06/2016
Postitusi : 53

Postitaminessand 04.07.16 22:05

man i go to cavar but i dont see This :
Save-ammo_data_save_type "0/1/2"
0 = nick; 1 = IP; 2 = SteamID

Vaata eelmist teemat Vaata järgmist teemat Tagasi üles

Soovid vestluses osaleda?

Selleks logi sisse või tee endale kasutaja.

Liitu foorumiga

Tee endale kasutaja ning osale aruteludes.


Tee uus kasutaja

Logi sisse

Omad foorumis juba kasutajat? Logi sisse.


Logi sisse

 
Permissions in this forum:
Sa ei saa vastata siinsetele teemadele