Adding custom mapping to server
#1

Hey all, I have a question. I did some custom mapping on a fire house for my server, i have no problem getting it in game, but I wanted to make my game mode a little nicer looking. Instead of posting my code in my game mode, is there a function i can use that will read the code from a separate file such as an include? And if so could I see an example? I don't see why it wouldn't work, i'm just not that great at scripting yet, haha. Also, i started with a blank gamemode, I added in some edits, now when i go to start the server, i get this message;

Script[gamemodes/test.amx]: Run time error 20: "Invalid index parameter <bad entry point>"

Any idea what i did wrong?

Thanks, bare with me, I'm attempting to learn on my own.
Reply
#2

You can script a maploader and read from file but that is really not needed until you have a lot of objects 10000+.
I would just use y_hooks and keep making a new include for every map.

https://sampforum.blast.hk/showthread.php?tid=166016

Create a new folder in your gamemode folder called maps and put your includes in there then all you need to do is add them to your gamemode script like this.

pawn Код:
#include "maps\map1.pwn"
#include "maps\map2.pwn"
#include "maps\map3.pwn"
#include "maps\map4.pwn"
This is by far the best way to organize your maps if one is a problem all you need to do is comment it out without any other effort which is a good thing.

As for that error you tried to use a function that didn't exist perhaps you didn't load a plugin ?
Reply
#3

Thats exactly what I was looking for, +rep, thanks
Reply
#4

Make a filterscript with the mapping. If you have any RemoveBuildingForPlayer just add them below your OnPlayerConnect in your main GM. Its the easiest method and best scripter-friendly since you can just comment the stuff and then when you wanna remove something, enter it and remove it.


EDIT: if you are using MTA Map editor, try using this FS that will make it all easier.
https://sampforum.blast.hk/showthread.php?tid=176461
Reply
#5

Quote:
Originally Posted by SeniorGamer
Посмотреть сообщение
Make a filterscript with the mapping. If you have any RemoveBuildingForPlayer just add them below your OnPlayerConnect in your main GM. Its the easiest method and best scripter-friendly since you can just comment the stuff and then when you wanna remove something, enter it and remove it.
Filterscripts are a bad choice, your fragmenting the gamemode with your suggestion this is not a good thing and leads to habit of using too many filterscripts. Creating a include with hooking is really no different than a filterscript except you are encapsulating the code in it's own module to be compiled into the gamemode.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)