Question about DynamicCP's!
#1

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])
        }
    }
}
Reply
#2

Код:
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])
        }
    }
}
Reply
#3

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)!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)