Raised This Month: $51 Target: $400
 12% 

I tried one more time but still fail


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
martop5hng
Junior Member
Join Date: Mar 2014
Old 03-29-2014 , 10:23   I tried one more time but still fail
Reply With Quote #1

Hi guys i was so down when i try my first hero and it didn't work. Now i try again because i gain more skills and it still fail im dead :X
This is the stupid error i got in the compiling : http://prikachi.com/images/96/7206096a.png
If anyone can tell me where i do wrong it will be awsome
and this is my code
Code:
 
#include <superheromod>

new gHeroID
new gHeroName[] = "martop5hng" 
new bool:gHasSuperPower[SH_MAXSLOTS+1] 
new const gMartop5hngWeapon[] = "models/shmod/martop5hng_awp_v.mdl"
new const gMartop5hngWeapon2[] = "models/shmod/martop5hng_awp_p.mdl"
public plugin_init()
{
    register_plugin("SUPERHERO martop5hng", "1.0", "martop5hng")
    register_event("CurWeapon", "weapon_change", "be", "1=1")
    
    new pcvarLevel = register_cvar("martop5hng_level", "0") 
    new pcvarHealth = register_cvar("martop5hng_health", "150")
    new pcvarSpeed = register_cvar("martop5hng_speed", "400")
    new pcvarMult = register_cvar("martop5hng_mult", "5")

    
    gHeroID = sh_create_hero(gHeroName, pcvarLevel)
    
    sh_set_hero_info(gHeroID, "martop5hng", "First Hero NGA ")
    sh_set_hero_hpap(gheroID, pcvarHealth, 0)
    sh_set_hero_speed(gHeroID, pcvarSpeed)
    sh_set_hero_dmgmult(gHeroID, pcvarMult, CSW_AWP)
}

public sh_hero_init(id, heroID, mode)
{
    if (gHeroID != heroID) return
    
    switch(mode)
    {
        case SH_HERO_ADD:
        {
            gHasMartop5hngPower[id] = true
	   martop5hng_weapon(id)
	   switch_model(id)
        }
        case SH_HERO_DROP:
	gHasMartop5hngPower[id] = false
	if (is_user_alive(id))
        {
	   sh_drop_weapon(id, CSW_AWP, true)
            gHasMartop5hngPower[id] = false
        }
    }
}  
public sh_client_spawn(id)
{
    if (gHasMartop5hngPower[id])
    {
        martop5hng_weapon(id)
    }
}

martop5hng_weapon(id)
{
    if (sh_is_active() && is_user_alive(id) && gHasMartop5hngPower[id] )
    {
        sh_give_weapon(id, CSW_AWP)
    }
}

public weapon_change(id)
{
    if ( !sh_is_active() || !gHasMartop5hngPower[id] ) return
    
    new weaponID = read_data(2)
    if (weaponID !=CSW_AWP) return
    
    switch_model(id)

    if (read_data(3) == 0)
    {
        sh_reload_ammo(id, 1)
        /*after the id I made a 1 number
        look at the superheromod.inc and you will see this
        0 - follow server sh_reloadmode CVAR
        1 - continuous shooting, no reload
        2 - fill the backpack (must reload)
        3 - drop the gun and get a new one with full clip
        That should explain it*/
    }
}

switch_model(id)
{
    if (!sh_is_active() || !is_user_alive(id) || !gHasMartop5hngPower[id] ) return
    
    if (get_user_weapon(id) == CSW_AWP)
    {
        set_pev(id, pev_viewmodel2, gMartop5hngWeapon)
    }
}

Last edited by martop5hng; 03-29-2014 at 10:28.
martop5hng is offline
Jelle
[b]MOAR CANDY[/b]
Join Date: Aug 2009
Location: Denmark
Old 03-29-2014 , 20:55   Re: I tried one more time but still fail
Reply With Quote #2

First we look at the error:

Code:
Welcome to the AMX Mod X 1.8.1-300 Compiler.
Copyright (c) 1997-2006 ITB CompuPhase, AMX Mod X Team

Error: Undefined symbol "gheroID" on line 22
Warning: Expression has no effect on line 22
Warning: Expression has no effect on line 22
Error: Expected token: ";", but found ")" on line 22
Error: Invalid expression, assumed zero on line 22
Error: Too many error messages on one line on line 22

Compilation aborted.
4 Errors.
Could not locate output file C:\Program Files (x86)\AMX Mod X\amxxstudio\Untitled.amx (compile failed).
The very first error is:

Code:
Error: Undefined symbol "gheroID" on line 22
At a glance it is very easy to determine what the error is, but let's go to line 22:

Code:
sh_set_hero_hpap(gheroID, pcvarHealth, 0)
It says that gheroID is undefined, which it is. Look at the very first variable you make:

