AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Just a small issue... (https://forums.alliedmods.net/showthread.php?t=53839)

Theshooter7 04-11-2007 20:00

Just a small issue...
 
I can't understand why I receive the warning "Tag Mismatch on line 335".

PHP Code:

new XP[33],XP2LVL[33],LVL[33],KStreak[33];

new 
Float:XPMultiply[33];

new 
XPGain 2;

public 
client_death(kid,vid) {
    
XP[kid] = XPMultiply[kid] * XPGain//<- this would be line 335. :/
    
KStreak[kid]++;
    if(
KStreak[kid] >= 3)
    {
        
KStreak[kid] = 0;
        
XPMultiply[kid] += 0.1;
    }
    
XPMultiply[vid] = 1.0
    
if(KStreak[vid] == 0) { XPMultiply[vid] = -0.1; }
    
KStreak[vid] = 0;


Thanks for your help.

alien 04-11-2007 20:21

Re: Just a small issue...
 
Hi, try to use:

Code:

XP[kid] = XPMultiply[kid] * float(XPGain)
GL

Theshooter7 04-11-2007 20:26

Re: Just a small issue...
 
No effect. I appreciate the attempt. I really don't know why this is occurring. It's perfectly fine with all the other lines that have similar formulas...

[EDIT] By the way, this is for The Specialists, if it has any meaning.

Theshooter7 04-11-2007 21:01

Re: Just a small issue...
 
I apologize for double posting, but another slight issue has crept up. The following code doesn't seem to display the proper numbers, either because of an issue with how the array indexes are being read, or because the hudmessage is not set up properly.

PHP Code:

public playerhud(id) {
    
set_hudmessage(255001.00.406.012.0)
    
show_hudmessage(id"Level: %d ^nXP: %d / %d",LVL[id],XP[id],XP2LVL[id])
}

public 
client_connect(id) {
    
read_playerdata(id);
    
XPMultiply[id] = 1.0;
    
KStreak[id] = 0
    
if(LVL[id] < 2)
    {
    
LVL[id] = 1
    XP2LVL
[id] = 50
    
}
}

public 
client_disconnect(id) {
    
write_playerdata(id);
    
XP[id] = 0;
    
XP2LVL[id] = 0;
    
LVL[id] = 0;
    
XPMultiply[id] = 1.0;
    
KStreak[id] = 0;


Another thing I'd like to know; is it possible to determine either a player's team or their player model? I intend to have one team of players have double health, while the other have no footstep noises.

wonsae 04-11-2007 21:22

Re: Just a small issue...
 
PHP Code:

new g_model[33][33]
 
get_user_info(id,"model",g_model[id],32


alien 04-11-2007 21:45

Re: Just a small issue...
 
Ah sorry, I must be blind ...

You're assigning a float value to an integer variable. Just round the value first using floatround().

PHP Code:

XP[kid] = floatround(XPMultiply[kid] * XPGain

:-)

Theshooter7 04-11-2007 21:53

Re: Just a small issue...
 
Thanks alien, that works well enough. :)

@wonsae: With what I tried to use, I got this:

PHP Code:

ErrorInvalid expressionassumed zero on line 351 

PHP Code:

public clrespawn(id) {
    new 
g_model[33][33];
    
get_user_info(id,"model",g_model[id][32],32)
    if(
strlen(g_model[id][]) == 5)
    {
        
set_user_footsteps(id,1);
        
set_user_health(id,150);
        
set_user_maxspeed(id,get_user_maxspeed(id) * 0.75);
    }
    else
    {
        
set_user_armor(id,100);
    }



alien 04-11-2007 22:07

Re: Just a small issue...
 
Not sure whether this is the line but

PHP Code:

if(strlen(g_model[id][]) == 5

should be

PHP Code:

if(strlen(g_model[id]) == 5

Hope it'll help.

Deviance 04-11-2007 22:11

Re: Just a small issue...
 
Code:
public clrespawn(id) {     new g_model[33];     get_user_info(id,"model",g_model,32)     if(strlen(g_model) == 5)     {         set_user_footsteps(id,1);         set_user_health(id,150);         set_user_maxspeed(id,get_user_maxspeed(id) * 0.75);     }     else     {         set_user_armor(id,100);     } }

Theshooter7 04-11-2007 22:32

Re: Just a small issue...
 
That worked perfectly Deviance! Thanks a ton!

Final issue still remains: I can't get the XP numbers to show properly, they just show up as 0's. Should I post the .sma file for this one?


All times are GMT -4. The time now is 06:44.

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