Dynamic Object Loading - 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: Dynamic Object Loading (
/showthread.php?tid=117630)
Dynamic Object Loading -
sant - 01.01.2010
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?
Re: Dynamic Object Loading -
[HiC]TheKiller - 01.01.2010
dini or dudb?
Re: Dynamic Object Loading -
[WSM]Deadly_Evil - 01.01.2010
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);