Raised This Month: $442 Target: $400
 110% 

[STOCKS] Few errors


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Halt
Senior Member
Join Date: Jan 2015
Location: Black Mesa
Old 09-14-2019 , 12:24   [STOCKS] Few errors
Reply With Quote #1

I have a few errors in my new stocks I'm trying to make (yes I know these stocks have already been made elsewhere) A lot of this code is 6+ years old. Idk if my methods still work.
I'm more so worried about error 028 and error 021.

Errors Below
Spoiler


Pick it apart and be as cruel as necessary. Looking to learn. Wont be offended.

PHP Code:
stock int GetRandomClient()
{
    
int i[MaxClients 1], ii;
    for(
int i 1<= MaxClientsi++)
    {
        if(
IsAuthenticClient(i))
        {
            
i[ii++] + i//THIS IS LINE 15
        
}
        return (
ii == 0) ? -i[GetRandomInt(0ii 1)];
    }
    return -
1

IsAuthenticClient
PHP Code:
stock bool IsAuthenticClient(int iClient)
{
    if (
iClient <= 0)
        return 
false;
    if    (!
IsClientInGame(iClient))
        return 
false;
    if    (!
IsClientConnected(iClient))
        return 
false;
    if    (
IsClientReplay(iClient))
        return 
false;
    
    return 
true;


Last edited by Halt; 09-14-2019 at 12:24.
Halt is offline
n3ontm
Junior Member
Join Date: May 2017
Old 09-14-2019 , 13:07   Re: [STOCKS] Few errors
Reply With Quote #2

PHP Code:
stock int GetRandomClient()
{
    
int iEligibleClients[MaxClients 1];
    
int iIndex;
    for(
int i 1<= MaxClientsi++)
    {
        if(
IsAuthenticClient(i))
        {
            
iEligibleClients[iIndex] = i;
            
iIndex++;
        }        
    }
    return (
iIndex == 0) ? -iEligibleClients[GetRandomInt(0iIndex 1)];


Last edited by n3ontm; 09-14-2019 at 13:10.
n3ontm is offline
Halt
Senior Member
Join Date: Jan 2015
Location: Black Mesa
Old 09-14-2019 , 13:20   Re: [STOCKS] Few errors
Reply With Quote #3

Still getting errors with this

Code:
//// cZomRevamp.sp
//
// D:\Dev\Programming\Pawn\sourcemod\scripting\include\zstocks.inc(24) : error 161: brackets after variable name indicate a fixed-size array, but a dynamic size was given - did you mean to use 'new int[size]' syntax?
// D:\Dev\Programming\Pawn\sourcemod\scripting\include\zstocks.inc(101) : error 035: argument type mismatch (argument 2)
// D:\Dev\Programming\Pawn\sourcemod\scripting\cZomRevamp.sp(45) : error 017: undefined symbol "MakeZombie"
// D:\Dev\Programming\Pawn\sourcemod\scripting\cZomRevamp.sp(60) : error 012: invalid function call, not a valid address
// D:\Dev\Programming\Pawn\sourcemod\scripting\cZomRevamp.sp(60) : warning 215: expression has no effect
// D:\Dev\Programming\Pawn\sourcemod\scripting\cZomRevamp.sp(60) : error 001: expected token: ";", but found ")"
// D:\Dev\Programming\Pawn\sourcemod\scripting\cZomRevamp.sp(60) : error 029: invalid expression, assumed zero
// D:\Dev\Programming\Pawn\sourcemod\scripting\cZomRevamp.sp(60) : fatal error 190: too many error messages on one line
PHP Code:
stock int GetRandomClient()
{
    
int iEligibleClients[MaxClients 1]; //Line 24
    
int iClientIndex;
    for(
int i 1<= MaxClientsi++)
    {
        if(
IsAuthenticClient(i))
        {
            
iEligibleClients[iClientIndex] = i;
            
iClientIndex++;
        }
    }
    return    (
iClientIndex == 0) ? -iEligibleClients[GetRandomInt(0iClientIndex 1)];

Halt is offline
n3ontm
Junior Member
Join Date: May 2017
Old 09-14-2019 , 13:22   Re: [STOCKS] Few errors
Reply With Quote #4

my bad
Quote:
int iEligibleClients[MAXPLAYERS+1];

Last edited by n3ontm; 09-14-2019 at 13:22.
n3ontm is offline
Reply


Thread Tools
Display Modes

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 17:48.


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