Dynamic Object Loading
#1

hello,

I'm trying to make a dynamic object loading from a file function.

Code:
public LoadObjects()
{
	new string[64];
	for(new i = 1; i < MAX_OBJECT_FILES; i++)
	{
		format(string, sizeof(string), "/Objects/%d.sf", i);
		new File:ObjFile = fopen(string, io_read);
		if(fexist(string))
		{
		  new lines;
		  new objects[500];
		  while(fread(ObjFile, objects))
		  {
		    lines++;
			objects;
		  }
		}
	}
	return 1;
}
Is there any way I can load PAWN code from a file?
Reply
#2

dini or dudb?
Reply
#3

Forwarder:
Code:
forward DynUpdateStart(playerid); // freezes a player for some seconds
forward DynUpdateEnd(playerid); // unfreeze function
Add this in the last line of your script:
Code:
public DynUpdateStart(playerid)
{
TogglePlayerControllable(playerid, false); // Freeze
new string[255];
format(string, sizeof(string), "~g~Objects~n~~r~Loading");
GameTextForPlayer(playerid, string, 3000, 6);
PlayerPlaySound(playerid, 1056, 0.0, 0.0, 0.0);
SetTimerEx("DynUpdateEnd", 2000, 0,"e",playerid);
return 1;
}

public DynUpdateEnd(playerid)
{
TogglePlayerControllable(playerid, true); // Unfreeze
new string[255];
format(string, sizeof(string), "~g~Objects~n~~r~Loaded!");
GameTextForPlayer(playerid, string, 3000, 6);
PlayerPlaySound(playerid, 1056, 0.0, 0.0, 0.0);
return 1;
}
Then Add this to all Teleports Commands
EXAMPLE:
Code:
	if (strcmp("/example", cmdtext, true, 10) == 0)
	{
		SetPlayerPos(playerid,-239.1891,1203.2264,19.5938);
		SetVehiclePos(playerid,-239.1891,1203.2264,19.5938);
		SendClientMessage(playerid, 0xAAAAAAAA, "EXAMPLE TELE");
		DynUpdateStart(playerid);
		return 1;
	}
Add all this line on all Teles CMDS:
Code:
DynUpdateStart(playerid);
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)