Question about DynamicCP's! - 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: Question about DynamicCP's! (
/showthread.php?tid=532628)
Question about DynamicCP's! -
Juvanii - 19.08.2014
My DynamicCP's in the script has reached about
200 CP's, so it took so long to script what would this CP does like
OnPlayerEnterDynamicCP (1400 Lines),
OnPlayerLeaveDynamicCP (1000 Lines) and so on...
My question is: can i make it in easiest way than this? just like save the CP's into a file and looping it by 5 -6 Lines for what it does?
Does it cause any bugs if i do it just like conflict the cps to eachothers?
Example:
pawn Код:
public OnPlayerEnterDynamicCP(playerid,checkpointid)
{
for(new i = 0; i < MAX_CHECKPOINTS; i++)
{
if(checkpointid == "the id or the name that i store it in the file") //let's say the name is Ammunation
{
SetPlayerPos(playerid,CPInfo[checkpointid][CPx],CPInfo[checkpointid][CPy],CPInfo[checkpointid][CPz])
}
}
}
Re: Question about DynamicCP's! -
VishvaJeet - 19.08.2014
Код:
new check[100];
check[0] = CreateDynamicCP(.....);
check[1] = CreateDynamicCP(.....);
check[2] = CreateDynamicCP(.....);
.
.
.
check[99] = CreateDynamicCP(.....);
Код:
public OnPlayerEnterDynamicCP(playerid,checkpointid)
{
for(new i = 0; i < 100; i++)
{
if(checkpointid == check[i])
{
SetPlayerPos(playerid,CPInfo[checkpointid][CPx],CPInfo[checkpointid][CPy],CPInfo[checkpointid][CPz])
}
}
}
Re: Question about DynamicCP's! -
Juvanii - 19.08.2014
No this won't work! CPInfo[i][CPx]... are not defined.
i want to make the CP's in a file in Scriptfile folder just like "Users" folder.
Your method will take the same lines for defining the CP's (200 - 300 Lines)!