Raised This Month: $32 Target: $400
 8% 

[CS:GO] Error compile


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Dr.Mohammad
Senior Member
Join Date: Jan 2016
Location: CSGO Servers
Old 02-05-2018 , 16:31   [CS:GO] Error compile
Reply With Quote #1

hi guys,
i very very searched on forum and google but i can not solve.

i sended post to:
https://forums.alliedmods.net/showpo...postcount=5108
but nobody any helped. i need this plugin but have errors .
plugin gungame no supported by creator so i sended problem.

download and used:
https://github.com/altexdim/sourcemod-plugin-gungame

error1:
PHP Code:
//// gungame_stats.sp
//
// gungame_stats/sql.sp(403) : warning 219: local variable "File" shadows a variable at a preceding level
// Code size:            30224 bytes
// Data size:            10064 bytes
// Stack/heap size:      16384 bytes
// Total requirements:   56672 bytes
//
// 1 Warning.
//
// Compilation Time: 0.37 sec
// ---------------------------------------- 
PHP Code:
// non-threaded 
public Action:_CmdImportDb(clientargs

    
decl String:File[PLATFORM_MAX_PATH]; // Line 403 
    
BuildPath(Path_SMFilesizeof(File), "data/gungame/playerdata.txt"); 

    if ( !
FileExists(File) ) 
    { 
        
ReplyToCommand(client"[GunGame] playerdata.txt does not exists to be imported."); 
        return 
Plugin_Handled
    } 

    new 
Handle:KvGunGame CreateKeyValues("gg_PlayerData"BLANKBLANK); 
    
FileToKeyValues(KvGunGameFile); 

    
/* Go to first SubKey */ 
    
if ( !KvGotoFirstSubKey(KvGunGame) ) 
    { 
        
ReplyToCommand(client"[GunGame] You have no player data to import."); 
        return 
Plugin_Handled
    } 

    
decl String:query[1024], String:error[255]; 
    
decl WinsString:Name[64]; 
    
decl ImportedWinsString:Auth[64]; 

    new 
bufferLen sizeof(Name) * 1
    
decl String:nameQuoted[bufferLen]; 

    do 
    { 
        
KvGetSectionName(KvGunGameAuthsizeof(Auth)); 
        
ImportedWins KvGetNum(KvGunGame"Wins"); 

        if ( !
ImportedWins || Auth[0] != 'S' 
        { 
            continue; 
        } 

        
// Load player data         
        
SQL_LockDatabase(g_DbConnection); 
        
Format(querysizeof(query), g_sql_getPlayerByAuthAuth); 
        
#if defined SQL_DEBUG 
            
LogError("[DEBUG-SQL] %s"query); 
        
#endif 
        
new Handle:result SQL_Query(g_DbConnectionquery); 
        if ( 
result == INVALID_HANDLE 
        { 
            
SQL_GetError(g_DbConnectionerrorsizeof(error)); 
            
LogError("Failed to get player (error: %s)"error); 
            
SQL_UnlockDatabase(g_DbConnection); 
            
ReplyToCommand(client"[GunGame] Import finished with sql error"); 
            
CloseHandle(KvGunGame); 
            return 
Plugin_Handled
        } 
        
SQL_UnlockDatabase(g_DbConnection); 
        if ( 
SQL_FetchRow(result) ) 
        { 
            
Wins SQL_FetchInt(result1); 
            
SQL_FetchString(result2Namesizeof(Name)); 
        } 
        else 
        { 
            
Wins 0
        } 
        
CloseHandle(result); 
         
        if ( 
Wins ) { 
            
SQL_EscapeString(g_DbConnectionNamenameQuotedbufferLen); 
            
Format(querysizeof(query), g_sql_updatePlayerByAuthWins ImportedWinsnameQuotedAuth); 
        } else { 
            
KvGetString(KvGunGame"Name"Namesizeof(Name)); 
            
SQL_EscapeString(g_DbConnectionNamenameQuotedbufferLen); 
            
Format(querysizeof(query), g_sql_insertPlayerImportedWinsnameQuotedAuth); 
        } 

        
// SavePlayerData 
        
SQL_LockDatabase(g_DbConnection); 
        
#if defined SQL_DEBUG 
            
LogError("[DEBUG-SQL] %s"query); 
        
#endif 
        
if ( !SQL_FastQuery(g_DbConnectionquery) ) 
        { 
            
SQL_GetError(g_DbConnectionerrorsizeof(error)); 
            
LogError("Could not save player (error: %s)"error); 
            
SQL_UnlockDatabase(g_DbConnection); 
            
ReplyToCommand(client"[GunGame] Import finished with sql error"); 
            
CloseHandle(KvGunGame); 
            return 
Plugin_Handled
        } 
        
SQL_UnlockDatabase(g_DbConnection); 
    } 
    while(
KvGotoNextKey(KvGunGame)); 

    
CloseHandle(KvGunGame); 
     
    
/* Reload the players wins in memory */ 
    
for ( new 1<= MaxClientsi++ ) 
    { 
        if ( 
IsClientAuthorized(i) ) 
        { 
            
GetClientAuthId(iAuthId_Steam2Authsizeof(Auth)); 
            
RetrieveKeyValues(iAuth); 
        } 
    } 

    
ReplyToCommand(client"[GunGame] Import of player data completed. Please run gg_rebuild to update the top rank."); 

    return 
Plugin_Handled


error2:
PHP Code:
//// gungame.sp
//
// gungame/util.sp(1272) : warning 213: tag mismatch
// Code size:           117808 bytes
// Data size:            34204 bytes
// Stack/heap size:      16384 bytes
// Total requirements:  168396 bytes
//
// 1 Warning.
//
// Compilation Time: 1.09 sec
// ---------------------------------------- 
PHP Code:
public Action:UTIL_Timer_ShowHintText(Handle:timerany:data

    new 
clientString:textHint[512], times
     
    
ResetPack(data); 
    
times ReadPackCell(data); 
    
client ReadPackCell(data); 
    
ReadPackString(datatextHintsizeof(textHint)); 
     
    if ( !
IsClientInGame(client) ) 
    { 
        
CloseHandle(data); 
        return 
Plugin_Stop
    } 
     
    
PrintHintText(clienttextHint); 
    if ( --
times <= 
    { 
        
CloseHandle(data); 
        return 
Plugin_Stop
    } 
    else 
    { 
        
SetPackPosition(data0); //Line 1272 
        
WritePackCell(datatimes); 
        return 
Plugin_Continue
    } 


thank you for any help.
Dr.Mohammad is offline
versatile_bfg
Veteran Member
Join Date: Feb 2012
Old 02-05-2018 , 18:49   Re: [CS:GO] Error compile
Reply With Quote #2

Both are warnings, not errors.

The first warning is saying there is already a variable called File. If you rename this in there the warning will go away. (make sure you rename all the affected variable in that public action.)

The second warning is because you are setting the position with 0. Read this: SetPackPosition
and get the position with this GetPackPosition
__________________
versatile_bfg is offline
Dr.Mohammad
Senior Member
Join Date: Jan 2016
Location: CSGO Servers
Old 02-05-2018 , 20:47   Re: [CS:GO] Error compile
Reply With Quote #3

Quote:
Originally Posted by versatile_bfg View Post
Both are warnings, not errors.

The first warning is saying there is already a variable called File. If you rename this in there the warning will go away. (make sure you rename all the affected variable in that public action.)

The second warning is because you are setting the position with 0. Read this: SetPackPosition
and get the position with this GetPackPosition
thank you. i fixed error1 .

but i can not fix error2 :
SetPackPosition(data, 0);

please help
Dr.Mohammad is offline
SZOKOZ
Member
Join Date: Jan 2014
Old 02-06-2018 , 04:04   Re: [CS:GO] Error compile
Reply With Quote #4

SetPackPosition does not take a mere integer as an argument for position.
The newer version of sm api is more clear on this. https://sm.alliedmods.net/new-api/da...etPackPosition
__________________
May still be available for SM scripting. Just look at my Steam profile regarding my availability.
My Steam
SZOKOZ is offline
Dr.Mohammad
Senior Member
Join Date: Jan 2016
Location: CSGO Servers
Old 02-06-2018 , 06:05   Re: [CS:GO] Error compile
Reply With Quote #5

Quote:
Originally Posted by SZOKOZ View Post
SetPackPosition does not take a mere integer as an argument for position.
The newer version of sm api is more clear on this. https://sm.alliedmods.net/new-api/da...etPackPosition
thank you but i read this :
https://sm.alliedmods.net/new-api/da...etPackPosition

i no underestand for chenge to new api

you can for me chenge to new api this:
SetPackPosition(data, 0);
Dr.Mohammad is offline
SZOKOZ
Member
Join Date: Jan 2014
Old 02-06-2018 , 20:38   Re: [CS:GO] Error compile
Reply With Quote #6

SetPackPosition is usually used for going back to a position you retrieved from a previous GetPackPosition call. If you just want to start writing a pack from the first position just use ResetPack. I can't say for sure that 0 is the first position so use ResetPack(data) instead.
__________________
May still be available for SM scripting. Just look at my Steam profile regarding my availability.
My Steam
SZOKOZ is offline
Dr.Mohammad
Senior Member
Join Date: Jan 2016
Location: CSGO Servers
Old 02-07-2018 , 07:53   Re: [CS:GO] Error compile
Reply With Quote #7

Quote:
Originally Posted by SZOKOZ View Post
SetPackPosition is usually used for going back to a position you retrieved from a previous GetPackPosition call. If you just want to start writing a pack from the first position just use ResetPack. I can't say for sure that 0 is the first position so use ResetPack(data) instead.
thank you. solved

i chenge SetPackPosition to ResetPack!!
Dr.Mohammad 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 22:13.


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