Will it work? - 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)
+--- Thread: Will it work? (
/showthread.php?tid=616932)
Will it work? -
Adarsh007 - 12.09.2016
I am creating a Filterscript Exit System, So i can unload manually everytime,
So, My question is, After the Filterscript is re-loaded,
This Loop will see if any player is connected if yes then a timer will be placed to load its ini data,
(Don't require password)
I make this -
INI_ParseFile(UserPath(i), "LoadUser_%s", .bExtra = true,
.extra = i);
Shoud i remove the .extra =i ?? or what? or it will still work?
and this is Original - OnPlayerConnect
INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true,
.extra = playerid);
And here What i did -
public OnFilterScriptInit()
Код:
for(new i=0; i<MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i)) // Change to your systems
{
SetTimerEx("LoadMe", 2500, false, "i", i);
}
}
Function of Timer -
Код:
forward LoadMe(i);
public LoadMe(i)
{
if(fexist(UserPath(i)))
{
INI_ParseFile(UserPath(i), "LoadUser_%s", .bExtra = true, .extra = i);
}
else
{
new INI:File = INI_Open(UserPath(i));
INI_SetTag(File,"data");
INI_WriteInt(File,"Facrank",0); //sets the players faction rank to none when they connect for the first time
INI_Close(File);
}
RemoveBuildingForPlayer(i, 1232, -1506.7969, 662.8672, 8.8047, 0.25);
RemoveBuildingForPlayer(i, 1232, -1486.3281, 680.3906, 8.8047, 0.25);
RemoveBuildingForPlayer(i, 1232, -1526.1641, 726.8125, 8.8047, 0.25);
RemoveBuildingForPlayer(i, 1232, -1486.3281, 729.2344, 8.8047, 0.25);
SendClientMessage(i, COLOR_DODGERBLUE, "{800000}Your faction data has been loaded!");
return 1;
}