DynamicCP problem
#1

I've been making the DynamicCPs one by one and they worked.Players could enter them and get teleported to the interiors but when I finished all of them, everything compiled good but only "some" players can enter them, I myself can't.I have been trying to fix this bug for days and nothing, I have no clue whats the problem.

Here is the OnPlayerEnterDynamicCP, I am not sure the bug is here or not but I will post anything you guys think the problem is in.

PHP код:
public OnPlayerEnterDynamicCP(playeridcheckpointid)
{
    new 
tickCountResult GetTickCount(), reducedValue;
    for(new 
iMAX_CHECKPOINTi++)
    {
        if(
checkpointid == CPIndex[i][0])
        {
            
reducedValue tickCountResult pInfo[playerid][CPTime];
            if (
reducedValue 10000)
            {
                
pInfo[playerid][CPTime] = GetTickCount();
                
SetPlayerPos(playeridCPData[i][ExitLoc][0], CPData[i][ExitLoc][1], CPData[i][ExitLoc][2]);
                
SetPlayerInterior(playeridCPData[i][Interior]);
                
SetPlayerVirtualWorld(playeridCPData[i][World]);
                
Loading(playerid);
                
pInfo[playerid][LastEntered] = i;
            }
            return 
1;
        }
        if(
checkpointid == CPIndex[i][1])
        {
            
reducedValue tickCountResult pInfo[playerid][CPTime];
            if (
reducedValue 10000)
            {
                new 
sID pInfo[playerid][LastEntered];
                
pInfo[playerid][CPTime] = GetTickCount();
                
SetPlayerPos(playeridCPData[sID][EnterLoc][0], CPData[sID][EnterLoc][1], CPData[sID][EnterLoc][2]);
                
SetPlayerInterior(playerid0);
                
SetPlayerVirtualWorld(playerid0);
                
Loading(playerid);
            }
            return 
1;
        }
    }
    if(
checkpointid == JobCP[0])
    {
        
reducedValue tickCountResult pInfo[playerid][CPTime];
          if (
reducedValue 10000)
        {
            
pInfo[playerid][CPTime] = GetTickCount();
            
SetPlayerPos(playerid384.808624,173.804992,1008.382812);
            
SetPlayerInterior(playerid3);
            
SetPlayerVirtualWorld(playerid27);
        }
        return 
1;
    }
    if(
checkpointid == JobCP[1])
    {
         
reducedValue tickCountResult pInfo[playerid][CPTime];
        if (
reducedValue 10000)
        {
            
pInfo[playerid][CPTime] = GetTickCount();
            
SetPlayerPos(playerid, -1880.8790822.750535.1774);
            
SetPlayerInterior(playerid0);
            
SetPlayerVirtualWorld(playerid0);
            
        }
        return 
1;
    }
    return 
1;

and here is the dynamicCP
PHP код:
public DynamicCPs()
{
    new 
0;
    while(
MAX_CHECKPOINT)
    {
        
CPIndex[i][0] = CreateDynamicCP(CPData[i][EnterLoc][0], CPData[i][EnterLoc][1], CPData[i][EnterLoc][2], 1.5, -1, -1, -1100.0);
        
CPIndex[i][1] = CreateDynamicCP(CPData[i][ExitLoc][0], CPData[i][ExitLoc][1], CPData[i][ExitLoc][2], 1.5CPData[i][World], CPData[i][Interior], -1100.0);
        
CPLabel[i][0][0] = Create3DTextLabel("WELCOME TO"0x00FF00FFCPData[i][EnterLoc][0], CPData[i][EnterLoc][1], CPData[i][EnterLoc][2] + 0.225.001);
        
CPLabel[i][0][1] = Create3DTextLabel(CPData[i][SName], 0x0000FFFFCPData[i][EnterLoc][0], CPData[i][EnterLoc][1], CPData[i][EnterLoc][2] + 0.0525.001);
        
CPLabel[i][1][0] = Create3DTextLabel("YOU WERE AT"0x00FF00FFCPData[i][ExitLoc][0], CPData[i][ExitLoc][1], CPData[i][ExitLoc][2] + 0.27.5CPData[i][World], 1);
        
CPLabel[i][1][1] = Create3DTextLabel(CPData[i][SName], 0x0000FFFFCPData[i][ExitLoc][0], CPData[i][ExitLoc][1], CPData[i][ExitLoc][2] + 0.057.5CPData[i][World], 1);
        
i++;
    }

here is the enum is needed
PHP код:
enum CPsEnum
{
    
SID,
    
Float:EnterLoc[3],
    
Float:ExitLoc[3],
    
World,
    
Interior,
    
SName[25]

Reply
#2

BUMP!
Reply
#3

The same problem still appears, but I really appreciate the time you've given to help me .Thanks!
Reply
#4

Another thing to try use more is debug messages. Lines to simply print to the server log.

PHP код:
printf("[DEBUG] Player %i entered checkpoint %i"playerid ,checkpointid); 
Where are you getting CPIndex from?
Reply
#5

Here is the code that includes the CPIndex

PHP код:
new CPIndex[MAX_CHECKPOINT][3], Text3D:CPLabel[MAX_CHECKPOINT][3][2];
forward DynamicCPs();
public 
DynamicCPs()
{
    new 
0;
    while(
MAX_CHECKPOINT)
    {
        
CPIndex[i][0] = CreateDynamicCP(CPData[i][EnterLoc][0], CPData[i][EnterLoc][1], CPData[i][EnterLoc][2], 1.5, -1, -1, -1100.0);
        
CPIndex[i][1] = CreateDynamicCP(CPData[i][ExitLoc][0], CPData[i][ExitLoc][1], CPData[i][ExitLoc][2], 1.5CPData[i][World], CPData[i][Interior], -1100.0);
        
CPLabel[i][0][0] = Create3DTextLabel("WELCOME TO"0x00FF00FFCPData[i][EnterLoc][0], CPData[i][EnterLoc][1], CPData[i][EnterLoc][2] + 0.225.001);
        
CPLabel[i][0][1] = Create3DTextLabel(CPData[i][SName], 0x0000FFFFCPData[i][EnterLoc][0], CPData[i][EnterLoc][1], CPData[i][EnterLoc][2] + 0.0525.001);
        
CPLabel[i][1][0] = Create3DTextLabel("YOU WERE AT"0x00FF00FFCPData[i][ExitLoc][0], CPData[i][ExitLoc][1], CPData[i][ExitLoc][2] + 0.27.5CPData[i][World], 1);
        
CPLabel[i][1][1] = Create3DTextLabel(CPData[i][SName], 0x0000FFFFCPData[i][ExitLoc][0], CPData[i][ExitLoc][1], CPData[i][ExitLoc][2] + 0.057.5CPData[i][World], 1);
        
i++;
    }

Reply
#6

Look, I used the next code in my gamemode and it worked perfectly:
PHP код:
/* Variables I created by myself. */
new CPTime[MAX_PLAYERS];
new 
LastE[MAX_PLAYERS];
new 
CPIndex[25][2];
enum CPsEnum {
    
ID,
    
Float:EnterLoc[3],
    
Float:ExitLoc[3],
    
World,
    
Interior,
    
Name[31]
}
/* Your array. */
new CPData[25][CPsEnum] =
{
    
/*
        - storeID        - this is the store ID, continue the pattern.
        - checkpointLoc    - x, y, z location for entering the interior (this is also the place the player ends up being after leaving the interior)
        - exitpointLoc     - x, y, z location for leaving the interior (this is also the place the player ends up being after entering the interior)
        - virtualWorld    - this tells the server which world to throw you in, this is so you only get player markers of people who are in the same store as you.
        - interiorWorld    - this tells the server which interior to put you in.
        - storeName        - this defines the name of the store for the text labels, and robbery reports "Jake has robbed Cluckin' Bell" etc.
    */
    
{1, {-1492.7708920.12957.1875}, {10081.0352, -1761.45001151.4153}, 23"San Fierro Bank"},
    {
2, {-1616.59001122.92597.1875}, {-31.0479, -91.40851003.5469}, 318"24/7"},
    {
3, {-1662.25261299.88167.0391}, {285.6062, -40.86031000.9325}, 41"Ammunation"},
    {
4, {-1721.57711359.76267.1853}, {372.3125, -132.89161001.4922}, 55"Well Stacked Pizza"},
    {
5, {-1694.7739951.669724.8906}, {226.9353, -8.20481002.2109}, 65"Victim's Clothing"},
    {
6, {-1810.3533902.299324.8906}, {203.8098, -49.93311001.8047}, 71"Sub Urban's Clothing"},
    {
7, {-1808.2634945.561524.8906}, {372.3125, -132.89161001.4922}, 85"Well Stacked Pizza"},
    {
8, {-1912.2750828.211335.2214}, {363.4346, -74.65861001.5078}, 910"Burger Shot"},
    {
9, {-1882.2578866.503135.1719}, {161.4177, -96.45331001.8047}, 1018"Zip's Clothing"},
    {
10, {-1816.4827618.026035.1719}, {365.0151, -11.09581001.8516}, 119"Cluckin' Bell"},
    {
11, {-2269.5771, -155.962835.3203}, {774.2042, -49.74281000.5859}, 126"Cobra's Martial Arts"},
    {
12, {-2490.3750, -29.154925.6172}, {203.8098, -49.93311001.8047}, 131"Sub Urban's Clothing"},
    {
13, {-2336.2737, -166.766435.5547}, {363.4346, -74.65861001.5078}, 1410"Burger Shot"},
    {
14, {-2491.3745, -38.960125.7656}, {-204.3975, -8.69901002.2734}, 1517"Tattoo Shop"},
    {
15, {-2625.8135208.86254.6174}, {315.7365, -143.0907999.6016}, 167"Ammunation"},
    {
16, {-2571.1086246.682810.3268}, {411.6910, -22.86691001.8047}, 172"Barber Shop"},
    {
17, {-2672.3086258.70054.6328}, {365.0151, -11.09581001.8516}, 189"Cluckin' Bell"},
    {
18, {-2767.7983788.732952.7813}, {377.1708, -192.70611000.6401}, 1917"Tuff Nuts Donuts"},
    {
19, {-2523.80271216.147937.4283}, {377.1708, -192.70611000.6401}, 2017"Restaurant"},
    {
20, {-2624.42701411.91667.0938}, {-2636.78001403.4661906.4609}, 213"Jizzy's Pleasure Dome"},
    {
21, {-2356.68381008.192150.8984}, {363.4346, -74.65861001.5078}, 2210"Burger Shot"},
    {
22, {-2419.5537969.790645.2969}, {-31.0479, -91.40851003.5469}, 2318"Gas Station"},
    {
23, {-2374.7512910.115845.4453}, {207.6829, -110.65151005.1328}, 2415"Binco"},
    {
24, {-2442.7688754.470935.1719}, {-27.4370, -57.71821003.5469}, 256"Supa Save"},
    {
25, {-2553.2563,1088.7507,55.7266}, {285.6062, -40.86031000.9325}, 261"Ammunation"}
};
forward DynamicCPs();
public 
DynamicCPs()
{
    new 
0;
    while(
25)
    {
        
printf("enter: %f %f %f"CPData[i][EnterLoc][0], CPData[i][EnterLoc][1], CPData[i][EnterLoc][2]);
        
CPIndex[i][0] = CreateDynamicCP(CPData[i][EnterLoc][0], CPData[i][EnterLoc][1], CPData[i][EnterLoc][2], 1.5, -1, -1, -1100.0);
        
CPIndex[i][1] = CreateDynamicCP(CPData[i][ExitLoc][0], CPData[i][ExitLoc][1], CPData[i][ExitLoc][2], 1.5CPData[i][World], CPData[i][Interior], -1100.0);
        
/*CPLabel[i][0][0] = Create3DTextLabel("WELCOME TO", 0x00FF00FF, CPData[i][EnterLoc][0], CPData[i][EnterLoc][1], CPData[i][EnterLoc][2] + 0.2, 25.0, 0, 1);
        CPLabel[i][0][1] = Create3DTextLabel(CPData[i][SName], 0x0000FFFF, CPData[i][EnterLoc][0], CPData[i][EnterLoc][1], CPData[i][EnterLoc][2] + 0.05, 25.0, 0, 1);
        CPLabel[i][1][0] = Create3DTextLabel("YOU WERE AT", 0x00FF00FF, CPData[i][ExitLoc][0], CPData[i][ExitLoc][1], CPData[i][ExitLoc][2] + 0.2, 7.5, CPData[i][World], 1);
        CPLabel[i][1][1] = Create3DTextLabel(CPData[i][SName], 0x0000FFFF, CPData[i][ExitLoc][0], CPData[i][ExitLoc][1], CPData[i][ExitLoc][2] + 0.05, 7.5, CPData[i][World], 1);
*/
        
i++;
    }
}
public 
OnPlayerEnterDynamicCP(playeridcheckpointid)
{
    
/* You should put the condition before the loop in this case, if this is false the loop doesn't run. */
    
if((GetTickCount() - CPTime[playerid]) > 5000)
    {
        
/* You may keep this here because it'll run whenever the first time condition is true and OnPlayerEnterDynamicCP is called. */
        
CPTime[playerid] = GetTickCount();
        
        for(new 
i25i++)
        {
            if(
checkpointid == CPIndex[i][0])
            {
                
LastE[playerid] = i;
                
SetPlayerPos(playeridCPData[i][ExitLoc][0], CPData[i][ExitLoc][1], CPData[i][ExitLoc][2]);
                
SetPlayerInterior(playeridCPData[i][Interior]);
                
SetPlayerVirtualWorld(playeridCPData[i][World]);
                
//Loading(playerid);
                
return 1;
            }
            if(
checkpointid == CPIndex[i][1])
            {
                 new 
sID LastE[playerid];
                
SetPlayerInterior(playerid0);
                
SetPlayerVirtualWorld(playerid0);
                
SetPlayerPos(playeridCPData[sID][EnterLoc][0], CPData[sID][EnterLoc][1], CPData[sID][EnterLoc][2]);
               
// Loading(playerid);
                
return 1;
            }
        }
        
/*if(checkpointid == JobCP[0])
        {
            SetPlayerInterior(playerid, 3);
            SetPlayerVirtualWorld(playerid, 27);
               SetPlayerPos(playerid, 384.808624,173.804992,1008.382812);
            return 1;
        }
        if(checkpointid == JobCP[1])
        {
            SetPlayerInterior(playerid, 0);
            SetPlayerVirtualWorld(playerid, 0);
            SetPlayerPos(playerid, -1880.8790, 822.7505, 35.1774);
            return 1;
        }*/
    
}
    return 
1;

I modified it a bit to adapt it to my gamemode, but you'll understand it. I changed MAX_CHECKPOINTS to 25, you should do that also.

The time condition must look like this:
PHP код:
if((GetTickCount() - CPTime[playerid]) > 5000)
{
    
CPTime[playerid] = GetTickCount();
    
/* The rest of the code. */ 
Reply
#7

Are you using the checkpoints elsewhere in the script and not using the streamer? You can only use one or the other, not sure if that includes Filterscripts.
Reply
#8

Thanks!It's working perfectly, I appreciate it
Reply
#9

Quote:
Originally Posted by RIDE2DAY
Посмотреть сообщение
AFAIK, you can use streamed and non-streamed checkpoints at once. That's why Incognito added a "dynamic" callback.
na, they're definitely not interoperable. Mainly due to the limits that the server has, so what the plugin does, is instead of having all checkpoints shown at once, it'll only show what is closest to you.

By having 1 lot of checkpoints not using the streamer, it throws the servers relation to the plugin out, and causes things such as this.
Reply
#10

I have this other problem.The CPs work, everyone can enter them except me.Even on localhost, my friend tested it, worked for him on his localhost and the server.But I cannot enter the CPs on the localhost and server.Whats the problem?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)