SetPlayerCheckpoint
#1

SetPlayerCheckpoint Not Working
i removed the dynamic checkpoints in the streamer
got the streamer include no error / warning in compiling
pawn Код:
enum hInfo
{
    Float:h_cpx,
    Float:h_cpy,
    Float:h_cpz,
    h_cpsize,
    h_cptype,
    h_cpbustype,
    h_cpmarker,
    Float:h_cp_radius,
    Float:h_entry_x,
    Float:h_entry_y,
    Float:h_entry_z,
    Float:h_entry_a,
    h_entry_i,
    h_entry_w,
    Float:h_exit_x,
    Float:h_exit_y,
    Float:h_exit_z,
    Float:h_exit_a,
    h_HouseIntName[256],
    h_HouseExtName[256]

};
new pInfo[MAX_PLAYERS][PlayerInfo];
new HouseInfo[][hInfo] =
{
    {2463.996337, 2244.893066, 10.820312,       2, CP_TYPE_ENTRY,   BUS_TYPE_BANK,  52, 30.0        ,2309.408447, -15.663831, 26.749565, 277.688171     ,0,310  ,2463.949462, 2241.169433, 10.820312, 179.010665,   "The Bank" ,"Roca Escalante"},
    {2306.059814, -16.113458, 26.749565,        2, CP_TYPE_EXIT,    0,  0, 4.0   ,0.0,0.0,0.0,0.0       ,0,0    ,0.0,0.0,0.0,0.0,   "Bank Exit" ,"Exterior N/A"}
};
pawn Код:
forward checkpointUpdate();
public checkpointUpdate()
{
    for(new i; i < GetMaxPlayers(); i++)
    {

        if(IsPlayerConnected(i) && pInfo[i][pSpawn] == 1)
        {


                        new j = GetClosestCheckpoint(i);


                        if (j > 0)
                        {

                        if(pInfo[i][pCheckpoint] != j)
                        {

                        pInfo[i][pCheckpoint] = j;
                        SetPlayerCheckpoint(i,HouseInfo[j][h_cpx], HouseInfo[j][h_cpy], HouseInfo[j][h_cpz],HouseInfo[j][h_cpsize]);


                        //format(string, sizeof(string), "Checkpoint %d",j);
                        //SendClientMessage(i, COLOR_YELLOW, string);
                        }

                        }else{

                        if (pInfo[i][pCheckpoint] != 0)
                        {
                        pInfo[i][pCheckpoint] = 0;
                        DisablePlayerCheckpoint(i);
                        }

                        }

        }//End Of For connection and spawn check

    }//End Of For Loop

    //return 1;
}
ongamemodeinit
pawn Код:
CheckPointTimer = SetTimerEx("checkpointUpdate", 1000, 1, "d", "d");
Reply
#2

How can i edit an plugin want to remove the dymnic cp from stremer
Reply
#3

The streamer won't interfere with SetPlayerCheckpoint. So there's no need to edit it, and editing plugins/includes isn't recommended as they can become unstable if they don't have the right data.

And firstly, you don't need to use SetTimerEx if the function doesn't even use parameters..
pawn Код:
CheckPointTimer = SetTimer("checkpointUpdate", 1000, true);
Reply
#4

Still not working
Reply
#5

Maybe you try using IsPlayerInRangeOfPoint and also make automatic dialog, it's just suggestion for you. I try later repair your bugged script.
Reply
#6

pawn Код:
stock GetClosestCheckpoint(playerid)
{
    //new Float:dis = 20.0;
    new Float:tmpdis;
    new cpid = 0;
    for(new i = 0; i < sizeof(HouseInfo); i++)
    {
            GetDistanceToPoint(playerid,HouseInfo[i][h_cpx], HouseInfo[i][h_cpy], HouseInfo[i][h_cpz],tmpdis);
            if(tmpdis < HouseInfo[i][h_cp_radius])
            {
                //dis = tmpdis;
                cpid = i;
            }
    }
    return cpid;
}
pawn Код:
stock GetDistanceToPoint(playerid,Float:x,Float:y,Float:z,&Float:dis)
{
    new Float:x1,Float:y1,Float:z1;
    GetPlayerPos(playerid,x1,y1,z1);
    dis=floatsqroot(floatpower(floatabs(floatsub(x,x1)),2)+floatpower(floatabs(floatsub(y,y1)),2)+floatpower(floatabs(floatsub(z,z1)),2));
    return 1;
}
some other stocks that i used in it
Reply
#7

pawn Код:
forward checkpointUpdate();
public checkpointUpdate()
{
    for(new i = 0; i < GetMaxPlayers(); i++)
    {
        if(!IsPlayerConnected(i)) continue;
        if(!pInfo[i][pSpawn]) continue;
        new j = GetClosestCheckpoint(i);
        if(j)
        {
            if(pInfo[i][pCheckpoint] != j)
            {
                pInfo[i][pCheckpoint] = j;
                SetPlayerCheckpoint(i, HouseInfo[j][h_cpx], HouseInfo[j][h_cpy], HouseInfo[j][h_cpz], HouseInfo[j][h_cpsize]);
                //format(string, sizeof(string), "Checkpoint %d",j);
                //SendClientMessage(i, COLOR_YELLOW, string);
            }
        }
        else
        {
            if(pInfo[i][pCheckpoint])
            {
                pInfo[i][pCheckpoint] = 0;
                DisablePlayerCheckpoint(i);
            }
        }
    }
    return 1;
}

stock GetClosestCheckpoint(playerid)
{
    new Float:tmpdis, Float:curdis = 9000.0, cpid = 0;
    for(new i = 0; i < sizeof(HouseInfo); i++)
    {
        GetDistanceToPoint(playerid, HouseInfo[i][h_cpx], HouseInfo[i][h_cpy], HouseInfo[i][h_cpz], tmpdis);
        if(tmpdis < HouseInfo[i][h_cp_radius])
        {
            if(tmpdis < curdis)
            {
                curdis = tmpdis;
                cpid = i;
            }
        }
    }
    return cpid;
}
I don't actually know if this will help, but this looks right to me.
Reply
#8

didn't work as i said streamer might be interfering ??
Reply
#9

You may just need to use CreateDynamicCP for the specific playerid, then use OnPlayerEnterDynamicCP.
Reply
#10

So How Can I Use the same way to do that because these are 3 Checkpoints but i am gonna add more and it will be too long this way
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)