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

Solved Help Tag mismatch, on fm_set_user_health


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
ghost95v
Senior Member
Join Date: Apr 2014
Location: somewhere in universe
Old 09-03-2017 , 07:48   Help Tag mismatch, on fm_set_user_health
Reply With Quote #1

Hello, i got these


PHP Code:

new g_PlayerType[33]

new 
PlayerHealths[7] =
{
    
100150200250300350400
}



public 
plugin_init()
{

    
cvar_firsthp register_cvar("first_player_hp""3.5")
    
register_clcmd("menu""Menu")
    
}
public 
plugin_natives()
{
    
register_native("type""native_get_player_type_id"1)
    
    
}

public 
Menu(id)
{

    new 
menuid menu_create("\rChoose Player Type!:""menu_handler" );
    
/*
    Here is the menu which choose they the g_PlayerType[33] for each player
    */
}

public 
menu_handler(iditemmenuid)
{
    
    switch(
item)
    {
        case 
0:
        {
            Function(
id000)
        }
        
/*
        Etc...
        */
    
}
    
menu_destroymenu );
    return 
PLUGIN_HANDLED;
}
Function(
idblablablablablablablablabla)
{
    
g_PlayerType[id] = 0
    fm_set_user_health
(idfloatround(float(PlayerHealths[id]))  *  get_pcvar_float(cvar_firsthp)) // here i got tag mismatch on compiling
    
}

// Native: Player Type
public native_get_player_type_id(id)
{
    return 
g_PlayerType[id];
}


// Set player's health (from fakemeta_util)
stock fm_set_user_health(idhealth)
{
    (
health 0) ? set_pev(idpev_healthfloat(health)) : dllfunc(DLLFunc_ClientKillid);


i got tag mismatch here,
i want to send exact Healths for exact Playertype for each player

PHP Code:
fm_set_user_health(idfloatround(float(PlayerHealths[id]))  *  get_pcvar_float(cvar_firsthp)) 
__________________

Last edited by ghost95v; 09-03-2017 at 13:01.
ghost95v is offline
Send a message via Skype™ to ghost95v
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 09-03-2017 , 07:51   Re: Help Tag mismatch, on fm_set_user_health
Reply With Quote #2

new PlayerHealths[7]
PlayerHealths[id]

That's not going to work. For id > 6 you will get array index out of bounds error.
__________________

Last edited by HamletEagle; 09-03-2017 at 07:51.
HamletEagle is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 09-03-2017 , 08:59   Re: Help Tag mismatch, on fm_set_user_health
Reply With Quote #3

It's not clear exactly what you're trying to do. Are you trying to set the health value based on what a player selects in the menu?

I'm thinking maybe your intention is to set the g_PlayerType[] in the menu, which is a value from 0 to 6. You would then pass this value into the health values: PlayerHealths[ g_PlayerType[ id ] ]

For your tag mismatch (which is will result in index out of bounds error)

PHP Code:
fm_set_user_health(idfloatroundfloat(PlayerHealths[id])  *  get_pcvar_float(cvar_firsthp) ) ) 
__________________
Bugsy is offline
ghost95v
Senior Member
Join Date: Apr 2014
Location: somewhere in universe
Old 09-03-2017 , 12:07   Re: Help Tag mismatch, on fm_set_user_health
Reply With Quote #4

Yes!

A specific Player Type Should Get his Specific Health From PlayerHealths[7].

Which they are 7 ammounts ( 100, 150, 200, 250, 300, 350, 400 )

So an example...

A player has been choosed PlayerType[id] = 2 ?

So he should get set the health nr 2 of PlayerHealths[7] , in the fm_set_user_health


But is still get Tag mismatch. Also if i do PlayerHealths[ g_PlayerType[ id ] ]
__________________

Last edited by ghost95v; 09-03-2017 at 12:12.
ghost95v is offline
Send a message via Skype™ to ghost95v
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 09-03-2017 , 12:27   Re: Help Tag mismatch, on fm_set_user_health
Reply With Quote #5

Show me the line of code where you use PlayerHealths[ g_PlayerType[ id ] ]
__________________

Last edited by Bugsy; 09-03-2017 at 12:27.
Bugsy is offline
ghost95v
Senior Member
Join Date: Apr 2014
Location: somewhere in universe
Old 09-03-2017 , 12:37   Re: Help Tag mismatch, on fm_set_user_health
Reply With Quote #6

This is the line

PHP Code:
fm_set_user_health(idfloatround(float(PlayerHealths[g_PlayerType[id]]))  *  get_pcvar_float(cvar_firsthp)) 
Or when i do

PHP Code:
fm_set_user_health(idfloatround(float(PlayerHealths[g_PlayerType[id]]))) 
(without * get_pcvar_float(cvar_firsthp))

or Just

PHP Code:
fm_set_user_health(idfloatround(float(PlayerHealths[id]))) 
It compiles fine
__________________

Last edited by ghost95v; 09-03-2017 at 12:41.
ghost95v is offline
Send a message via Skype™ to ghost95v
ghost95v
Senior Member
Join Date: Apr 2014
Location: somewhere in universe
Old 09-03-2017 , 13:01   Re: Help Tag mismatch, on fm_set_user_health
Reply With Quote #7

Solved Thank you! Anyway

It was about tokens

PHP Code:
fm_set_user_health(idfloatround(float(PlayerHealths[g_PlayerType[id]]) *  get_pcvar_float(cvar_firsthp))) 
__________________
ghost95v is offline
Send a message via Skype™ to ghost95v
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 08:40.


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