Checkpoint bug.
#1

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

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...
Reply
#3

Changed all the [playerid] to [i]
Reply
#4

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

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

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

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?
Reply
#7

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
Reply
#8

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

Did you update the OnPlayerEnterDynamicCP code too?
Reply
#10

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);
        }
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)