Code:
new gHeroID
Notice the uppercase H you used lowercase h in line 22. Lower and upper cases is two different things when coding. I think you know what to change by now.
__________________
No idea what to write here...

Last edited by Jelle; 03-29-2014 at 20:55.
Jelle is offline
Send a message via MSN to Jelle
martop5hng
Junior Member
Join Date: Mar 2014
Old 03-30-2014 , 05:52   Re: I tried one more time but still fail
Reply With Quote #3

Quote:
Originally Posted by Jelle View Post
First we look at the error:

Code:
Welcome to the AMX Mod X 1.8.1-300 Compiler.
Copyright (c) 1997-2006 ITB CompuPhase, AMX Mod X Team

Error: Undefined symbol "gheroID" on line 22
Warning: Expression has no effect on line 22
Warning: Expression has no effect on line 22
Error: Expected token: ";", but found ")" on line 22
Error: Invalid expression, assumed zero on line 22
Error: Too many error messages on one line on line 22

Compilation aborted.
4 Errors.
Could not locate output file C:\Program Files (x86)\AMX Mod X\amxxstudio\Untitled.amx (compile failed).
The very first error is:

Code:
Error: Undefined symbol "gheroID" on line 22
At a glance it is very easy to determine what the error is, but let's go to line 22:

Code:
sh_set_hero_hpap(gheroID, pcvarHealth, 0)
It says that gheroID is undefined, which it is. Look at the very first variable you make:

Code:
new gHeroID
Notice the uppercase H you used lowercase h in line 22. Lower and upper cases is two different things when coding. I think you know what to change by now.
Ok so i fix that then this pop up: http://prikachi.com/images/491/7208491u.png

then i change
Code:
new const gMartop5hngWeapon2[] = "models/shmod/martop5hng_awp_p.mdl"
to
Code:
new const gMartop5hngWeaponP[] = "models/shmod/martop5hng_awp_p.mdl"
Then i went to the bottom and i did that :
Code:
        set_pev(id, pev_viewmodel2, gMartop5hngWeapon, gMartop5hngWeaponP)
And that was the next error: http://prikachi.com/images/508/7208508S.png
i have no idea why there are so much errors
martop5hng is offline
Jelle
[b]MOAR CANDY[/b]
Join Date: Aug 2009
Location: Denmark
Old 03-30-2014 , 15:23   Re: I tried one more time but still fail
Reply With Quote #4

Whenever you change something please provide the complete new code, else I have to make the changes too and chances are it won't be the exact same.

You can use the compiler in AMXX Studio:
Press tools -> settings -> compiler settings -> the first (pawn compiler) locate amxxpc.exe by clicking on "..." to the right -> double click/mark it and press open -> click OK
Now you can press the green arrow just beside the zoom button to compile. When you have errors right click on them and press "copy all" then paste it here. Now you don't have to make a picture each time to much annoyance to me, I'd rather have the text.

Now for your errors...
Looking at the picture you posted I noticed this:



I can tell you that SH_HERO_ADD: is correct, but SH_HERO_DROP is not, and they definitely do not look alike. You will also notice this if you look at the error:

Code:
<41> : error 002: only a single statement <or expression> can follow each "case"
It clearly states that at least something is wrong with your cases, and looking at line 41 it is pretty clear what the error is.

Have fun.
__________________
No idea what to write here...
Jelle is offline
Send a message via MSN to Jelle
martop5hng
Junior Member
Join Date: Mar 2014
Old 03-30-2014 , 17:28   Re: I tried one more time but still fail
Reply With Quote #5

Quote:
Originally Posted by Jelle View Post
Whenever you change something please provide the complete new code, else I have to make the changes too and chances are it won't be the exact same.

You can use the compiler in AMXX Studio:
Press tools -> settings -> compiler settings -> the first (pawn compiler) locate amxxpc.exe by clicking on "..." to the right -> double click/mark it and press open -> click OK
Now you can press the green arrow just beside the zoom button to compile. When you have errors right click on them and press "copy all" then paste it here. Now you don't have to make a picture each time to much annoyance to me, I'd rather have the text.

Now for your errors...
Looking at the picture you posted I noticed this:



I can tell you that SH_HERO_ADD: is correct, but SH_HERO_DROP is not, and they definitely do not look alike. You will also notice this if you look at the error:

Code:
<41> : error 002: only a single statement <or expression> can follow each "case"
It clearly states that at least something is wrong with your cases, and looking at line 41 it is pretty clear what the error is.

Have fun.
Tnx the hero is done there was this error : http://prikachi.com/images/341/7211341g.png
Because you forget to add this in the tutorial:
public plugin_precache()
{
precache_model(gMartop5hngWeapon);
precache_model(gMartop5hngWeaponP);
}

Last edited by martop5hng; 03-30-2014 at 17:40.
martop5hng is offline
Reply



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 18:37.


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