Checkpoint problem
#1

hi there i want to ask
im making a checkpoint system for my server

this is my code
pawn Код:
public OnPlayerEnterCheckpoint(playerid)
{
     //usa
    new nama[MAX_PLAYER_NAME];
    GetPlayerName(playerid, nama, sizeof(nama));
    new text[128];
    if(IsCapturing[playerid][usapro] == 1)
    {
        if(IsPlayerInVehicle(playerid, usapro))
        {
            DisablePlayerCheckpoint(playerid);
            IsCapturing[playerid][usapro] = 0;
            format(text, sizeof(text), "%s has captured America prototype for his team!", nama);
            SendClientMessageToAll(COLOR_ORANGE, text);
            RemovePlayerFromVehicle(playerid);
            SendClientMessage(playerid, COLOR_GREEN, "Congratulations! You got +3 score and +10000 cash!");
            GivePlayerMoney(playerid, 10000);
            SetVehicleToRespawn(usapro);
            RecentlyCaptured[usapro] = 1;
            SetTimer("usatime", 480000, false);
            SetPlayerScore(playerid, GetPlayerScore(playerid)+3);
            TogglePlayerAllDynamicCPs(playerid, 1);

        }
        else
        {
            SendClientMessage(playerid, COLOR_RED, "You're not in the America Prototype.");
        }
    }

    //europe
    if(IsCapturing[playerid][europro] == 1)
    {
        if(IsPlayerInVehicle(playerid, europro))
        {
            DisablePlayerCheckpoint(playerid);
            IsCapturing[playerid][europro] = 0;
            format(text, sizeof(text), "%s has captured Europe prototype for his team!", nama);
            SendClientMessageToAll(COLOR_ORANGE, text);
            RemovePlayerFromVehicle(playerid);
            SendClientMessage(playerid, COLOR_GREEN, "Congratulations! You got +3 score and +10000 cash!");
            GivePlayerMoney(playerid, 10000);
            SetVehicleToRespawn(europro);
            RecentlyCaptured[europro] = 1;
            SetTimer("eurotime", 480000, false);
            SetPlayerScore(playerid, GetPlayerScore(playerid)+3);
            TogglePlayerAllDynamicCPs(playerid, 1);

        }
        else
        {
            SendClientMessage(playerid, COLOR_RED, "You're not in the Europe Prototype.");
        }
    }
    //asia
    if(IsCapturing[playerid][asiapro] == 1)
    {
        if(IsPlayerInVehicle(playerid, asiapro))
        {
            DisablePlayerCheckpoint(playerid);
            IsCapturing[playerid][asiapro] = 0;
            format(text, sizeof(text), "%s has captured Asia prototype for his team!", nama);
            SendClientMessageToAll(COLOR_ORANGE, text);
            RemovePlayerFromVehicle(playerid);
            SendClientMessage(playerid, COLOR_GREEN, "Congratulations! You got +3 score and +10000 cash!");
            GivePlayerMoney(playerid, 10000);
            SetVehicleToRespawn(asiapro);
            RecentlyCaptured[asiapro] = 1;
            SetTimer("asiatime", 480000, false);
            SetPlayerScore(playerid, GetPlayerScore(playerid)+3);
            TogglePlayerAllDynamicCPs(playerid, 1);

        }
        else
        {
            SendClientMessage(playerid, COLOR_RED, "You're not in the Asia Prototype.");
        }
    }
    //africa
    if(IsCapturing[playerid][africapro] == 1)
    {
        if(IsPlayerInVehicle(playerid, africapro))
        {
            DisablePlayerCheckpoint(playerid);
            IsCapturing[playerid][africapro] = 0;
            format(text, sizeof(text), "%s has captured Africa prototype for his team!", nama);
            SendClientMessageToAll(COLOR_ORANGE, text);
            RemovePlayerFromVehicle(playerid);
            SendClientMessage(playerid, COLOR_GREEN, "Congratulations! You got +3 score and +10000 cash!");
            GivePlayerMoney(playerid, 10000);
            SetVehicleToRespawn(africapro);
            RecentlyCaptured[africapro] = 1;
            SetTimer("africatime", 480000, false);
            SetPlayerScore(playerid, GetPlayerScore(playerid)+3);
            TogglePlayerAllDynamicCPs(playerid, 1);

        }
        else
        {
            SendClientMessage(playerid, COLOR_RED, "You're not in the Africa Prototype.");
        }
    }
    //australia
    if(IsCapturing[playerid][auspro] == 1)
    {
        if(IsPlayerInVehicle(playerid, auspro))
        {
            DisablePlayerCheckpoint(playerid);
            IsCapturing[playerid][auspro] = 0;
            format(text, sizeof(text), "%s has captured Australia prototype for his team!", nama);
            SendClientMessageToAll(COLOR_ORANGE, text);
            RemovePlayerFromVehicle(playerid);
            SendClientMessage(playerid, COLOR_GREEN, "Congratulations! You got +3 score and +10000 cash!");
            GivePlayerMoney(playerid, 10000);
            SetVehicleToRespawn(auspro);
            RecentlyCaptured[auspro] = 1;
            SetTimer("austime", 480000, false);
            SetPlayerScore(playerid, GetPlayerScore(playerid)+3);
            TogglePlayerAllDynamicCPs(playerid, 1);

        }
        else
        {
            SendClientMessage(playerid, COLOR_RED, "You're not in the Australia Prototype.");
        }
    }
    return 1;
}
but when i enter the checkpoint it doesnt respond anything (no respond)

