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

Solved tag mismatch


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
DjSoftero
Veteran Member
Join Date: Nov 2014
Location: Lithuania
Old 09-18-2017 , 09:30   tag mismatch
Reply With Quote #1

so i have this function:
PHP Code:
public bomb_defused(id) {
    switch(
get_user_flags(id)) {
        case 
ADMIN: {
            
points[id]+=get_pcvar_float(cvar_admin_multiplier)*get_pcvar_num(cvar_defuse)
        }
        case 
VIP: {
            
points[id]+=get_pcvar_float(cvar_vip_multiplier)*get_pcvar_num(cvar_defuse)
        }
        case 
PLAYER: {
            
points[id]+=get_pcvar_float(cvar_normal_multiplier)*get_pcvar_num(cvar_defuse)
        }
    }
    
floatround(points[id], floatround_round)

and the problem is that i get tag mismatch warning, cuz points[] isnt a float and i`m rounding it to keep it as an integer. how should i do this to have no warnings?
__________________
retired chump

Last edited by DjSoftero; 09-18-2017 at 11:08.
DjSoftero is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 09-18-2017 , 09:44   Re: tag mismatch
Reply With Quote #2

if it isn't a float why rounding in the first place? I don't get it.
__________________
HamletEagle is online now
DjSoftero
Veteran Member
Join Date: Nov 2014
Location: Lithuania
Old 09-18-2017 , 10:20   Re: tag mismatch
Reply With Quote #3

because when i multiply 6 by 1.2 i get 7.2 not 7. I just want the data in points[] to stay as integers. and when i print the points as an integer with %i i get funky numbers

here is another function I was working on. perhaps it will help making things more clear.
Spoiler

this is the output:
1086324736 6.000000
6 1.200000 1088841319 7.2000
__________________
retired chump

Last edited by DjSoftero; 09-18-2017 at 10:29.
DjSoftero is offline
Natsheh
Veteran Member
Join Date: Sep 2012
Old 09-18-2017 , 10:42   Re: tag mismatch
Reply With Quote #4

So what are the values you expecting?
__________________
@Jailbreak Main Mod v2.7.0 100%
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !

Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
DjSoftero
Veteran Member
Join Date: Nov 2014
Location: Lithuania
Old 09-18-2017 , 10:48   Re: tag mismatch
Reply With Quote #5

... i`m trying to keep points[] with integer values only. No floating nonsence. If i get 7.2 value by multiplying the cvar values, then add 7 to points[], which I fail at doing so
__________________
retired chump

Last edited by DjSoftero; 09-18-2017 at 10:48.
DjSoftero is offline
Natsheh
Veteran Member
Join Date: Sep 2012
Old 09-18-2017 , 10:52   Re: tag mismatch
Reply With Quote #6

iPoints = floatround(1.2 * 6.0) this should give you 7.0
__________________
@Jailbreak Main Mod v2.7.0 100%
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !

Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
DjSoftero
Veteran Member
Join Date: Nov 2014
Location: Lithuania
Old 09-18-2017 , 11:06   Re: tag mismatch
Reply With Quote #7

tyvm. worked
__________________
retired chump
DjSoftero is offline
PartialCloning
Senior Member
Join Date: Dec 2015
Old 09-18-2017 , 11:11   Re: tag mismatch
Reply With Quote #8

PHP Code:
public bomb_defused(id)

    switch(
get_user_flags(id))
    { 
        case 
ADMIN:  points[id] += floatround(get_pcvar_float(cvar_admin_multiplier)  * get_pcvar_float(cvar_defuse), floatround_round);
        case 
VIP:    points[id] += floatround(get_pcvar_float(cvar_vip_multiplier)    * get_pcvar_float(cvar_defuse), floatround_round);  
        case 
PLAYERpoints[id] += floatround(get_pcvar_float(cvar_normal_multiplier) * get_pcvar_float(cvar_defuse), floatround_round);
    }

PartialCloning 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 12:04.


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