Raised This Month: $ Target: $400
 0% 

Why it doesnt work?


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
Noizza
Senior Member
Join Date: Apr 2004
Location: Vienna (PROUD)
Old 06-05-2004 , 13:11   Why it doesnt work?
Reply With Quote #1

Code:
new PLUGINNAME[] = "Remember the frags" new VERSION[] = "0.2b" /* <a href="http://amxmod.net/forums/viewtopic.php?t=19024" target="_blank" rel="nofollow noopener">http://amxmod.net/forums/viewtopic.php?t=19024</a> Copyleft by Johnny got his gun REMEMBER THE FRAGS ================== You connect to a server with this plugin installed. You frag 2 people. You log off. The next day when you log on the same server, your frags will remain on score board. Same goes with deaths. Have fun. INSTALL ======= Yes. :-) *REQUIRES* amxmod v0.9.4! Developed for RC5... USAGE ===== amx_storefrags - Your frags and deaths will be stored when you log off, but you can use this command any time to store them right away. RELEASES ======== 2003-11-25    version 0.2b:    Well long time no sea, and not a lot of working plugin lately because of new stuff with Steam and all.                             Setting deaths back doesn't seem to work anymore, added to to do list. 2003-07-24    version 0.2:    Now remembers deaths also. 2003-07-23    version 0.1:    First release TO DO ===== - fix setting deaths... */ #include <amxmod> #include <amxmisc> #include <csstats> // Globals below new gmsgScoreInfo new bool:reread = false new playersFrags[33] new playersDeaths[33] // Globals above public client_disconnect(id) {     storeFrags(id)     storeDeaths(id) } public client_putinserver(id) {     // Restore frags n deaths from file.     new idd[1]     idd[0] = id     set_task(1.0,"delayedrestore",0,idd,1)     return PLUGIN_CONTINUE } public delayedrestore(idd[]) {     restoreVaultData(idd[0]) } public restoreme(id,level,cid) {     if (!cmd_access(id,level,cid,1)) {         return PLUGIN_HANDLED     }     restoreVaultData(id)     return PLUGIN_HANDLED } public saveme(id,level,cid) {     /*     if (!cmd_access(id,level,cid,1)) {         return PLUGIN_HANDLED     }     */     storeFrags(id)     storeDeaths(id)     return PLUGIN_HANDLED } native set_user_deaths_cs(index,deaths); restoreVaultData(id) {     new keyString[40] = "frags", frags, deaths     setKeyString(id,keyString)     if (vaultdata_exists(keyString)) {         frags = get_vaultdata(keyString)         set_user_frags(id,frags)     }     keyString = "death"     setKeyString(id,keyString)     if (vaultdata_exists(keyString)) {         deaths = get_vaultdata(keyString)         set_user_deaths_cs(id,deaths)     }     if (!frags)         frags = get_user_frags(id)     if (!deaths)         deaths = get_user_deaths(id)     // With the below message, we can update the scores shown without having to wait     // for next round or when id dies/shoots someone or something like that.     sendScoreInfo(id,frags,deaths,get_user_team(id)) } sendScoreInfo(id,frags,deaths,team) {     message_begin(MSG_ALL,gmsgScoreInfo)     write_byte(id)     write_short(frags)     write_short(deaths)     write_short(0)     write_short(team)     message_end() } setKeyString(id,keyString[40]) {     if (is_user_bot(id)) {         new name[32]         get_user_name(id,name,31)         new spaces = charOccurances(name," ")         for (new i = 0;i < spaces;i++) {             replace(name,31," ","_")         }         copy(keyString[5],34,name)     }     else {         new authidString[32]         get_user_authid(id, authidString, 31)         copy(keyString[5], 34, authidString)     } } storeFrags(id) {     new keyString[40] = "frags"     setKeyString(id,keyString)     //client_print(0,print_chat,"fragKeyString after copy is '%s'.",fragKeyString)     new fragsString[10]     numtostr(get_user_frags(id),fragsString,9)     set_vaultdata(keyString,fragsString)     //client_print(0,print_chat,"Stored %s to %s.",fragsString,keyString) } stock charOccurances(string[],matchchar[]) {     if (strlen(matchchar) != 1)         return -1     new occurances     new len = strlen(string)     for (new i = 0;i < len;i++) {         if (string[i] == matchchar[0]) {             occurances++         }     }           return occurances } storeDeaths(id) {     new keyString[40] = "death"     setKeyString(id,keyString)     //client_print(0,print_chat,"keyString after copy is '%s'.",keyString)     new deathString[10]     numtostr(get_user_deaths(id),deathString,9)     set_vaultdata(keyString,deathString)     //client_print(0,print_chat,"Stored %s to %s.",deathString,keyString) } public restarting_event() {     reread = true     // Will need to do a quick remembering of current frags here...     // Restore these values at next newround_event. Only restore     // if these are larger than the values in the vault. If not,     // use those larger values.     new players[32], playersFound     get_players(players,playersFound)     for (new i = 0;i < playersFound;i++) {         playersFrags[players[i]] = get_user_frags(players[i])         playersDeaths[players[i]] = get_user_deaths(players[i])     } } public commencing_event() {     reread = true     // Will need to do a quick remembering of current frags here...     // Restore these values at next newround_event. Only restore     // if these are larger than the values in the vault. If not,     // use those larger values.     new players[32], playersFound     get_players(players,playersFound)     for (new i = 0;i < playersFound;i++) {         playersFrags[players[i]] = get_user_frags(players[i])         playersDeaths[players[i]] = get_user_deaths(players[i])     } } public instantReread() {     if (reread) {         reread = false         reread_function()     } } stock getVaultFrags(id) {     new keyString[40] = "frags"     setKeyString(id,keyString)     if (vaultdata_exists(keyString)) {         return get_vaultdata(keyString)     }     else {         return playersFrags[id]     }     return 0 } stock getVaultDeaths(id) {     new keyString[40] = "death"     setKeyString(id,keyString)     if (vaultdata_exists(keyString) && get_vaultdata(keyString) > playersDeaths[id]) {         return get_vaultdata(keyString)     }     else {         return playersDeaths[id]     }     return 0 } public reread_function() {     new players[32], playersFound, keyString[40], vaultFrags, vaultDeaths, name[32]     get_players(players,playersFound)     for (new i = 0;i < playersFound;i++) {         get_user_name(players[i],name,31)         keyString = "frags"         setKeyString(players[i],keyString)         if (!vaultdata_exists(keyString)) {             //client_print(0,print_chat,"%s has no previous frags stored, restoring %d from variable.",name,playersFrags[players[i]])             set_user_frags(players[i],playersFrags[players[i]])             vaultDeaths = getVaultDeaths(players[i])             set_user_deaths_cs(players[i],vaultDeaths)             sendScoreInfo(players[i],playersFrags[players[i]],vaultDeaths,get_user_team(players[i]))         }         else {             // Compare values, set the biggest one.             vaultFrags = get_vaultdata(keyString)             if (vaultFrags >= playersFrags[players[i]]) {                 set_user_frags(players[i],vaultFrags)                 vaultDeaths = getVaultDeaths(players[i])                 set_user_deaths_cs(players[i],vaultDeaths)                 sendScoreInfo(players[i],vaultFrags,vaultDeaths,get_user_team(players[i]))                 //client_print(0,print_chat,"%s has larger value in variable, %d to %d.",name,vaultFrags,playersFrags[players[i]])             }             else {                 set_user_frags(players[i],playersFrags[players[i]])                 vaultDeaths = getVaultDeaths(players[i])                 set_user_deaths_cs(players[i],vaultDeaths)                 sendScoreInfo(players[i],playersFrags[players[i]],vaultDeaths,get_user_team(players[i]))                 //client_print(0,print_chat,"%s has larger value in vault, %d to %d.",name,playersFrags[players[i]],vaultFrags)             }         }     } } public setdatafromstats(id,level,cid) {     if (!cmd_access(id,level,cid,1)) {         return PLUGIN_HANDLED     }     new stats[8], bodyHits[8]     get_user_wstats(id,0,stats,bodyHits)     set_user_frags(id,stats[0])     set_user_deaths_cs(id,stats[1])     console_print(id,"0:%d, 1:%d, 2:%d, 3:%d, 4:%d, 5:%d, 6:%d, 7:%d",stats[0],stats[1],stats[2],stats[3],stats[4],stats[5],stats[6],stats[7])     sendScoreInfo(id,stats[0],stats[1],get_user_team(id))     return PLUGIN_HANDLED } public plugin_init() {     register_plugin(PLUGINNAME, VERSION, "jghg")     register_clcmd("0restorevault","restoreme",ADMIN_CFG,": restores your frags from vault.")     register_clcmd("0restorestats","setdatafromstats",ADMIN_CFG,": restores your frags from stats.")     register_clcmd("amx_storefrags","saveme",0,": stores your frags and deaths.")     register_event("TextMsg","commencing_event","a","2=#Game_Commencing")     register_event("TextMsg","restarting_event","a","2=#Game_will_restart_in")     //register_event("ResetHUD","newround_event","b")     register_event("SendAudio","instantReread","b","2=%!MRAD_GO","2=%!MRAD_MOVEOUT","2=%!MRAD_LETSGO","2=%!MRAD_LOCKNLOAD")     gmsgScoreInfo = get_user_msgid("ScoreInfo") }

no errors on compiling but i get bad load
__________________
Quote:
Originally Posted by Johnny got his gun
Read the plugin posting rules. They apply to everyone, including you.
kk...
#include <noizza>
lol

try my Server!
193.53.80.122:27016 Super-Fun Server [SHmod+DM]
Noizza is offline
Send a message via ICQ to Noizza
 



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 14:50.


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