SA-MP Forums Archive
Run Time Error 20 :O - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Run Time Error 20 :O (/showthread.php?tid=625124)



Run Time Error 20 :O - RyderX - 28.12.2016

PHP код:
----------
Loaded log file"server_log.txt".
----------
SA-MP Dedicated Server
----------------------
v0.3.7-R2, (C)2005-2015 SA-MP Team
[10:52:03filterscripts ""  (string)
[
10:52:03
[
10:52:03Server Plugins
[10:52:03] --------------
[
10:52:03]  Loading pluginWhirlpool
[10:52:03]  
[
10:52:03]  ==================
[
10:52:03]  
[
10:52:03]   Whirlpool loaded
[10:52:03]  
[
10:52:03]  ==================
[
10:52:03]  
[
10:52:03]   Loaded.
[
10:52:03]  Loading pluginstreamer
[10:52:03
*** 
Streamer Plugin v2.5.2 by Incognito loaded ***
[
10:52:03]   Loaded.
[
10:52:03]  Loading pluginsscanf
[10:52:03
[
10:52:03]  ===============================
[
10:52:03]       sscanf plugin loaded.     
[
10:52:03]          Version:  2.8.1        
[10:52:03]    (c2012 Alex "******" Cole  
[10:52:03]  ===============================
[
10:52:03]   Loaded.
[
10:52:03]  Loading pluginirc
[10:52:03
*** 
IRC Plugin v1.4.8 by Incognito loaded ***
[
10:52:03]   Loaded.
[
10:52:03]  Loaded 4 plugins.
[
10:52:03
[
10:52:03Filterscripts
[10:52:03] ---------------
[
10:52:03]   Loaded 0 filterscripts.
[
10:52:03Script[gamemodes/TDM.amx]: Run time error 20"Invalid index parameter (bad entry point)"
[10:52:03Number of vehicle models
What's wrong?

here's the code:
PHP код:
#include <a_samp>
#include <YSI\y_ini>
#include <dudb>
#define PATH "/Users/%s.ini"
#define FILTERSCRIPT
#define PLAYER_MUST_REGISTER
#define REGISTERED_MONEY 5000
#define AUTOLOGIN
#define white 0xFFFFFFA
#define red 0xFF0000AA
#define lime 0x00FF00FF
#define yellow 0xFFFF00FF
#define DIALOG_REGISTER 999
#define DIALOG_LOGIN 998
#pragma unused ret_memcpy
enum iDetails {
    
Pass,
    
Cash,
    
Score
};
new 
pInfo[MAX_PLAYERS][iDetails];
#if defined AUTOLOGIN
    
new pIP[MAX_PLAYERS][16];
#endif
new pLogged[MAX_PLAYERS];
stock PlayerPath(playerid) {
    new 
iStr[256],name[MAX_PLAYER_NAME];
    
GetPlayerName(playerid,name,sizeof(name));
    
format(iStr,sizeof(iStr),PATH,name);
    return 
iStr;
}
public 
OnFilterScriptInit()
{
    print(
"\n--------------------------------------");
    print(
"Login & Register system by Seven_of_Nine");
    print(
"--------------------------------------\n");
    return 
1;
}
public 
OnFilterScriptExit()
{
    return 
1;
}
public 
OnGameModeExit()
{
    return 
1;
}
forward UserDataLoad_data(playerid,name[],value[]);
public 
UserDataLoad_data(playerid,name[],value[]) {
    
INI_Int("Pass",pInfo[playerid][Pass]);
    
#if defined AUTOLOGIN
        
INI_String("IP",pIP[playerid],16);
    
#endif
    
INI_Int("Cash",pInfo[playerid][Cash]);
    
INI_Int("Score",pInfo[playerid][Score]);
    return 
1;
}
public 
OnPlayerConnect(playerid)
{
    
pLogged[playerid] = 0;
    
#if defined AUTOLOGIN
        
new tmpIP[16];
        
GetPlayerIp(playerid,tmpIP,sizeof(tmpIP));
    
#endif
    
if(fexist(PlayerPath(playerid))) {
        
INI_ParseFile(PlayerPath(playerid), "UserDataLoad_%s", .bExtra true, .extra playerid);
        
#if defined AUTOLOGIN
            
if(strcmp(tmpIP,pIP[playerid],true) == 0) {
                
pLogged[playerid] = 1;
                
SetPlayerScore(playerid,pInfo[playerid][Score]);
                
GivePlayerMoney(playerid,pInfo[playerid][Cash]);
                
SendClientMessage(playerid,lime,"You've been auto-logged in. [IP match]");
                return 
1;
            }
        
#endif
        
ShowPlayerDialog(playerid,DIALOG_LOGIN,DIALOG_STYLE_INPUT,"Login","Please enter your password below.","Login","Leave");
    } else {
        
ShowPlayerDialog(playerid,DIALOG_REGISTER,DIALOG_STYLE_INPUT,"Register","Please register by entering a password below.","Register","Leave");
    }
    return 
1;
}
public 
OnPlayerDisconnect(playeridreason)
{
    if(
pLogged[playerid] == 1) {
        new 
INI:iFile INI_Open(PlayerPath(playerid));
        
INI_SetTag(iFile,"data");
        
INI_WriteInt(iFile,"Cash",GetPlayerMoney(playerid));
        
INI_WriteInt(iFile,"Score",GetPlayerScore(playerid));
        
INI_Close(iFile);
    }
    
pLogged[playerid] = 0;
    return 
1;
}
public 
OnPlayerRequestSpawn(playerid)
{
    if(
pLogged[playerid] == 0) return SendClientMessage(playerid,yellow,"You must register or login before spawning!");
    return 
1;
}
public 
OnDialogResponse(playeriddialogidresponselistiteminputtext[])
{
     if(
dialogid == DIALOG_REGISTER) {
        
GetPlayerIp(playerid,pIP[playerid],16);
        if(!
responseKick(playerid);
        if(!
strlen(inputtext)) return ShowPlayerDialog(playerid,DIALOG_REGISTER,DIALOG_STYLE_INPUT,"Register","Please enter a password.","Register","Leave");
        new 
INI:iFile INI_Open(PlayerPath(playerid));
        
INI_SetTag(iFile,"data");
        
INI_WriteInt(iFile,"Pass",udb_hash(inputtext));
        
#if defined AUTOLOGIN
            
INI_WriteString(iFile,"IP",pIP[playerid]);
        
#endif
        
INI_WriteInt(iFile,"Cash",REGISTERED_MONEY);
        
INI_WriteInt(iFile,"Score",0);
        
INI_Close(iFile);
        
pLogged[playerid] = 1;
        new 
iStr[128];
        
format(iStr,sizeof(iStr),"You've successfully registered with the password \"%s\".",inputtext);
        
SendClientMessage(playerid,yellow,iStr);
        return 
1;
    }
    if(
dialogid == DIALOG_LOGIN) {
        if(!
responseKick(playerid);
        new 
iStr[128],gTries;
        if(
gTries == 0gTries 1;
        if(
gTries == 3) {
            new 
pName[30];
            
GetPlayerName(playerid,pName,sizeof(pName));
            
format(iStr,sizeof(iStr),"%s has been kicked for exceeding login tries.",pName);
            
SendClientMessageToAll(red,iStr);
            return 
Kick(playerid);
        }
        if(!
strlen(inputtext)) {
            
format(iStr,sizeof(iStr),"Please enter your password. Tries: %i/3",gTries);
            return 
ShowPlayerDialog(playerid,DIALOG_LOGIN,DIALOG_STYLE_INPUT,"Login",iStr,"Login","Leave");
        }
        if(
udb_hash(inputtext) == pInfo[playerid][Pass]) {
            
pLogged[playerid] = 1;
            
SendClientMessage(playerid,lime,"You've successfully logged in.");
            
SetPlayerScore(playerid,pInfo[playerid][Score]);
            
GivePlayerMoney(playerid,pInfo[playerid][Cash]);
        } else {
            
format(iStr,sizeof(iStr),"Incorrect password. Tries: %i/3",gTries);
            
ShowPlayerDialog(playerid,DIALOG_REGISTER,DIALOG_STYLE_INPUT,"Register",iStr,"Login","Leave");
            
gTries++;
            return 
1;
        }
        return 
1;
    }
    return 
1;

Rep+ for you would help.


Re: Run Time Error 20 :O - Swedky - 28.12.2016

Add "main() { };" anywhere in your GM (before OnGameModeInit if you like)


Re: Run Time Error 20 :O - RyderX - 28.12.2016

Didn't Work, i got error.

PHP код:
C:\Users\Admin\Desktop\samp037_svr_R2-1-1_win32 (1)\gamemodes\TDM.pwn(20) : error 010invalid function or declaration
Pawn compiler 3.2.3664              Copyright 
(c1997-2006ITB CompuPhase


1 Error

Code
PHP код:
#include <a_samp>
#include <YSI\y_ini>
#include <dudb>

#define PATH "/Users/%s.ini"
#define FILTERSCRIPT
#define PLAYER_MUST_REGISTER
#define REGISTERED_MONEY 5000
#define AUTOLOGIN

#define white 0xFFFFFFA
#define red 0xFF0000AA
#define lime 0x00FF00FF
#define yellow 0xFFFF00FF

#define DIALOG_REGISTER 999
#define DIALOG_LOGIN 998

#pragma unused ret_memcpy
main(){};
enum iDetails {
    
Pass,
    
Cash,
    
Score
};
new 
pInfo[MAX_PLAYERS][iDetails];

#if defined AUTOLOGIN
    
new pIP[MAX_PLAYERS][16];
#endif

new pLogged[MAX_PLAYERS];

stock PlayerPath(playerid) {
    new 
iStr[256],name[MAX_PLAYER_NAME];
    
GetPlayerName(playerid,name,sizeof(name));
    
format(iStr,sizeof(iStr),PATH,name);
    return 
iStr;
}
public 
OnFilterScriptInit()
{
    print(
"\n--------------------------------------");
    print(
"Login & Register system by Seven_of_Nine");
    print(
"--------------------------------------\n");
    return 
1;
}


forward UserDataLoad_data(playerid,name[],value[]);

public 
UserDataLoad_data(playerid,name[],value[]) {
    
INI_Int("Pass",pInfo[playerid][Pass]);
    
#if defined AUTOLOGIN
        
INI_String("IP",pIP[playerid],16);
    
#endif
    
INI_Int("Cash",pInfo[playerid][Cash]);
    
INI_Int("Score",pInfo[playerid][Score]);
    return 
1;
}

public 
OnPlayerConnect(playerid)
{
    
pLogged[playerid] = 0;
    
#if defined AUTOLOGIN
        
new tmpIP[16];
        
GetPlayerIp(playerid,tmpIP,sizeof(tmpIP));
    
#endif
    
if(fexist(PlayerPath(playerid))) {
        
INI_ParseFile(PlayerPath(playerid), "UserDataLoad_%s", .bExtra true, .extra playerid);
        
#if defined AUTOLOGIN
            
if(strcmp(tmpIP,pIP[playerid],true) == 0) {
                
pLogged[playerid] = 1;
                
SetPlayerScore(playerid,pInfo[playerid][Score]);
                
GivePlayerMoney(playerid,pInfo[playerid][Cash]);
                
SendClientMessage(playerid,lime,"You've been auto-logged in. [IP match]");
                return 
1;
            }
        
#endif
        
ShowPlayerDialog(playerid,DIALOG_LOGIN,DIALOG_STYLE_INPUT,"Login","Please enter your password below.","Login","Leave");
    } else {
        
ShowPlayerDialog(playerid,DIALOG_REGISTER,DIALOG_STYLE_INPUT,"Register","Please register by entering a password below.","Register","Leave");
    }
    return 
1;
}

public 
OnPlayerDisconnect(playeridreason)
{
    if(
pLogged[playerid] == 1) {
        new 
INI:iFile INI_Open(PlayerPath(playerid));
        
INI_SetTag(iFile,"data");
        
INI_WriteInt(iFile,"Cash",GetPlayerMoney(playerid));
        
INI_WriteInt(iFile,"Score",GetPlayerScore(playerid));
        
INI_Close(iFile);
    }
    
pLogged[playerid] = 0;
    return 
1;
}

public 
OnPlayerRequestSpawn(playerid)
{
    if(
pLogged[playerid] == 0) return SendClientMessage(playerid,yellow,"You must register or login before spawning!");
    return 
1;
}

public 
OnDialogResponse(playeriddialogidresponselistiteminputtext[])
{
     if(
dialogid == DIALOG_REGISTER) {
        
GetPlayerIp(playerid,pIP[playerid],16);
        if(!
responseKick(playerid);
        if(!
strlen(inputtext)) return ShowPlayerDialog(playerid,DIALOG_REGISTER,DIALOG_STYLE_INPUT,"Register","Please enter a password.","Register","Leave");
        new 
INI:iFile INI_Open(PlayerPath(playerid));
        
INI_SetTag(iFile,"data");
        
INI_WriteInt(iFile,"Pass",udb_hash(inputtext));
        
#if defined AUTOLOGIN
            
INI_WriteString(iFile,"IP",pIP[playerid]);
        
#endif
        
INI_WriteInt(iFile,"Cash",REGISTERED_MONEY);
        
INI_WriteInt(iFile,"Score",0);
        
INI_Close(iFile);
        
pLogged[playerid] = 1;
        new 
iStr[128];
        
format(iStr,sizeof(iStr),"You've successfully registered with the password \"%s\".",inputtext);
        
SendClientMessage(playerid,yellow,iStr);
        return 
1;
    }
    if(
dialogid == DIALOG_LOGIN) {
        if(!
responseKick(playerid);
        new 
iStr[128],gTries;
        if(
gTries == 0gTries 1;
        if(
gTries == 3) {
            new 
pName[30];
            
GetPlayerName(playerid,pName,sizeof(pName));
            
format(iStr,sizeof(iStr),"%s has been kicked for exceeding login tries.",pName);
            
SendClientMessageToAll(red,iStr);
            return 
Kick(playerid);
        }
        if(!
strlen(inputtext)) {
            
format(iStr,sizeof(iStr),"Please enter your password. Tries: %i/3",gTries);
            return 
ShowPlayerDialog(playerid,DIALOG_LOGIN,DIALOG_STYLE_INPUT,"Login",iStr,"Login","Leave");
        }
        if(
udb_hash(inputtext) == pInfo[playerid][Pass]) {
            
pLogged[playerid] = 1;
            
SendClientMessage(playerid,lime,"You've successfully logged in.");
            
SetPlayerScore(playerid,pInfo[playerid][Score]);
            
GivePlayerMoney(playerid,pInfo[playerid][Cash]);
        } else {
            
format(iStr,sizeof(iStr),"Incorrect password. Tries: %i/3",gTries);
            
ShowPlayerDialog(playerid,DIALOG_REGISTER,DIALOG_STYLE_INPUT,"Register",iStr,"Login","Leave");
            
gTries++;
            return 
1;
        }
        return 
1;
    }
    return 
1;

any other idea, REP+ for the helper.


Re: Run Time Error 20 :O - BiosMarcel - 28.12.2016

PHP код:
main(){} 
No semicolon allowed there, why would u do that, lol


Re: Run Time Error 20 :O - RyderX - 28.12.2016

Quote:
Originally Posted by Swedky
Посмотреть сообщение
Add "main() { };"
i just got it from Swedky.


Re: Run Time Error 20 :O - BiosMarcel - 28.12.2016

Quote:
Originally Posted by RyderX
Посмотреть сообщение
i just got it from Swedky.
Yeah, but just because he says so, it doesn't mean it is right Next time try a little for yourself, the people that help you also make mistakes (taking me for example, i make a ton, lol)


Re: Run Time Error 20 :O - RyderX - 28.12.2016

Quote:
Originally Posted by [Bios]Marcel
Посмотреть сообщение
PHP код:
main(){} 
No semicolon allowed there, why would u do that, lol
Thanks Very very very much! REP'D YOU


Re: Run Time Error 20 :O - Pearson - 28.12.2016

main (){} EZ