Maps from external file
#4

do itlike this,

in your external file, put all your createDynamicObject's in a public.. let's call it 'Objects'
then again, create another public called 'RemoveObj' in your external file and put all the RemoveBuilding's inside.

now just save that file and include it as always ontop of your script.
What we do now is just make use of the function 'CallLocalFunction'
to call these two public functions we've created.
call the one for objects in OnGamemodeInit and the other one for remove in OnPlayerConnect. easy as that

would look like this:

external file
pawn Код:
forward Objects();
public Objects()
{
    CreateDynamicObject(//...
    //and so on
    return 1;//you could also use the return value to check if the map was loaded successfully or not
}

forward RemoveObj(playerid);
public RemoveObj(playerid)
{
    RemoveBuildingForPlayer(playerid,//...
    //and so on
    return 1;
}
Gamemode
pawn Код:
//include it at the top as always

public OnGamemodeInit()
{
    //now we just call our function
    CallLocalFunction("Objects","");//no params here
    return 1;
}

public OnPlayerConnect(playerid)
{
    //jsut calling it again
    CallLocalFunction("RemoveObj","d",playerid);//we also "deliver" the playerid to that function
    return 1;
}
side note: we use public cuz we have to make it "public" so that it can be accessed from outside.
stock won't work, you can't call it using CallLocalFunction
Reply


Messages In This Thread
Maps from external file - by DLR - 25.04.2014, 15:47
Re: Maps from external file - by biker122 - 25.04.2014, 15:54
Re: Maps from external file - by Vince - 25.04.2014, 16:26
Re: Maps from external file - by CutX - 25.04.2014, 16:37
Re: Maps from external file - by Vince - 25.04.2014, 18:24
Re: Maps from external file - by DLR - 27.04.2014, 10:47

Forum Jump:


Users browsing this thread: 1 Guest(s)