AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Plugin Run Once and Stop(PLUGIN_) See 3rd post (https://forums.alliedmods.net/showthread.php?t=27199)

stax 04-17-2006 02:19

Plugin Run Once and Stop(PLUGIN_) See 3rd post
 
Ok, this plugin is for my TSRP server and it delete 20 dollars when player die because the city need to bury his / her bones. But i still have a problem ! When the client die 1 time, each other die are not counted ! the plugis is....stopped I think...please help me, this is my 2nd plugin ! This is the script :
Code:
/* Plugin generated by AMXX-Studio */ #include <amxmodx> #include <amxmisc> #define PLUGIN "diesetcash" #define VERSION "1.0" #define AUTHOR "Stax" public plugin_init() {     register_plugin(PLUGIN, VERSION, AUTHOR)     new username[18]     new id = get_user_userid(id)     get_user_name(id, username,17)     if(get_user_deaths(id) != 0)     {     if(is_user_alive(id))     {     log_amx("player %s is dead ! $20 is destroyed from his bank account !", username)     client_print(id,print_chat,"Oh dear ! You are dead and the city need to bury your bones ! $20 is gived to the city from your bank account !")     server_cmd("amx_additems %s 202 1", username)     server_cmd("amx_destroymoney %s 20", username)     return PLUGIN_HANDLED     } }     return PLUGIN_HANDLED   }
Okay...I got another problem ! It simply don't run on amxx v1.01 (Bad Load) And I Can't use amxx v1.7 because this version of amxx does not support HarbuRP.... Thanks in advance.

Goshik 04-17-2006 05:37

use the small code next time :?

Code:
#include <amxmodx> #include <amxmisc> public plugin_init() {    register_plugin("Die Set Cash","1.0","Stax")    new username[18]    new id = get_user_userid(id)    get_user_name(id, username,17)    if(get_user_deaths(id) != -1)    {    if(is_user_alive(id))    {    log_amx("player %s is dead ! $20 is destroyed from his bank account !", username)    client_print(id,print_chat,"Oh dear ! You are dead and the city need to bury your bones ! $20 is gived to the city from your bank account !")    server_cmd("amx_additems %s 202 1", username)    server_cmd("amx_destroymoney %s 20", username)    }    return PLUGIN_HANDLED    }    return PLUGIN_CONTINUE     }

Sandurr 04-17-2006 11:34

Code:
#include <amxmodx>   #include <amxmisc>   #define CASHLOST 20 // How much cash player loses when he dies for the first time new gDeaths[32] public plugin_init() {     register_plugin("Stax","0.1","Sandurr")     register_event("DeathMsg","death_event","a") } public client_putinserver(id)     gDeaths[id-1] = 0 public death_event() {     new id = read_data(2), aName[32]     if(gDeaths[id-1] == 0)     {         gDeaths[id-1]++         get_user_name(id,aName,sizeof(aName))         log_amx("Player %s Died and lost $%i Cash!",aName,CASHLOST)         server_cmd("amx_destroymoney %s %i",aName,CASHLOST)         client_print(id,print_chat,"[AMXX] Oh Dear, You died and lost $%i to pay the city to bury your bones!^n",CASHLOST)     }     return PLUGIN_CONTINUE; }

stax 04-17-2006 12:56

Thanks a lot guys, I will test it :)
--------------------------------------------------------------------------------------
It don't work on AMXX V 1.01 !!!! Can someone please help me (again) :(
--------------------------------------------------------------------------------------

Fixed...But I still have a problem lol !

I need aName to be in quotes...eg : (in server console) amx_destroymoney "Player Name" 20

Anyway...this is the line :

Code:
server_cmd("amx_destroymoney %s %i",aName,CASHLOST)

--------------------------------------------------------------------------------------

NVM...Fixed...But, now, it only run once and stop !
This is my script :

Code:
#include <amxmodx>   #include <amxmisc>   #define CASHLOST 20    // How much cash player loses when he dies for the first time new gDeaths[32] public plugin_init() {     register_plugin("DieSetCash","0.1","Sandurr And Stax")     register_event("DeathMsg","death_event","a") } public client_putinserver(id)     gDeaths[id-1] = 0 public death_event() {     new id = read_data(2), aName[32]     if(gDeaths[id-1] == 0)     {         gDeaths[id-1]++         get_user_name(id,aName,sizeof(aName))         log_amx("Player %s Died and lost $%i Cash!",aName,CASHLOST)         server_cmd("amx_destroymoney ^"%s^" %i",aName,CASHLOST)         client_print(id,print_chat,"[AMXX] Oh Dear, You died and lost $%i to pay the city to bury your bones!^n",CASHLOST)     return PLUGIN_CONTINUE;     }     return PLUGIN_CONTINUE; }

Sandurr 04-18-2006 05:05

Didn't you want it to run only once???

Xanimos 04-18-2006 07:41

Quote:

Originally Posted by Sandurr
Didn't you want it to run only once???

No, his problem was it only ran once.

Sandurr 04-18-2006 09:20

Code:
#include <amxmodx>   #include <amxmisc>   #define CASHLOST 20    // How much cash player loses when he dies public plugin_init() {     register_plugin("DieSetCash","0.1","Sandurr And Stax")     register_event("DeathMsg","death_event","a") } public death_event() {     new id = read_data(2), aName[32]     get_user_name(id,aName,sizeof(aName))     log_amx("Player %s Died and lost $%i Cash!",aName,CASHLOST)     server_cmd("amx_destroymoney ^"%s^" %i",aName,CASHLOST)     client_print(id,print_chat,"[AMXX] Oh Dear, You died and lost $%i to pay the city to bury your bones!^n",CASHLOST)     return PLUGIN_CONTINUE; }

Ok then this

stax 04-19-2006 00:07

Thank you guys :)


All times are GMT -4. The time now is 04:59.

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