SA-MP Forums Archive
ERROR :/ - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: ERROR :/ (/showthread.php?tid=251884)



ERROR :/ - Ћilvėnas - 29.04.2011

Код:
D:\ZFR\gamemodes\ZFR.pwn(1322) : error 017: undefined symbol "w"
D:\ZFR\gamemodes\ZFR.pwn(1322) : error 017: undefined symbol "w"
D:\ZFR\gamemodes\ZFR.pwn(1322) : error 029: invalid expression, assumed zero
D:\ZFR\gamemodes\ZFR.pwn(1322) : fatal error 107: too many error messages on one line
line
Код:
format(w,sizeof(w),"Prisijunk,jeigu nori zaisti",PlayerName(playerid));
All code

Код:
 if(dialogid == 1)
   {
     if(response == 1)
        {
        new pFile[128], pIP[16], w[128], gw[128];
          GetPlayerIp(playerid, pIP, sizeof(pIP));
            format(pFile, sizeof(pFile), "Users/%s.ini", PlayerName(playerid));
			if(strlen(inputtext))
			{
	    		if(dini_Exists(pFile))
	    		{
	    			SendClientMessage(playerid, COLOR_RED, "Tu jau esi uzsiregistraves!");
	    		}
	    		else
	    		{
	    	    	PlayerPlaySound(playerid,1057,0.0,0.0,0.0);
	    			dini_Create(pFile);
	    			dini_Set(pFile, "PlayerName", PlayerName(playerid));
	    			dini_Set(pFile, "PlayerIP", pIP);
    				dini_IntSet(pFile, "PasswordHash", udb_hash(inputtext));
	    			dini_IntSet(pFile, "Admin", 0);
					dini_IntSet(pFile, "Pinigai", 0);
					dini_IntSet(pFile, "Taskai", 100);
                    dini_IntSet(pFile, "Mirtys", 0);
                    dini_IntSet(pFile, "Nuzudymai", 0);
                    SendClientMessage(playerid, COLOR_GREEN, "Tu UZREGISTRUOTAS!");
	    			format(w,sizeof(w),"Prisijunk,jeigu nori zaisti",PlayerName(playerid));
    				ShowPlayerDialog(playerid,2,DIALOG_STYLE_INPUT,"Prisijungimas",w,"Prisijungti","Iseiti");
	    		}
			}
			else
			{
	    		SendClientMessage(playerid, COLOR_RED, "Irasyk slaptazodi!");
    			format(gw,sizeof(gw),"Uzsiregistruok,jeigu nori zaisti",PlayerName(playerid));
    			ShowPlayerDialog(playerid,1,DIALOG_STYLE_INPUT,"Registracija",gw,"Registruotis","Iseiti");
			}
        }
        if(response == 0)
        {
       		format(w,sizeof(w),"Prisijunk,jeigu nori zaisti",PlayerName(playerid));
    		ShowPlayerDialog(playerid,2,DIALOG_STYLE_INPUT,"Prisijungimas",w,"Prisijungti","Iseiti");
        }
    }

    if(dialogid == 2)
    {
        if(response == 1)
        {
			if(strlen(inputtext))
			{
				format(pFile, sizeof(pFile), "Users/%s.ini", PlayerName(playerid));
	    		new pass[256];
				pass = dini_Get(pFile, "PasswordHash");
	    		if(udb_hash(inputtext) != strval(pass))
	        	{
	    			SendClientMessage(playerid, COLOR_RED, "Blogas slaptazodis!");
	    			format(w,sizeof(w),"Prisijunk,jeigu nori zaisti",PlayerName(playerid));
    				ShowPlayerDialog(playerid,2,DIALOG_STYLE_INPUT,"Prisijungimas",w,"Prisijungti","Iseiti");
				}
				else
				{
					PlayerPlaySound(playerid,1057,0.0,0.0,0.0);
					if(dini_Int(pFile,"Admin") == 0){pInfo[playerid][Admin]=false;}
					if(dini_Int(pFile,"Admin") == 1){pInfo[playerid][Admin]=true;}
					pInfo[playerid][Money] = dini_Int(pFile, "Pinigai");
					pInfo[playerid][Taskai] = dini_Int(pFile, "Taskai");
					pInfo[playerid][Mirtys] = dini_Int(pFile, "Mirtys");
					pInfo[playerid][Killai] = dini_Int(pFile, "Nuzudymai");
					GivePlayerMoney(playerid, pInfo[playerid][Money]);
					SetPlayerScore(playerid, pInfo[playerid][Taskai]);
	    			SendClientMessage(playerid, COLOR_GREEN, "PRISIJUNGIAI!");
				}
			}
			else
			{
	    		SendClientMessage(playerid, COLOR_RED, "Irasyk slaptazodi!");
	    		format(w,sizeof(w),"Prisijunk,jeigu nori zaisti",PlayerName(playerid));
    			ShowPlayerDialog(playerid,2,DIALOG_STYLE_INPUT,"Prisijungimas",w,"Prisijungti","Iseiti");
			}
        }
        if(response == 0)
        {
	    	format(w,sizeof(w),"Prisijunk,jeigu nori zaisti",PlayerName(playerid));
    		ShowPlayerDialog(playerid,2,DIALOG_STYLE_INPUT,"Prisijungimas",w,"Prisijungti","Iseiti");
        }
}
	return 0;
}
help!


Re: ERROR :/ - Raimis_R - 29.04.2011

You need to create string "w"

pawn Код:
new w[Size];



Re: ERROR :/ - Vince - 29.04.2011

Код:
if(dialogid == 1)
{
    if(response == 1)
    {
        new w[128];
    }
    if(response == 0)
    {

    }
}
Variables that you create are ONLY available in the block they were created in (marked in green). It it not known in any other blocks (marked in red). This is called the 'scope' of a variable.


Re: ERROR :/ - Ћilvėnas - 29.04.2011

Quote:
Originally Posted by Vince
Посмотреть сообщение
Код:
if(dialogid == 1)
{
    if(response == 1)
    {
        new w[128];
    }
    if(response == 0)
    {

    }
}
Variables that you create are ONLY available in the block they were created in (marked in green). It it not known in any other blocks (marked in red). This is called the 'scope' of a variable.
Noo,i alerty defined w[128];
if(response == 1)
{
new pFile[128], pIP[16], w[128], gw[128];


Re: ERROR :/ - Vince - 29.04.2011

That's what I said ... You ONLY defined it in the block I marked in green, but nowhere else. Hence, the compiler will complain if you use it anywhere else.


Re: ERROR :/ - Ћilvėnas - 29.04.2011

Код:
if(response == 0)
        {
            new w[128];
       		format(w,sizeof(w),"Prisijunk,jeigu nori zaisti",PlayerName(playerid));
    		ShowPlayerDialog(playerid,2,DIALOG_STYLE_INPUT,"Prisijungimas",w,"Prisijungti","Iseiti");
        }
    }
In this way?

but then:
Код:
:\ZFR\gamemodes\ZFR.pwn(1334) : error 017: undefined symbol "pFile"
D:\ZFR\gamemodes\ZFR.pwn(1334) : error 017: undefined symbol "pFile"
D:\ZFR\gamemodes\ZFR.pwn(1334) : error 029: invalid expression, assumed zero
D:\ZFR\gamemodes\ZFR.pwn(1334) : fatal error 107: too many error messages on one line
line:
format(pFile, sizeof(pFile), "Users/%s.ini", PlayerName(playerid));


Re: ERROR :/ - Ћilvėnas - 29.04.2011

anyone?


Re: ERROR :/ - Antonio144 - 29.04.2011

pawn Код:
new pFile[128];



Re: ERROR :/ - Ћilvėnas - 29.04.2011

Quote:
Originally Posted by Antonio144
Посмотреть сообщение
pawn Код:
new pFile[128];
Код:
format(pFile, sizeof(pFile), "Users/%s.ini", PlayerName(playerid));
	    		new pass[256],new pFile[128];
Not work.


Re: ERROR :/ - Raimis_R - 29.04.2011

pawn Код:
new pass[256],new pFile[128];
format(pFile, sizeof(pFile), "Users/%s.ini", PlayerName(playerid));
I think you need read wiki.sa-mp.com tutorials.