AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Help to: payment for a function. (https://forums.alliedmods.net/showthread.php?t=11886)

stigma 03-30-2005 15:05

Help to: payment for a function.
 
First I will past the script:

Code:
#include <amxmodx> #include <cstrike> #include <fun> public plugin_init() {     register_plugin("Auto Healing","1.0","stigma")     register_clcmd("say /heal","autoHeal",0,"Gives a client +3HP for 15 seconds")     register_event("DeathMsg","annouce","a","0") } public autoHeal(id) {         new health = get_user_health( id )         if(health >= 50) {                 set_hudmessage(40,100,50, 0.03, 0.76, 2, 0.02, 1.0, 0.01, 0.1, 6)         show_hudmessage(id,"Your health have to be below 50!")         }                     if(health < 40) {         new sHealth = get_user_health( id ) + 5         new fHealth = 50 - health - 5                 set_hudmessage(40,100,50, 0.03, 0.76, 2, 0.02, 1.0, 0.01, 0.1, 3)         show_hudmessage(id,"Current health: %i^nHealth needed before 50: %i",sHealth,fHealth)             set_user_health(id, health+5)                 set_task(1.0,"autoHeal",id)                 return PLUGIN_HANDLED             }         if((health < 50) & (health >= 40)) {                 set_user_health(id, health+1)                 new slHealth = get_user_health( id )         new fHealth = 50 - health - 1                 set_hudmessage(40,100,50, 0.03, 0.76, 2, 0.02, 1.0, 0.01, 0.1, 4)         show_hudmessage(id,"Current health: %i^nHealth needed before 50: %i",slHealth,fHealth)                         set_task(1.0,"autoHeal",id)                 return PLUGIN_HANDLED     }         return PLUGIN_HANDLED     } public annouce() {         set_hudmessage(40,100,50, 0.20, 0.30, 2, 0.05, 5.0, 0.01, 0.1, 5)     show_hudmessage(0,"Use /heal to get auto healed until you have 50 hp^nIt would cost you 3000$")     }

This works fine, but as soon I put:
Code:
cs_get_user_money( id )
into the script, it returns 'bad load'. Anyone who can help me with this problem?

What I want to do is: When a client write /heal - it should cost him 3000$ and I have tryed to make that. But when I do that, it returns bad load...

And also the last function 'annouce'. I want the message to appear every 15 minutes, with a task, but I don't know how I can do that, or actualy, I do know this: I tryed
Code:
set_task(900.0,"annouce",id,_,_,"b",_)
because I was told that the underscore was like a 'skipper' so it would skip the paraments. :?

KyleD 03-30-2005 16:17

http://forums.alliedmods.net/showthread.php?t=11156

Something like this?

stigma 03-30-2005 16:43

Yea. I've tryed the same, but there aint happing anything.... :roll: :?:

v3x 03-30-2005 17:40

Try using PLUGIN_CONTINUE..

stigma 04-01-2005 12:23

Dosent work - im getting bad load when i put 'cs_get_user_money' into the script - http://forums.alliedmods.net/showthread.php?t=11868

v3x 04-01-2005 16:36

Code:
public annouce() {         set_hudmessage(40,100,50, 0.20, 0.30, 2, 0.05, 5.0, 0.01, 0.1, 5)     show_hudmessage(0,"Use /heal to get auto healed until you have 50 hp^nIt would cost you 3000$")     // Doesn't return anything? }

stigma 04-01-2005 17:03

Ooh i'll try

Edit: Dosen't work....

Ced 04-02-2005 12:18

you can try this but did not test

Code:
#include <amxmodx> #include <cstrike> #include <fun> #define price 3000 public plugin_init() {     register_plugin("Auto Healing","1.0","stigma")     register_clcmd("say /heal","autoHeal",0,"Gives a client +3HP for 15 seconds")     set_task(900.0, "annouce", 0, _, _, "b") } public autoHeal(id) {           new health = get_user_health( id )           if(health >= 50) {                   set_hudmessage(40,100,50, 0.03, 0.76, 2, 0.02, 1.0, 0.01, 0.1, 6)         show_hudmessage(id,"Your health have to be below 50!")         return PLUGIN_HANDLED     }     else if(cs_get_user_money(id) < price) {         client_print(id, print_center,"You need $3000 to heal")         return PLUGIN_HANDLED     }               else if(health < 40) {         cs_set_user_money(id, cs_get_user_money(id) - price)                 new sHealth = get_user_health( id ) + 5         new fHealth = 50 - health - 5                   set_hudmessage(40,100,50, 0.03, 0.76, 2, 0.02, 1.0, 0.01, 0.1, 3)         show_hudmessage(id,"Current health: %i^nHealth needed before 50: %i",sHealth,fHealth)               set_user_health(id, health+5)                   set_task(1.0,"autoHeal",id)     }     else if((health < 50) & (health >= 40)) {         cs_set_user_money(id, cs_get_user_money(id) - price)         set_user_health(id, health+1)                   new slHealth = get_user_health( id )         new fHealth = 50 - health - 1                   set_hudmessage(40,100,50, 0.03, 0.76, 2, 0.02, 1.0, 0.01, 0.1, 4)         show_hudmessage(id,"Current health: %i^nHealth needed before 50: %i",slHealth,fHealth)                             set_task(1.0,"autoHeal",id)     }           return PLUGIN_HANDLED       } public annouce() {           set_hudmessage(40,100,50, 0.20, 0.30, 2, 0.05, 5.0, 0.01, 0.1, 5)     show_hudmessage(0,"Use /heal to get auto healed until you have 50 hp^nIt will cost you 3000$")       }


All times are GMT -4. The time now is 09:50.

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