SA-MP Forums Archive
Whats bad on this script? - 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: Whats bad on this script? (/showthread.php?tid=196516)



Whats bad on this script? - universe - 05.12.2010

I'm working on a script catching the scripts from the wiki, and editing them and trying to understand. When i start the server with my gm it says, runtime eror 22 no index or something like that, whats bad?

ERORR: Script[gamemodes/learn.amx]: Run time error 20: "Invalid index parameter (bad entry point)"

Quote:

/*--------------------------------- Includes ---------------------------------*/
#include <a_samp>
/*--------------------------------- End Includes -----------------------------*/




/*--------------------------------- TextDraws Id's ---------------------------*/

new Text:hello;

/*--------------------------------- End TextDraws Id's -----------------------*/

public OnGameModeInit()
{

hello = TextDrawCreate(240.0,580.0," Hello Player!");
TextDrawColor(hello,0x000000FF);
return 1;
}

public OnPlayerConnect(playerid)
{
TextDrawShowForPlayer(playerid,hello);
return 1;
}




Re: Whats bad on this script? - universe - 05.12.2010

BUMP - URGENT!


Re: Whats bad on this script? - fangoth1 - 05.12.2010

hmm let me look for amin


Re: Whats bad on this script? - Think - 05.12.2010

add main() { } to your script, every script needs it


Re: Whats bad on this script? - universe - 05.12.2010

i've added,

Quote:

main()
{
print("Learn Pawn Project - Simple v1");
}

it prints on the samp-server.exe, but my TextDraw isn't show, also i think i must define a spawn pos, how can i do that?


Re: Whats bad on this script? - scripter1 - 05.12.2010

I think your TextDraw coordinates are off the screen. Use 80 & 100 and see if it comes up.


Re: Whats bad on this script? - Think - 05.12.2010

By adding a AddPlayerClass line @ OnGameModeInit

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


Re: Whats bad on this script? - universe - 05.12.2010

Thanks for spawn, also i changed into:

Quote:

#include <a_samp>

main()
{
print("Learn Pawn Project - Simple v1");

}

public OnPlayerConnect(playerid)
{
GameTextForPlayer(playerid,"~w~Hello: ~r~DeatMatch GameMode",5000,5);
return 1;
}


public OnPlayerSpawn(playerid)
{
SetPlayerInterior(playerid,0);
TogglePlayerClock(playerid,0);
return 1;
}

Now is working when i loggin, but isn't the same Text as Textdraw or?