SA-MP Forums Archive
Checkpoint bug. - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Checkpoint bug. (/showthread.php?tid=203764)



Checkpoint bug. - Haydz - 27.12.2010

These checkpoints only seem to work for id 0 and nobody eles.

Thanks in advance.
pawn Код:
//onplayerconnect
ammuentrance[playerid] = CreateDynamicCP(-2024.0315, 395.4877, 35.1719, 1.0, -1,-1, -1, 20.0);
ammuexit[playerid] = CreateDynamicCP(284.7085, -41.5060, 1001.5156, 1.0, -1,-1, -1, 20.0);
gunshop[playerid] = CreateDynamicCP(295.5286, -38.5149, 1001.5156, 1.0, -1,-1, -1, 20.0);

public OnPlayerEnterDynamicCP(playerid, checkpointid)
{
    if(checkpointid == ammuentrance[playerid])
    {
        if(walkinammu[playerid] == 1)
        {
            SetPlayerPos(playerid, 286.148986,-40.644397,1001.515625);
            SetPlayerInterior(playerid, 1);
            inammu[playerid] = 1;
            walkinammu[playerid] = 0;
        }
        else
        {
            SendClientMessage(playerid, COLOR_RED,"You need to wait 3 mins before walking into ammu-nation again!");
        }
    }
    if(checkpointid == ammuexit[playerid])
    {
        if(boughtguns[playerid] == 1)
        {
            SetPlayerInterior(playerid, 0);
            inammu[playerid] = 0;
            walkinammu[playerid] = 0;
            leaveammu(playerid);
            SetTimerEx("walkinammutimer", 180000, false, "d" , playerid);
        }
        else
        {
            SendClientMessage(playerid, COLOR_RED,"You cannot go out to battle with no weapons!");
        }
    }
    if(checkpointid == gunshop[playerid])
    {
        SendClientMessage(playerid, COLOR_WHITE,"Please choose your weapons!");
        ShowPlayerDialog(playerid,GUNSHOP,DIALOG_STYLE_LIST,"Weapon Store","Shotguns\nMachine Guns","Buy", "Cancel");
    }
    return 1;
}



Re: Checkpoint bug. - Babul - 27.12.2010

since you are basically creating 500 checkpoints, the CP[0] will be assigned to the first player (0 i guess ^^). so thats the first checkpoint triggered when you enter "all checkpoints" at the same position, maybe only the CP[0] gets streamed as the only (first) one. idk the sorting order of the streamer...
reason: you created them for all players each time in connect() , using -1. try using playerid there instead?
Код:
//onplayerconnect
ammuentrance[playerid] = CreateDynamicCP(-2024.0315, 395.4877, 35.1719, 1.0, -1,-1, playerid, 20.0);
ammuexit[playerid] = CreateDynamicCP(284.7085, -41.5060, 1001.5156, 1.0, -1,-1, playerid, 20.0);
gunshop[playerid] = CreateDynamicCP(295.5286, -38.5149, 1001.5156, 1.0, -1,-1, playerid, 20.0);
just recognized that, idk if it works...


Re: Checkpoint bug. - WillyP - 27.12.2010

Changed all the [playerid] to [i]


Re: Checkpoint bug. - Haydz - 27.12.2010

Doesn't seem to work, thanks for trying anyways.

edit: didn't see the post above, trying that now.


Re: Checkpoint bug. - [03]Garsino - 27.12.2010

Why are you using player variables? :S Wouldn't it be better to use global ones?


Re: Checkpoint bug. - Haydz - 28.12.2010

Quote:
Originally Posted by [03]Garsino
Посмотреть сообщение
Why are you using player variables? :S Wouldn't it be better to use global ones?
I would say so, care to give an example?


Re: Checkpoint bug. - [03]Garsino - 28.12.2010

pawn Код:
// Create these in OnGameModeInit
new ammuentrance = CreateDynamicCP(-2024.0315, 395.4877, 35.1719, 1.0, -1,-1, -1, 20.0);
new ammuexit = CreateDynamicCP(284.7085, -41.5060, 1001.5156, 1.0, -1,-1, -1, 20.0);
new gunshop = CreateDynamicCP(295.5286, -38.5149, 1001.5156, 1.0, -1,-1, -1, 20.0);
// or if you're going to have more:

#define AMOUNT_OF_AMMUNATIONS (2)
new ammuentrance[AMOUNT_OF_AMMUNATIONS];
ammuentrance[0] = CreateDynamicCP(-2024.0315, 395.4877, 35.1719, 1.0, -1,-1, -1, 20.0);
ammuentrance[1] = CreateDynamicCP(1337, 1337,  1337, 1.0, -1,-1, -1, 20.0);
// etc



Re: Checkpoint bug. - Haydz - 28.12.2010

Your code doesn't seem to work, maybe it's something eles in the script?


Re: Checkpoint bug. - [03]Garsino - 28.12.2010

Did you update the OnPlayerEnterDynamicCP code too?


Re: Checkpoint bug. - The_Gangstas - 28.12.2010

CreateDynamicCP(1337, 1337, 1337, 1.0, -1,-1, playerid, 20.0);

-1 to playerid

or just make it under ongamemodeinit with -1 then use onplayerenterdynamiccp.. simple, example

pawn Код:
new
    Bar_FortCarson_Enter;

Bar_FortCarson_Enter=CreateDynamicCPEx(-180.5088,1088.2109,19.7422, 1.5,0,0,-1,60.0,"Bar");

        if(checkpointid == Bar_FortCarson_Enter)
        {
            SetPlayerPos(playerid,503.6708,-72.2202,998.7578);
            SetPlayerVirtualWorld(playerid,1);
            SetCameraBehindPlayer(playerid);
            SetPlayerInterior(playerid,11);
        }