SA-MP Forums Archive
I need help on scripting. - 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: I need help on scripting. (/showthread.php?tid=498232)



I need help on scripting. - ChromeMenu - 02.03.2014

Hello, this is my first thread so first time doing this, so bare with me.

I am getting am error from the /spawnnpc command on vortex.

Error:
Quote:

error 017: undefined symbol "file_actually_exists"

Full script:
Код:
command(spawnnpc, playerid, params[])
{
	new string[128], NPCName[128];
	if(sscanf(params, "z", NPCName))
	{
	    if(Player[playerid][AdminLevel] >= 1)
	    {
			SendClientMessage(playerid, WHITE, "SYNTAX: /spawnnpc [script name]");
		}
	}
	else
	{
	    if(Player[playerid][AdminLevel] >= 5)
	    {
		    format(string, sizeof(string), "npcmodes/recordings/%s.rec", NPCName);

		    if(file_actually_exists(string))
		    {
		        format(string, sizeof(string), "NPC_%d", NPCs+1);
		        ConnectNPC(string, NPCName);
		    }
		    else
		    {
		        SendClientMessage(playerid, WHITE, "That recording / script doesn't exist.");
		    }
	    }
	}
	return 1;
}



Re: I need help on scripting. - Clad - 02.03.2014

Define this
PHP код:
file_actually_exists 



Re: I need help on scripting. - ChromeMenu - 02.03.2014

I did and now I get this

Код:
 error 033: array must be indexed (variable "string")
From this line
Код:
if(file_actually_exists(string))



Re: I need help on scripting. - ChromeMenu - 02.03.2014

Anything?


Re: I need help on scripting. - ChromeMenu - 02.03.2014

Bump


Re: I need help on scripting. - BKarner - 02.03.2014

How have you defined "file_actually_exists"?


Re: I need help on scripting. - ChromeMenu - 02.03.2014

PHP код:
#define                 file_actually_exists 
That's what I have


Re: I need help on scripting. - Conroy - 02.03.2014

https://sampwiki.blast.hk/wiki/Fexist


Re: I need help on scripting. - BKarner - 03.03.2014

Quote:
Originally Posted by ChromeMenu
Посмотреть сообщение
PHP код:
#define                 file_actually_exists 
That's what I have
Right, now it's found "file_actually_exists" It's taking that file_actually_exists has a parameter, but you've defined it as nothing. What it's looking for is for you to define it as a function using stock or public. What Conroy has given you would be the most viable change, or you could create a function which requires a parameter.