Raised This Month: $ Target: $400
 0% 

Can someone help me ?


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
K.K.Lv
Veteran Member
Join Date: Aug 2008
Location: GameFolder
Old 06-19-2009 , 05:33   Can someone help me ?
Reply With Quote #1

i have writen a code ,can record the player's ip ,
but when i open the vault file ,i saw some problem
please see the following photo and the code !!
can someone tell me what wrong?
thanks!!!
PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <li_geoip>
#include <nvault>
#define PLUGIN_NAME "Ip Record"
#define PLUGIN_VERSION "1.0"
#define PLUGIN_AUTHOR "K.K.Lv"
#define NVAULT
new i_pShowipiTimeSiTimeMiTimeHiTimeDiTimeMo
new iTotaltime[33]
new 
iLastip[33]
new 
iUserlastip[33]
public 
plugin_init()
{
 
register_plugin(PLUGIN_NAMEPLUGIN_VERSIONPLUGIN_AUTHOR)
 
 
//------------------register client command--------------
 
 
register_clcmd("say""say_handle")
 
register_clcmd("say /ipmenu""showmenu")
 
register_clcmd("say_team /ipmenu""showmenu")
 
 
//------------------register Cvar------------------------
 
 
i_pShowip register_cvar("amx_show_ip""1")
}
public 
showmenu(id)
{
 if (!
get_pcvar_num(i_pShowip))
  return 
PLUGIN_HANDLED
 
 
if (!(get_user_flags(id) & ADMIN_RESERVATION))
 {
  
client_print(idprint_center"Sorry, Your can't use this command.")
  return 
PLUGIN_HANDLED
 
}
 
 new 
menu menu_create("\rPlayer's IP Menu:""menu_handler")
 
 new 
iPlayers[32], iNumiPlayerid
 
new iTempid[10], iName[32]
 
 
get_players(iPlayersiNum)
 
 for (new 
iiNumi++)
 {
  
iPlayerid iPlayers[i]
 
  
get_user_name(iPlayeridiNamecharsmax(iName))
  
num_to_str(iPlayeridiTempidcharsmax(iTempid))
 
  
menu_additem(menuiNameiTempid0)
 }
 
menu_display(idmenu0)
 return 
PLUGIN_CONTINUE
}
public 
menu_handler(idmenuitem)
{
 if (
item == MENU_EXIT)
 {
  
menu_destroy(menu)
  return 
PLUGIN_HANDLED
 
}
 
 new 
iData[6], iName[64]
 new 
iAccessiCallback
 menu_item_getinfo
(menuitemiAccessiData5iName63iCallback)
 
 new 
tempid str_to_num(iData)
 
 if(
is_user_alive(tempid))
  
displayip(tempidtempid)
 
 
menu_destroy(menu)
 return 
PLUGIN_HANDLED
}
public 
displayip(iddest)
{
 new 
iLeniUserip[16], iName[32], iCountry[40], iOldcountry[40], iArea[64], iOldarea[64], iMotd[2048]
 
 
get_user_ip(idiUseripcharsmax(iUserip), 1)
 
geoip_info(iUseripiCountryiAreacharsmax(iCountry), charsmax(iArea))
 
iUserlastip[id] = loadip(id) ? iLastip[id]:iUserip[id]
 
geoip_info(iUserlastip[id], iOldcountryiOldareacharsmax(iOldcountry), charsmax(iOldarea))
 
 new 
iTime get_user_time(id1)
 
iTimeS = (iTime iTotaltime[id])%60
 iTimeM 
= ((iTime+iTotaltime[id])/60)%60
 iTimeH 
= (((iTime+iTotaltime[id])/60)/60)%24
 iTimeD 
= ((((iTime+iTotaltime[id])/60)/60)/24)%30
 iTimeMo 
= ((((iTime+iTotaltime[id])/60)/60)/24)/30
 
 iLen 
+= copy(iMotd[iLen], 2047-iLen"<meta charset=UTF-8><style>body{font-family:Arial,sans-serif;font-size:12px;color:#FFFFFF;background-color:#000000;margin-left:8px;margin-top:3px}.header{background-color:#9A9DA2;}.one{background-color:#565759;}.two{background-color:#3D3D3D;}")
 
iLen += format(iMotd[iLen], 2047-iLen"</style></head><body><table><tr><td colspan=2>%sCountry-Area-IP's Info--</td></tr>",(id==dest)?"your":"his")
 
iLen += format(iMotd[iLen], 2047-iLen"<tr class=^"one^"><td>The Last IP:</td><td>%s</td></tr><tr class=^"two^"><td>The Last Country:</td><td>%s</td></tr><tr class=^"one^"><td>The Last Area:</td><td>%s</td></tr><tr class=^"two^"><td>Your IP:</td><td>%s</td></tr><tr class=^"one^"><td>Country :</td><td>%s</td></tr><tr class=^"two^"><td>Area:</td><td>%s</td></tr><tr><td>&nbsp;</td><td>&nbsp;</td></tr>"iUserlastip[id], iOldcountryiOldareaiUseripiCountryiArea)
 
iLen += format(iMotd[iLen], 2047-iLen"<tr class=^"header^"><td colspan=2>The Player Time Statistical:</td></tr><tr class=^"one^"><td>Play Time:</td><td>%dH %dM %dS</td></tr><tr class=^"two^"><td>Total Time:</td><td>%dM %D %H %M %S</td></tr>", ((iTime/60)/60)%24, (iTime/60)%60iTime%60iTimeMoiTimeDiTimeHiTimeMiTimeS)
 
copy(iMotd[iLen], 2047-iLen"</table></body></html>")
 
 
get_user_name(idiName31)
 
show_motd(destiMotdiName)
}
#if defined NVAULT
public client_disconnect(id)
{
 
iTotaltime[id] = iTotaltime[id] + get_user_time(id)
 
savetime(idiTotaltime[id])
 
 new 
iUserip[16]
 
get_user_ip(idiUserip151)
 
iLastip[id] = iUserip[id]
 
saveip(idiLastip[id])
}
#endif
#if defined NVAULT
public client_putinserver(id)
{
 
iTotaltime[id] = loadtime(id)
 
 
iLastip[id] = loadip(id)
}
#endif
#if defined NVAULT
public savetime(indexplayertime)
{
 new 
nvault nvault_open("total_time")
 
 if(
nvault == -1)
  
set_fail_state("nValut returned invalid handle")
 
 new 
iName[32]
 new 
vaultkey[64], vaultdata[64]
 
 
get_user_name(indexiNamecharsmax(iName))
 
 
format(vaultkey63"%s"iName)
 
format(vaultdata63"%d"playertime)
 
 
nvault_set(nvaultvaultkeyvaultdata)
 
nvault_close(nvault)
}
#endif
#if defined NVAULT
public loadtime(index)
{
 new 
nvault nvault_open("total_time")
 
 new 
iName[32]
 new 
vaultkey[64], vaultdata[64]
 
 
get_user_name(indexiNamecharsmax(iName))
 
 
format(vaultkey63"%s"iName)
 
 
nvault_get(nvaultvaultkeyvaultdata63)
 
nvault_close(nvault)
 
 return 
str_to_num(vaultdata)
}
#endif
#if defined NVAULT
public saveip(indexuserip)
{
 new 
nvault nvault_open("user_ip")
 
 if (
nvault == -1)
  
set_fail_state("nValut returned invalid handle")
 
 new 
iName[32]
 new 
vaultkey[64], vaultdata[64]
 
 
get_user_name(indexiNamecharsmax(iName))
 
format(vaultkey63"%s"iName)
 
format(vaultdata63"%s"userip)
 
nvault_set(nvaultvaultkeyvaultdata)
 
nvault_close(nvault)
}
#endif
#if defined NVAULT
public loadip(index)
{
 new 
nvault nvault_open("user_ip")
 new 
iName[32]
 new 
vaultkey[64], vaultdata[64]
 
get_user_name(indexiNamecharsmax(iName))
 
format(vaultkey63"%s"iName)
 
nvault_get(nvaultvaultkeyvaultdata63)
 
nvault_close(nvault)
 return 
str_to_num(vaultdata)
}
#endif
public say_handle(id)
{
 new 
said[32]
 
read_args(said31)
 
 if (
equali(said"^"showip^"") || equali(said"^"/showip^""))
  
displayip(idid)
 return 
PLUGIN_CONTINUE

Attached Images
File Type: bmp photo.bmp (69.6 KB, 146 views)
K.K.Lv is offline
Send a message via MSN to K.K.Lv
 



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 15:36.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode