Raised This Month: $28 Target: $400
 7% 

(Also urgent) "error 029: invalid expression, assumed zero"


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
thatdarnkid
BANNED
Join Date: Nov 2010
Old 12-16-2010 , 21:12   (Also urgent) "error 029: invalid expression, assumed zero"
Reply With Quote #1

So I've just compiled my personal revision of the Premium Mod v1.14, and after starting out with 26 errors, I've managed to get my version down to 4 errors, all of which are error 029's:

Code:
premium.sp<305> : error 029: invalid expression, assumed zero
premium.sp<328> : error 029: invalid expression, assumed zero
premium.sp<349> : error 029: invalid expression, assumed zero
premium.sp<356> : error 029: invalid expression, assumed zero
So I opened the sp file up in PawnStudio and navigated to lines 305, 328, 349 and 356, and noticed that all 4 lines were just "{".

Pictures of the code in PawnEditor are below. Does anyone know how to fix this? I've tried everything under the sun to get of these 4 errors, but most of my "fixes" (such as removing the offending brackets) just led to "fatal error", something about too many errors on one line.

I want to fix these 4 errors and get this plugin uploaded to my server ASAP because due to a change of plans, I'll be leaving for my vacation tomorrow afternoon and I won't be back until Dec. 29th or 30th.

[IMG]http://img822.**************/img822/7772/codingproblem2.png[/IMG]
[IMG]http://img135.**************/img135/813/codingproblem1.png[/IMG]
thatdarnkid is offline
psychonic

BAFFLED
Join Date: May 2008
Old 12-16-2010 , 21:30   Re: (Also urgent) "error 029: invalid expression, assumed zero"
Reply With Quote #2

You're missing many closing parenthesis on the lines immediately before the errors.
psychonic is offline
thatdarnkid
BANNED
Join Date: Nov 2010
Old 12-16-2010 , 21:33   Re: (Also urgent) "error 029: invalid expression, assumed zero"
Reply With Quote #3

Quote:
Originally Posted by psychonic View Post
You're missing many closing parenthesis on the lines immediately before the errors.
Thank you for the quick response.

Would you do me a big favour, and edit those 2 pictures and maybe draw little arrows to where I need to place closing parenthesis? I gotta run a quick errand. I'm abit of a noob at this and upon looking, honestly, I can't figure out where I'm missing parenthesis.

Last edited by thatdarnkid; 12-16-2010 at 21:35.
thatdarnkid is offline
Azelphur
SourceMod Donor
Join Date: Jun 2010
Old 12-16-2010 , 21:45   Re: (Also urgent) "error 029: invalid expression, assumed zero"
Reply With Quote #4

Quote:
Originally Posted by thatdarnkid View Post
Thank you for the quick response.

Would you do me a big favour, and edit those 2 pictures and maybe draw little arrows to where I need to place closing parenthesis? I gotta run a quick errand. I'm abit of a noob at this and upon looking, honestly, I can't figure out where I'm missing parenthesis.
Here you go
__________________
Azelphur is offline
thatdarnkid
BANNED
Join Date: Nov 2010
Old 12-16-2010 , 22:11   Re: (Also urgent) "error 029: invalid expression, assumed zero"
Reply With Quote #5

Quote:
Originally Posted by Azelphur View Post
Here you go
<image>
Wow. That's confusing. Wait, you're not Psychonic. Are you messing with me? I probably should've done this in the first place:

Help a brother out, add in the parenthesis. I swear to god, when I look at the parenthesis, I don't see anything wrong. I see like, let's say 3 {'s, and 3 }'s and I think "Alright, that looks good.

Code:
//////////////////////////
//P L A Y E R  S P A W N//
//////////////////////////
public Player_Spawn(Handle:event, const String:name[], bool:dontBroadcast)
{
    new client = GetClientOfUserId(GetEventInt(event, "userid"));
    
    if(cEnable && (GetUserFlagBits(client) && PREMIUMFLAG && IsValidEntity(client))
    {
        if(pFirstSpawn[client])
        {
            pWelcomeTimer[client] = CreateTimer(5.0, Timer_Spawntimer, client);
        }
        Premium(client);
    }
}

public Action:Timer_Spawntimer(Handle:hTimer, any:client)
{
    if(cWelcomeMessage)
        CPrintToChatEx(client, client, "%t", "WelcomeMessage");
    pFirstSpawn[client] = false;
}

//////////////////////////
//C H A N G E  C L A S S//
//////////////////////////
public Player_Change(Handle:event, const String:name[], bool:dontBroadcast)
{
    new client = GetClientOfUserId(GetEventInt(event, "userid"));
    if(cEnable && (GetUserFlagBits(client) & PREMIUMFLAG || IsValidEntity(client))
    {
        CloseAllHandles(client);
    }
}
    
////////////////////////////
//P L A Y E R  K I L L E D//
////////////////////////////
public Player_Death(Handle:event, const String:name[], bool:dontBroadcast)
{
    new attacker = GetClientOfUserId(GetEventInt(event, "attacker"));
    new victim = GetClientOfUserId(GetEventInt(event, "userid"));
    new assister = GetClientOfUserId(GetEventInt(event, "assister"));
    new flags = GetEventInt(event, "death_flags");
    
    if(cEnable && IsValidEntity(victim) && IsValidEntity(attacker) && attacker != victim)
    {
        if(flags & 32 && GetUserFlagBits(attacker) & PREMIUMFLAG || cFakeKill)
            CPrintToChat(attacker, "%s %t", TAG, "FakeKill");

        if(attacker != 0 && (GetUserFlagBits(attacker) & PREMIUMFLAG || cKillBoost > 0)
        {
            new hp_attacker = GetClientHealth(attacker);
            SetEntityHealth(attacker, hp_attacker + cKillBoost);
            CPrintToChat(attacker, "%s %t", TAG, "KillBoost", cKillBoost);
        }
        
        if(assister != 0 && (GetUserFlagBits(assister) & PREMIUMFLAG || cKillAssist > 0)
        {
            new hp_assister = GetClientHealth(assister);
            SetEntityHealth(assister, hp_assister + cKillAssist);
            CPrintToChat(attacker, "%s %t", TAG, "KillBoost_Assist", cKillAssist);
        }
        
        if(!(flags & 32) && GetUserFlagBits(victim) & PREMIUMFLAG)
        {
            if(cRespawn)
            CreateTimer(0.1, Timer_Respawn, victim);
            CloseAllHandles(victim);
        }
    }
}

public Action:Timer_Respawn(Handle:hTimer, any:client)
{
    TF2_RespawnPlayer(client);
}
thatdarnkid is offline
psychonic

BAFFLED
Join Date: May 2008
Old 12-16-2010 , 22:18   Re: (Also urgent) "error 029: invalid expression, assumed zero"
Reply With Quote #6

Quote:
Originally Posted by thatdarnkid View Post
Wow. That's confusing. Wait, you're not Psychonic. Are you messing with me? I probably should've done this in the first place:

Help a brother out, add in the parenthesis. I swear to god, when I look at the parenthesis, I don't see anything wrong. I see like, let's say 3 {'s, and 3 }'s and I think "Alright, that looks good.

Code:
//////////////////////////
//P L A Y E R  S P A W N//
//////////////////////////
public Player_Spawn(Handle:event, const String:name[], bool:dontBroadcast)
{
    new client = GetClientOfUserId(GetEventInt(event, "userid"));
    
    if(cEnable && (GetUserFlagBits(client) && PREMIUMFLAG && IsValidEntity(client))
    {
        if(pFirstSpawn[client])
        {
            pWelcomeTimer[client] = CreateTimer(5.0, Timer_Spawntimer, client);
        }
        Premium(client);
    }
}

public Action:Timer_Spawntimer(Handle:hTimer, any:client)
{
    if(cWelcomeMessage)
        CPrintToChatEx(client, client, "%t", "WelcomeMessage");
    pFirstSpawn[client] = false;
}

//////////////////////////
//C H A N G E  C L A S S//
//////////////////////////
public Player_Change(Handle:event, const String:name[], bool:dontBroadcast)
{
    new client = GetClientOfUserId(GetEventInt(event, "userid"));
    if(cEnable && (GetUserFlagBits(client) & PREMIUMFLAG || IsValidEntity(client))
    {
        CloseAllHandles(client);
    }
}
    
////////////////////////////
//P L A Y E R  K I L L E D//
////////////////////////////
public Player_Death(Handle:event, const String:name[], bool:dontBroadcast)
{
    new attacker = GetClientOfUserId(GetEventInt(event, "attacker"));
    new victim = GetClientOfUserId(GetEventInt(event, "userid"));
    new assister = GetClientOfUserId(GetEventInt(event, "assister"));
    new flags = GetEventInt(event, "death_flags");
    
    if(cEnable && IsValidEntity(victim) && IsValidEntity(attacker) && attacker != victim)
    {
        if(flags & 32 && GetUserFlagBits(attacker) & PREMIUMFLAG || cFakeKill)
            CPrintToChat(attacker, "%s %t", TAG, "FakeKill");

        if(attacker != 0 && (GetUserFlagBits(attacker) & PREMIUMFLAG || cKillBoost > 0)
        {
            new hp_attacker = GetClientHealth(attacker);
            SetEntityHealth(attacker, hp_attacker + cKillBoost);
            CPrintToChat(attacker, "%s %t", TAG, "KillBoost", cKillBoost);
        }
        
        if(assister != 0 && (GetUserFlagBits(assister) & PREMIUMFLAG || cKillAssist > 0)
        {
            new hp_assister = GetClientHealth(assister);
            SetEntityHealth(assister, hp_assister + cKillAssist);
            CPrintToChat(attacker, "%s %t", TAG, "KillBoost_Assist", cKillAssist);
        }
        
        if(!(flags & 32) && GetUserFlagBits(victim) & PREMIUMFLAG)
        {
            if(cRespawn)
            CreateTimer(0.1, Timer_Respawn, victim);
            CloseAllHandles(victim);
        }
    }
}

public Action:Timer_Respawn(Handle:hTimer, any:client)
{
    TF2_RespawnPlayer(client);
}
I'm assuming you know how to count. For every opening parenthesis, you need a corresponding closing parenthesis.
psychonic is offline
Tylerst
Veteran Member
Join Date: Oct 2010
Old 12-16-2010 , 22:25   Re: (Also urgent) "error 029: invalid expression, assumed zero"
Reply With Quote #7

As psy said, they're problems with ( to ) ratio
for example:
Code:
if(cEnable && (GetUserFlagBits(client) & PREMIUMFLAG || IsValidEntity(client))
  1           2               3                                      4
4 opening
Code:
if(cEnable && (GetUserFlagBits(client) & PREMIUMFLAG || IsValidEntity(client))
                                     1                                      23
3 closing.


You Need to add one more
Code:
if(cEnable && (GetUserFlagBits(client) & PREMIUMFLAG || IsValidEntity(client)))
Also
Code:
if(attacker != 0 && (GetUserFlagBits(attacker) & PREMIUMFLAG || cKillBoost > 0))
and
Code:
if(assister != 0 && (GetUserFlagBits(assister) & PREMIUMFLAG || cKillAssist > 0))

Last edited by Tylerst; 12-16-2010 at 22:33.
Tylerst is offline
thatdarnkid
BANNED
Join Date: Nov 2010
Old 12-16-2010 , 22:39   Re: (Also urgent) "error 029: invalid expression, assumed zero"
Reply With Quote #8

OHHH parenthesis as in ( and )

See, I was looking at the brackets { and }. Me = idiot.

Thanks for the help guys, I'll make the changes and see how it goes.

0 errors! Yay!

Last edited by thatdarnkid; 12-16-2010 at 22:50.
thatdarnkid is offline
thatdarnkid
BANNED
Join Date: Nov 2010
Old 12-16-2010 , 22:51   Re: (Also urgent) "error 029: invalid expression, assumed zero"
Reply With Quote #9

I posted about this issue before, but received no response. Now that I have PawnStudio, I've been able to further investigate this issue.

These lines have appeared in every error log my server produces, and have caused the size of my error log to be between 2MB - 3MB every day.

Code:
L 12/15/2010 - 00:00:33: [SM] Plugin encountered error 22: Maximum number of parameters reached
L 12/15/2010 - 00:00:33: [SM] Native "VFormat" reported: Translation  string formatted incorrectly - missing at least 1 parameters
L 12/15/2010 - 00:00:33: [SM] Displaying call stack trace for plugin "premium.smx":
L 12/15/2010 - 00:00:33: [SM]   [0]  Line 129, C:\Users\User\Desktop\TF2  Stuff\Compiler\scripting\include\colors.inc::CPrintToChatEx()
L 12/15/2010 - 00:00:33: [SM]   [1]  Line 258, C:\Users\User\Desktop\TF2  Stuff\Compiler\scripting\premium.sp::Timer_Spawntimer()
So I took a look at colors.inc, line 129:
Code:
VFormat(szCMessage, sizeof(szCMessage), szBuffer, 4);
Then I looked at premium.sp, line 258:
Code:
CPrintToChatEx(client, client, "%t",  "WelcomeMessage");
Anyone know what "parameter" is missing? Something keeps telling me that the missing parameter is in colors.inc, but I could be wrong, and it could be in premium.sp.
thatdarnkid is offline
Tylerst
Veteran Member
Join Date: Oct 2010
Old 12-16-2010 , 23:06   Re: (Also urgent) "error 029: invalid expression, assumed zero"
Reply With Quote #10

Looks like an error in your translation file for premium.smx

CPrintToChatEx(client, client, "%t", "WelcomeMessage");

The %t in that means it's reading from the translation file for the WelcomeMessage and the
Code:
L 12/15/2010 - 00:00:33: [SM] Plugin encountered error 22: Maximum number of parameters reached
L 12/15/2010 - 00:00:33: [SM] Native "VFormat" reported: Translation  string formatted incorrectly - missing at least 1 parameters
Is saying the translation is formatted incorrectly.

I'm going to bed for tonight(well, probably) but you should post the translation for that premium mod, that's definitely where the problem is in any case.

Edit: Also make sure you're using the latest colors.inc from here :
http://forums.alliedmods.net/showthread.php?t=96831
I don't think it's a problem with that, but it's always good to have the latest one.

Last edited by Tylerst; 12-16-2010 at 23:20.
Tylerst 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 15:40.


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