I don't have a clue where the problem is. This code works perfectly fine under Windows but on linux:
1) When selecting a value from the menu that is to get a weapon (ak47/m4a1 and deagle in the secondary menu, handler is _Show[Prim|Sec]MenuHandler, the selected key is 1 or 3), the existing doesn't get destroyed with ham function StripWeapons( )
2) When selecting a value from the menu that is to get a weapon and save the menu state (which is to get a weapon automatically or do not without showing the menu next rounds), the server crashes
amxx logs are empty.
Both 1 and 2 work under Windows flawlessly.
Uses custom API but I think it's not needed now. If it is, just tell me and I'll update the post.
PHP Code:
#pragma library "aivip_func"
/* FUNKCE AiVIP software */
/* KONSTANTY, NUMERICKE PREVODY (ENUM) */
enum AiVIP_ReturnTypes
{
AiVIP_Success,
AiVIP_Failure
}
/* NATIVNI FUNKCE */
#define DEF_PREFIX 1
#define DEF_MAXPLAYERS 2
#define DEF_DBPREFIX 3
native ReturnTypes: AiVIP_GetDefinitionValue( const def, const where[], const maxlength )
/*
client : ID klienta ( 1 <= client <= 32 )
key : Trie key
vraci pouze urcity klic z Trie, pouziti podobne jako v predchozim prikladu. Efektivni pouze pro ziskavani jednoho key handleru,
chcete-li ziskat vice nez jeden, pouzijte predchozi funkci a pote pouzijte TrieGetString( )
new Key[ 2 ]
AiVIP_GetConnectionData( id, "admin", Key, 1 )
new Admin = str_to_num( Key )
if( Admin )
// hrac je admin v AiVIP systemu
*/
native ReturnTypes: AiVIP_GetConnectionData( const client, const key[], const where[], maxlength )
/*
vraci SQL handler z jadra, neni tudiz nutne pripojovat se k databazi znovu; jedine reseni, ktere byste meli pouzivat
Doporucene pouziti v plugin_cfg( )
POUZITI:
new Handle: g_SqlHandle
public plugin_cfg( )
{
g_SqlHandle = AiVIP_ShareSqlHandle( )
SQL_ThreadQuery( g_SqlHandle, ... )
}
*/
native Handle: AiVIP_ShareSqlHandle( )
/*
client: ID klienta ( 1 <= client <= 32 )
aktualizuje informace v Trie data handleru uzivatele
POUZITI:
new AiVIP_ReturnTypes: Status = AiVIP_RefreshTrieData( id )
if( Status == AiVIP_Success )
// data hrace s id 'id' byla aktualizovana
NEBO:
new const MAX_PLAYERS = 32
new AiVIP_ReturnTypes: Status
for( new i = 1; i <= MAX_PLAYERS; i ++ )
if( is_user_connected( i ) )
{
Status = AiVIP_RefreshTrieData( i )
if( Status == AiVIP_Failure )
// zalogujeme chybu a prerusime funkci pluginu, aby byla diagnostika jednodussi
AiVIP_HandleLastError( true )
}
*/
native AiVIP_ReturnTypes: AiVIP_RefreshTrieData( const client )
/*
SetFailState (BOOL) : vypnout plugin pomoci set_fail_state ( chyba ) TRUE/FALSE
zobrazi posledni zachycenou chybu
pouziti v prikladu u funkce AiVIP_GetConnectionData() (druhy priklad)
*/
native ReturnTypes: AiVIP_HandleLastError( where[ 512 ], const bool: SetFailState = false )
/*
client : ID klienta ( 1 <= client <= 32 )
UNIQUE_STRING: unikatni stringu serveru tak, jak je v administraci; ponechejte zakladni hodnotu ('^0') pro automaticke zjisteni serveru
na kterem je plugin spusten
Vrati timestamp, do kdy je VIP platne.
POUZITI:
new Time = AiVIP_GetUserVipStatus( id )
if( Time > get_systime() || Time == -1 )
// hrac ma vip aktivovano ( Time == -1 je nutne; hraci s neomezenou platnosti VIP maji prirazeno -1 )
*/
native AiVIP_GetUserVipStatus( const client, const UNIQUE_STRING[] = '^0' )
/*
client : ID klienta ( 1 <= klient <= 32 )
UNIQUE_STRING: unikatni stringu serveru tak, jak je v administraci; ponechejte zakladni hodnotu ('^0') pro automaticke zjisteni serveru
na kterem je plugin spusten
time : cas v sekundach od Unix Epochu, takzvany Timestamp; ponechejte -1 pro nastaveni na neomezenou dobu
Save : Pokud je true, hodnota se ulozi do databaze; je-li ponechano false, bude platit pouze do prenacteni Trie bud reconnectem nebo funkci
Nastavi cas do vyprseni VIP hrace. Lze nastavit i u hrace, ktery nema VIP aktivovano. -1 nastavi cas na neomezeny.
POUZITI:
new AiVIP_ReturnTypes: SetTime = AiVIP_SetUserVipStatus( id, _, 1292177532 )
if( SetTime == AiVIP_Success )
// VIP hrace bylo uspesne zmeneno, 1292177532 znamena, ze vyprsi dne 12 / 12 / 2012 12:12:12
*/
native AiVIP_ReturnTypes: AiVIP_SetUserVipStatus( const client, const UNIQUE_STRING[] = '^0', const time = -1, const bool: Save = false )
/*
client: ID klienta ( 1 <= klient <= 32 )
Vraci, jestli je klient pripojeny (bool true/false)
POUZITI:
new bool: IsLogged = AiVIP_IsUserLogged( id )
if( IsLogged )
// uzivatel je prihlaseny ve hre
*/
native bool: AiVIP_IsUserLogged( const client )
/* FORWARDY */
/*
client: ID klienta ( 1 <= klient <= 32 )
Vola se v momente, kdy je uzivatel schvalen AiVIP systemem
POUZITI:
public AiVIP_OnLoginHook( id )
// uzivatel 'id' se prave prihlasel do systemu (automaticky nebo manualne)
*/
forward AiVIP_OnLoginHook( client )
The code is in czech but only the hardcoded strings. If something needs explanation or wants me to translate the code overally, I'll be glad to do so. Same goes for the natives.