AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=43)
-   -   BAH! :( Help please (https://forums.alliedmods.net/showthread.php?t=32140)

imported_BRUm 12-31-2004 16:09

BAH! :( Help please
 
:shock: Here we go...

Just discovered how to script and stuff for the superheroes in the .sma files. I can compile and do little stuff no probs..

After looking at the Zeus superhero, I was inspired to make a Jesus one :P lol, I wanted to make him 1000hp, health gen 5 hp /sec, and zeus revive team mate power. At first it seemed fine, It shows up on the superhero menu, and i can select it, BUT! when i do, health doesnt change and Zeus power and health regen don't work, Can you guys please take a look at my code?
Greatly appreciated, cheers.
:wink:

-------------Code-------------

Code:
// Jesus! // Created 5/18/2003 /* CVARS - copy and paste to shconfig.cfg //Jesus Jesus_level 9 Jesus_cooldown 3                // # of seconds for Jesus cooldown Jesus_health 500 Jesus_healpoints 5 */ #include <amxmod> #include <superheromod> // GLOBAL VARIABLES new gHeroName[]="Jesus" new bool:gHasJesusPowers[SH_MAXSLOTS+1] //---------------------------------------------------------------------------------------------- public plugin_init() {     // Plugin Info     register_plugin("SUPERHERO Jesus","1.17.5","{HOJ} Batman/JTP10181")     // DO NOT EDIT THIS FILE TO CHANGE CVARS, USE THE SHCONFIG.CFG     register_cvar("Jesus_level", "9" )     register_cvar("Jesus_cooldown", "3" ) // Just once!         register_cvar("wolv_healpoints", "5" )         shSetMaxHealth(gHeroName, "Jesus_health" )     // FIRE THE EVENT TO CREATE THIS SUPERHERO!     shCreateHero(gHeroName, "Raise Dead", "The powers of Son of God...", false, "Jesus_level" )     // REGISTER EVENTS THIS HERO WILL RESPOND TO! (AND SERVER COMMANDS)     register_event("ResetHUD","Jesus_newround","b")     register_srvcmd("Jesus_init", "Jesus_init")     shRegHeroInit(gHeroName, "Jesus_init")     // DEATH     register_event("DeathMsg", "jesus_death", "a") } //---------------------------------------------------------------------------------------------- public plugin_precache() {     precache_sound("ambience/port_suckin1.wav") } //---------------------------------------------------------------------------------------------- public Jesus_newround(id) {     if ( !hasRoundStarted() ) {         gPlayerUltimateUsed[id] = false     }     else {         gPlayerUltimateUsed[id] = true //dead Jesus's loose their Jesus...     } } //---------------------------------------------------------------------------------------------- public Jesus_init() {     // First Argument is an id     new temp[6]     read_argv(1,temp,5)     new id = str_to_num(temp)     // 2nd Argument is 0 or 1 depending on whether the id has wolverine skills     read_argv(2,temp,5)     new hasPowers = str_to_num(temp)     gHasJesusPowers[id] = (hasPowers != 0) } //---------------------------------------------------------------------------------------------- public Jesus_death() {     new id = read_data(2)     if ( !is_user_connected(id) || is_user_alive(id) ) return     // Look for alive players with unused Jesus Powers on the same team     for ( new player = 1; player <= SH_MAXSLOTS; player++ ) {         if ( player != id && is_user_alive(player) && gHasJesusPowers[player] && !gPlayerUltimateUsed[player] && get_user_team(id) == get_user_team(player) ) {             // We got a Jesus character willing to raise the dead!             new parm[2]             parm[0] = id             parm[1] = player             set_task(1.0,"Jesus_respawn", 0, parm, 2)             break         }     } } //---------------------------------------------------------------------------------------------- public Jesus_respawn(parm[]) {     new dead = parm[0]     new Jesus = parm[1]     if (gPlayerUltimateUsed[Jesus]) return     if ( !is_user_connected(dead) || !is_user_connected(Jesus)) return     if ( !is_user_alive(Jesus) || is_user_alive(dead) ) return     if ( get_user_team(dead) != get_user_team(Jesus) ) return     ultimateTimer(Jesus, get_cvar_float("Jesus_cooldown"))     emit_sound(Jesus, CHAN_STATIC, "ambience/port_suckin1.wav", 1.0, ATTN_NORM, 0, PITCH_NORM)     new JesusName[32],deadName[32]     get_user_name(Jesus,JesusName,31)     get_user_name(dead,deadName,31)     client_print(0,print_chat,"%s used Jesus Powers to Raise Dead Team Member %s!", JesusName, deadName )         //Double spawn prevents the no HUD glitch (hopefully)     user_spawn(dead)     user_spawn(dead)     emit_sound(dead, CHAN_STATIC, "ambience/port_suckin1.wav", 1.0, ATTN_NORM, 0, PITCH_NORM)     shGlow(dead,255,255,0)     set_task(2.0, "Jesus_unglow", dead+58753)     set_task(1.0, "Jesus_teamcheck", 0, parm, 2) } //---------------------------------------------------------------------------------------------- public Jesus_unglow(id) {     id -= 58753     shUnglow(id) } //---------------------------------------------------------------------------------------------- public Jesus_teamcheck(parm[]) {     new dead = parm[0]     new Jesus = parm[1]     if ( get_user_team(dead) != get_user_team(Jesus) ) {         client_print(dead,print_chat,"You changed teams and got Jesus respawned, now you shall die")         user_kill(dead,1)         gPlayerUltimateUsed[Jesus] = false     } } //----------------------------------------------------------------------------------------------

jtp10181 12-31-2004 16:19

1) use small code blocks for code (I fixed it for you)
2) attach the sma so anyone trying to compile it will have the exact same code

imported_BRUm 12-31-2004 16:31

k
 
1 Attachment(s)
Ah, ok thanx mate, I'm new to all this

Heres the .sma

Good you possibly say what's wrong :(

jtp10181 12-31-2004 16:42

Code:
        register_cvar("wolv_healpoints", "5" )         shSetMaxHealth(gHeroName, "Jesus_health" )

wolv? you forgot to change it..


"Jesus_health" - you mention this cvar up top, but you never register it anywhere.

oh, and the regen wont work because you dont have any tasks doing it.... how is it gonna magically regen health?

imported_BRUm 12-31-2004 16:45

oh
 
Ah lol! sorry, But where would i register the health? Ive looked at the tuts but im confused :?
Also, what tasks? and what would it be like? could u give me example of how the task would be?
thanx

ps: I declared it at the top?
Quote:

jesus_health 500

jtp10181 12-31-2004 17:05

this stuff all works in the heroes you ripped it from.... so obviously you're missing parts.

imported_BRUm 12-31-2004 17:08

?
 
But i need to know how i would mention the health where ever it goes, cos it doesnt work, Jesus doesnt get 500 or 1000 hp or what ever i set it too! So where would i need to address the cvars which are at the top? Also, i went into the sh_config and addapted:

//Jesus
jesus_health 500
etc..

But still don't work :x

Can you give any possible examples or could you help with the .sma file plz?

thanx

PS: How come u take so long to reply mate?? I like need this done tonight please :D

imported_BRUm 12-31-2004 18:01

y0
 
Hello? :cry: plz dude need this quick :?

jtp10181 12-31-2004 18:44

you have no idea how to program.... you wont get this done tonight. Learn how to do some basic programming.

imported_BRUm 12-31-2004 18:46

...
 
Thanks for nothing.. FFS ill never learn unless u fucking tell me! jesus christ... You have no idea how to be helpful...


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

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