SA-MP Forums Archive
DynamicCP help - 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: DynamicCP help (/showthread.php?tid=609088)



DynamicCP help - N0FeaR - 08.06.2016

When i enter NewsCP[1] it keep giving me the same checkpoint it won't move on to number 2.


PHP код:
public OnPlayerEnterDynamicCP(playeridcheckpointid)
{
    if(
checkpointid == NewsCP[0])
    {
        
DestroyDynamicCP(NewsCP[0]);
        
SendServerMessage(playerid"Go to the next checkpoint");
        
NewsCP[1] = CreateDynamicCP(1910.5698,-1127.7013,24.3153,3, -1, -1playerid500.0);
        return 
1;
    }
    if(
checkpointid == NewsCP[1])
    {
        
DestroyDynamicCP(NewsCP[1]);
        
SendServerMessage(playerid"Go to the next checkpoint");
        
NewsCP[2] = CreateDynamicCP(1922.7101,-1127.5437,24.6200,3, -1, -1playerid500.0);
        return 
1;
    }
    if(
checkpointid == NewsCP[2])
    {
        
DestroyDynamicCP(NewsCP[2]);
        
SendServerMessage(playerid"Go to the next checkpoint");
        
NewsCP[3] = CreateDynamicCP(1935.3966,-1127.6398,24.9208,3, -1, -1playerid500.0);
        return 
1;
    }
    if(
checkpointid == NewsCP[3])
    {
        
DestroyDynamicCP(NewsCP[3]);
        
SendServerMessage(playerid"Go to the next checkpoint");
        
NewsCP[4] = CreateDynamicCP(1955.3051,-1127.9552,25.4240,3, -1, -1playerid100.0);
        return 
1;
    }
    if(
checkpointid == NewsCP[4])
    {
        
DestroyDynamicCP(NewsCP[4]);
        
SendServerMessage(playerid"Go to the next checkpoint");
        
NewsCP[5] = CreateDynamicCP(1999.3730,-1129.3199,25.0862,3, -1, -1playerid500.0);
        return 
1;
    }
    if(
checkpointid == NewsCP[5])
    {
        
DestroyDynamicCP(NewsCP[5]);
        
SendServerMessage(playerid"Go to the next checkpoint");
        
NewsCP[6] = CreateDynamicCP(2023.0809,-1128.4589,24.4188,3, -1, -1playerid500.0);
        return 
1;
    }
    if(
checkpointid == NewsCP[6])
    {
        
DestroyDynamicCP(NewsCP[6]);
        
SendServerMessage(playerid"Go to the next checkpoint");
        
NewsCP[7] = CreateDynamicCP(2052.1731,-1127.4674,23.5879,3, -1, -1playerid500.0);
        return 
1;
    }
    if(
checkpointid == NewsCP[7])
    {
        
DestroyDynamicCP(NewsCP[7]);
        
SendServerMessage(playerid"Go to the next checkpoint");
        
NewsCP[8] = CreateDynamicCP(2077.6431,-1122.7905,23.6244,3, -1, -1playerid500.0);
        return 
1;
    }
    if(
checkpointid == NewsCP[8])
    {
        
DestroyDynamicCP(NewsCP[8]);
        
SendServerMessage(playerid"Go to the next checkpoint");
        
NewsCP[9] = CreateDynamicCP(2350.9204,-1162.5967,26.9414, -1, -1playerid500.0);
        return 
1;
    }
    if(
checkpointid == NewsCP[9])
    {
        
DestroyDynamicCP(NewsCP[9]);
        
SendServerMessage(playerid"Go to the next checkpoint");
        
NewsCP[10] = CreateDynamicCP(2366.5081,-1197.6523,26.9864,3, -1, -1playerid500.0);
        return 
1;
    }
    if(
checkpointid == NewsCP[10])
    {
        
DestroyDynamicCP(NewsCP[10]);
        
SendServerMessage(playerid"Go to the next checkpoint");
        
NewsCP[11] = CreateDynamicCP(2376.5500,-1275.7950,23.5722,3, -1, -1playerid500.0);
        return 
1;
    }
    if(
checkpointid == NewsCP[11])
    {
        
DestroyDynamicCP(NewsCP[11]);
        
SendServerMessage(playerid"Go to the next checkpoint");
        
NewsCP[12] = CreateDynamicCP(2378.4927,-1325.7792,23.5584,3, -1, -1playerid500.0);
        return 
1;
    }
    if(
checkpointid == NewsCP[12])
    {
        
DestroyDynamicCP(NewsCP[12]);
        
GivePlayerMoney(playerid90);
        
GameTextForPlayer(playerid"~p~ You delivered all papers, you got ~r~90$ ~p~for that"30004);
        
SetPVarInt(playerid"DeliveringNP"0);
        return 
1;
    }
    return 
1;




Re: DynamicCP help - Misiur - 08.06.2016

Basically this is what happens:
pawn Код:
NewsCP[1] = CreateDynamicCP(1910.5698,-1127.7013,24.3153,3, -1, -1, playerid, 500.0); //NewsCP[1] == 1
DestroyDynamicCP(NewsCP[1]);
NewsCP[2] = CreateDynamicCP(1910.5698,-1127.7013,24.3153,3, -1, -1, playerid, 500.0); //NewsCP[2] == 1 BUT NewsCP[1] still == 1
You have to combine both DestroyDynamicCp with something like:
pawn Код:
DestroyDynamicCP(NewsCP[0]);
NewsCP[0] = -1; //It no longer will answer to NewsCP[0] == 1



Re: DynamicCP help - Konstantinos - 08.06.2016

If I were you, I'd create those checkpoints when the server starts and I would show/hide the checkpoints using Streamer_AppendArrayData/Streamer_RemoveArrayData respectively.