and i got this error from crashdetect
Quote:

[debug] #0 0015bc48 in public Streamer_OnPlayerEnterCP (0) from GM.amx
[00:36:57] [debug] #1 native CallLocalFunction () from samp-server.exe
[00:36:57] [debug] #2 0001774c in ?? (0) from GM.amx
[00:36:57] [debug] #3 00006880 in public OnPlayerEnterCheckpoint (0) from GM.amx
[00:37:37] [debug] Run time error 4: "Array index out of bounds"
[00:37:37] [debug] Accessing element at index 65535 past array upper bound 499

plss help me

sry for my bad english
Reply
#2

Show us the code where you set the checkpoint.
Reply
#3

here
pawn Код:
stock checkteam(playerid)
{
    new vehicleid;
    vehicleid = GetPlayerVehicleID(playerid);
    //auspro
    //auspro
    //if(vehicleid == auspro && Team[playerid] == AUSTRALIA || Team[playerid] == ADMIN || Team[playerid] == MERCENARY ) {RemovePlayerFromVehicle(playerid);}
    if(Team[playerid] == ASIA && vehicleid == auspro)
    {
        SetPlayerCheckpoint(playerid,1136.6808,1968.4490,10.8203, 10.0);
        IsCapturing[playerid][auspro] = 1;
        SendClientMessage(playerid, COLOR_GREEN, "Deliver Prototype To The Checkpoint in Your Base");
    }
    if(Team[playerid] == AFRICA && vehicleid == auspro)
    {
        SetPlayerCheckpoint(playerid,-754.0302,1586.2006,26.9609, 10.0);
        IsCapturing[playerid][auspro] = 1;
        SendClientMessage(playerid, COLOR_GREEN, "Deliver Prototype To The Checkpoint in Your Base");
    }
    if(Team[playerid] == AMERICA && vehicleid == auspro)
    {
        SetPlayerCheckpoint(playerid,-145.1369,1120.6730,19.7500, 10.0);
        IsCapturing[playerid][auspro] = 1;
        SendClientMessage(playerid, COLOR_GREEN, "Deliver Prototype To The Checkpoint in Your Base");
    }
    if(Team[playerid] == EUROPE && vehicleid == auspro)
    {
        SetPlayerCheckpoint(playerid,-167.9965,2720.3223,62.1003, 10.0);
        IsCapturing[playerid][auspro] = 1;
        SendClientMessage(playerid, COLOR_GREEN, "Deliver Prototype To The Checkpoint in Your Base");
    }

    //asiapro
    if(Team[playerid] == AUSTRALIA && vehicleid == asiapro)
    {
        SetPlayerCheckpoint(playerid,429.3654,2515.2388,16.1535, 10.0);
        IsCapturing[playerid][asiapro] = 1;
        SendClientMessage(playerid, COLOR_GREEN, "Deliver Prototype To The Checkpoint in Your Base");
    }
    if(Team[playerid] == AFRICA && vehicleid == asiapro)
    {
        SetPlayerCheckpoint(playerid,-754.0302,1586.2006,26.9609, 10.0);
        IsCapturing[playerid][asiapro] = 1;
        SendClientMessage(playerid, COLOR_GREEN, "Deliver Prototype To The Checkpoint in Your Base");
    }
    if(Team[playerid] == AMERICA && vehicleid == asiapro)
    {
        SetPlayerCheckpoint(playerid,-145.1369,1120.6730,19.7500, 10.0);
        IsCapturing[playerid][asiapro] = 1;
        SendClientMessage(playerid, COLOR_GREEN, "Deliver Prototype To The Checkpoint in Your Base");
    }
    if(Team[playerid] == EUROPE && vehicleid == asiapro)
    {
        SetPlayerCheckpoint(playerid,-167.9965,2720.3223,62.1003, 10.0);
        IsCapturing[playerid][asiapro] = 1;
        SendClientMessage(playerid, COLOR_GREEN, "Deliver Prototype To The Checkpoint in Your Base");
    }
    //africapro
    if(Team[playerid] == AUSTRALIA && vehicleid == africapro)
    {
        SetPlayerCheckpoint(playerid,429.3654,2515.2388,16.1535, 10.0);
        IsCapturing[playerid][africapro] = 1;
        SendClientMessage(playerid, COLOR_GREEN, "Deliver Prototype To The Checkpoint in Your Base");
    }
    if(Team[playerid] == ASIA && vehicleid == africapro)
    {
        SetPlayerCheckpoint(playerid,1136.6808,1968.4490,10.8203, 10.0);
        IsCapturing[playerid][africapro] = 1;
        SendClientMessage(playerid, COLOR_GREEN, "Deliver Prototype To The Checkpoint in Your Base");
    }
    if(Team[playerid] == AMERICA && vehicleid == africapro)
    {
        SetPlayerCheckpoint(playerid,-145.1369,1120.6730,19.7500, 10.0);
        IsCapturing[playerid][africapro] = 1;
        SendClientMessage(playerid, COLOR_GREEN, "Deliver Prototype To The Checkpoint in Your Base");
    }
    if(Team[playerid] == EUROPE && vehicleid == africapro)
    {
        SetPlayerCheckpoint(playerid,-167.9965,2720.3223,62.1003, 10.0);
        IsCapturing[playerid][africapro] = 1;
        SendClientMessage(playerid, COLOR_GREEN, "Deliver Prototype To The Checkpoint in Your Base");
    }
    //americapro
    if(Team[playerid] == AUSTRALIA && vehicleid == usapro)
    {
        SetPlayerCheckpoint(playerid,429.3654,2515.2388,16.1535, 10.0);
        IsCapturing[playerid][usapro] = 1;
        SendClientMessage(playerid, COLOR_GREEN, "Deliver Prototype To The Checkpoint in Your Base");
    }
    if(Team[playerid] == ASIA && vehicleid == usapro)
    {
        SetPlayerCheckpoint(playerid,1136.6808,1968.4490,10.8203, 10.0);
        IsCapturing[playerid][usapro] = 1;
        SendClientMessage(playerid, COLOR_GREEN, "Deliver Prototype To The Checkpoint in Your Base");
    }
    if(Team[playerid] == AFRICA && vehicleid == usapro)
    {
        SetPlayerCheckpoint(playerid,-754.0302,1586.2006,26.9609, 10.0);
        IsCapturing[playerid][usapro] = 1;
        SendClientMessage(playerid, COLOR_GREEN, "Deliver Prototype To The Checkpoint in Your Base");
    }
    if(Team[playerid] == EUROPE && vehicleid == usapro)
    {
        SetPlayerCheckpoint(playerid,-167.9965,2720.3223,62.1003, 10.0);
        IsCapturing[playerid][usapro] = 1;
        SendClientMessage(playerid, COLOR_GREEN, "Deliver Prototype To The Checkpoint in Your Base");
    }
    //europepro
//  if(GetVehicleModel(vehicleid) == europro && Team[playerid] == EUROPE ) {RemovePlayerFromVehicle(playerid);}
    if(Team[playerid] == AUSTRALIA && vehicleid == europro)
    {
        SetPlayerCheckpoint(playerid,429.3654,2515.2388,16.1535, 10.0);
        IsCapturing[playerid][europro] = 1;
        SendClientMessage(playerid, COLOR_GREEN, "Deliver Prototype To The Checkpoint in Your Base");
    }
    if(Team[playerid] == ASIA && vehicleid == europro)
    {
        SetPlayerCheckpoint(playerid,1136.6808,1968.4490,10.8203, 10.0);
        IsCapturing[playerid][europro] = 1;
        SendClientMessage(playerid, COLOR_GREEN, "Deliver Prototype To The Checkpoint in Your Base");
    }
    if(Team[playerid] == AFRICA && vehicleid == europro)
    {
        SetPlayerCheckpoint(playerid,-754.0302,1586.2006,26.9609, 10.0);
        IsCapturing[playerid][europro] = 1;
        SendClientMessage(playerid, COLOR_GREEN, "Deliver Prototype To The Checkpoint in Your Base");
    }
    if(Team[playerid] == AMERICA && vehicleid == europro)
    {
        SetPlayerCheckpoint(playerid,-145.1369,1120.6730,19.7500, 10.0);
        IsCapturing[playerid][europro] = 1;
        SendClientMessage(playerid, COLOR_GREEN, "Deliver Prototype To The Checkpoint in Your Base");
    }
    //check
    if (Team[playerid] == EUROPE && vehicleid == europro)
    {
        RemovePlayerFromVehicle(playerid);
        TogglePlayerControllable(playerid, true);
    }
    if (Team[playerid] == ASIA && vehicleid == asiapro)
    {
        RemovePlayerFromVehicle(playerid);
        TogglePlayerControllable(playerid, true);
    }
    if (Team[playerid] == AMERICA && vehicleid == usapro)
    {
        RemovePlayerFromVehicle(playerid);
        TogglePlayerControllable(playerid, true);
    }
    if (Team[playerid] == AFRICA && vehicleid == africapro)
    {
        RemovePlayerFromVehicle(playerid);
        TogglePlayerControllable(playerid, true);
    }
    if (Team[playerid] == AUSTRALIA && vehicleid == auspro)
    {
        RemovePlayerFromVehicle(playerid);
        TogglePlayerControllable(playerid, true);
    }
    if (Team[playerid] == ADMIN && vehicleid == auspro)
    {
        RemovePlayerFromVehicle(playerid);
        TogglePlayerControllable(playerid, true);
    }
    if (Team[playerid] == MERCENARY && vehicleid == auspro)
    {
        RemovePlayerFromVehicle(playerid);
        TogglePlayerControllable(playerid, true);
    }
    if (Team[playerid] == ADMIN && vehicleid == asiapro)
    {
        RemovePlayerFromVehicle(playerid);
        TogglePlayerControllable(playerid, true);
    }
    if (Team[playerid] == MERCENARY && vehicleid == asiapro)
    {
        RemovePlayerFromVehicle(playerid);
        TogglePlayerControllable(playerid, true);
    }
    if (Team[playerid] == ADMIN && vehicleid == usapro)
    {
        RemovePlayerFromVehicle(playerid);
        TogglePlayerControllable(playerid, true);
    }
    if (Team[playerid] == MERCENARY && vehicleid == usapro)
    {
        RemovePlayerFromVehicle(playerid);
        TogglePlayerControllable(playerid, true);
    }
    if (Team[playerid] == ADMIN && vehicleid == africapro)
    {
        RemovePlayerFromVehicle(playerid);
        TogglePlayerControllable(playerid, true);
    }
    if (Team[playerid] == MERCENARY && vehicleid == africapro)
    {
        RemovePlayerFromVehicle(playerid);
        TogglePlayerControllable(playerid, true);
    }
    if (Team[playerid] == ADMIN && vehicleid == europro)
    {
        RemovePlayerFromVehicle(playerid);
        TogglePlayerControllable(playerid, true);
    }
    if (Team[playerid] == MERCENARY && vehicleid == europro)
    {
        RemovePlayerFromVehicle(playerid);
        TogglePlayerControllable(playerid, true);
    }
 // return true;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)