Little Help
#1

Hello, I have problem with Dynamic checkpoint from Streamer, it`s won`t show up, here is the code.
pawn Код:
hook OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    if(newkeys == KEY_SUBMISSION)
    {
        if(GetPlayerState(playerid) != PLAYER_STATE_DRIVER) return SendDebug(playerid, "Check: 1");
        new model = GetVehicleModel(GetPlayerVehicleID(playerid));
        if(model != 431 && model != 437) return SendDebug(playerid, "Check: 2");
        if(IsValidDynamicCP(pJobCP[playerid])) return SendDebug(playerid, "Check: 3");
       
        new RandomCpID = random(sizeof(BusJobCP));
        pJobCP[playerid] = CreateDynamicCP(BusJobCP[RandomCpID][PosX], BusJobCP[RandomCpID][PosY], BusJobCP[RandomCpID][PosZ],2.0, -1, -1, playerid, 1000.0);
        SendDebug(playerid,"PosX: %f, PosY: %f, PosZ: %f", BusJobCP[RandomCpID][PosX], BusJobCP[RandomCpID][PosY], BusJobCP[RandomCpID][PosZ]);
    }
    return 1;
}
Screen
Reply
#2

What do you want to do in this function explain clearly
Reply
#3

When you press 2, on map should show checkpoint where you need to go, randomly. But checkpoint is not showing.
Reply
#4

In Which condition you want to make a Checkpoint you have returned all the conditions you must apply the function at any one condition.
Reply
#5

The streamer is programmed and designed to always show the closest checkpoint. Chances are that the newly created isn't the closest so it is simply not created and hence not shown on the map either. In order to show a checkpoint on the map you should probably use a map icon instead. You can use map icon id 0 with color red to mimic the default checkpoint icon, or you can choose any color you want. When the player gets near the checkpoint will show up for them and once they enter it you can remove the map icon.
Reply
#6

Quote:
Originally Posted by Vince
Посмотреть сообщение
The streamer is programmed and designed to always show the closest checkpoint. Chances are that the newly created isn't the closest so it is simply not created and hence not shown on the map either. In order to show a checkpoint on the map you should probably use a map icon instead. You can use map icon id 0 with color red to mimic the default checkpoint icon, or you can choose any color you want. When the player gets near the checkpoint will show up for them and once they enter it you can remove the map icon.
But with that I had never problem, I am making scripts like inc, just saving them in pwn format and load them in main script, but I never had problem like that before, every time CP shows regularly on map. Why is that happening?
Reply
#7

Sorry for bump but I need really help
Reply
#8

Here is the full code, maybe that`s help.
pawn Код:
//==============================================================================
//--->>> Bus Job
//==============================================================================
#include <a_samp>
#include <YSI\y_hooks>
//==============================================================================
enum BusJob
{
    Float:PosX,
    Float:PosY,
    Float:PosZ
};

static const BusJobCP[][BusJob] =
{
    {2424.8142,2285.3069,10.6719},
    {2392.5549,2415.5117,10.6797},
    {2305.9316,2515.2656,10.6719}
};

new pJobCP[MAX_PLAYERS];
//==============================================================================
//--->>> Forwards
//==============================================================================
forward BusStop(playerid);
//==============================================================================
//--->>> Hooks
//==============================================================================
hook OnPlayerConnect(playerid)
{
    pJobCP[playerid] = 0;
    return 1;
}

hook OnPlayerDisconnect(playerid, reason)
{
    if(IsValidDynamicCP(pJobCP[playerid]))
    {
        DestroyDynamicCP(pJobCP[playerid]);
        pJobCP[playerid] = 0;
    }
    return 1;
}

hook OnPlayerStateChange(playerid, newstate, oldstate)
{
    if(newstate == PLAYER_STATE_DRIVER)
    {
        new model = GetVehicleModel(GetPlayerVehicleID(playerid));
        if(model == 431 || model == 437)
        {
            ShowPlayerNotification(playerid, "Press ~g~2 ~w~to start bus job.");
        }
    }
    else if(oldstate == PLAYER_STATE_DRIVER)
    {
        if(pJobCP[playerid] != 0)
        {
            if(IsValidDynamicCP(pJobCP[playerid]))
            {
                DestroyDynamicCP(pJobCP[playerid]);
            }
            pJobCP[playerid] = 0;
            ShowPlayerNotification(playerid, "~r~You have left the vehicle!");
        }
    }
    return 1;
}

hook OnPlayerEnterDynamicCP(playerid, checkpointid)
{
    if(checkpointid == pJobCP[playerid])
    {
        DestroyDynamicCP(pJobCP[playerid]);
        TogglePlayerControllable(playerid, 0);
        SetTimerEx("BusStop", 5000, false, "d", playerid);
    }
    return 1;
}


CMD:testjob(playerid, params[])
{
    if(GetPlayerState(playerid) != PLAYER_STATE_DRIVER) return SendDebug(playerid, "Check: 1");
    new model = GetVehicleModel(GetPlayerVehicleID(playerid));
    if(model != 431 && model != 437) return SendDebug(playerid, "Check: 2");
    if(IsValidDynamicCP(pJobCP[playerid])) return SendDebug(playerid, "Check: 3");

    new RandomCpID = random(sizeof(BusJobCP));
    pJobCP[playerid] = CreateDynamicCP(BusJobCP[RandomCpID][PosX], BusJobCP[RandomCpID][PosY], BusJobCP[RandomCpID][PosZ], 6.0, -1, -1, playerid, 1000.0);
    SendDebug(playerid,"PosX: %f, PosY: %f, PosZ: %f", BusJobCP[RandomCpID][PosX], BusJobCP[RandomCpID][PosY], BusJobCP[RandomCpID][PosZ]);
    return 1;
}
hook OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    if(newkeys == KEY_SUBMISSION)
    {

    }
    return 1;
}
//==============================================================================
//--->>> Publics
//==============================================================================
public BusStop(playerid)
{
    new RandomCpID = random(sizeof(BusJobCP));
    pJobCP[playerid] = CreateDynamicCP(BusJobCP[RandomCpID][PosX], BusJobCP[RandomCpID][PosY], BusJobCP[RandomCpID][PosZ],2.0, -1, -1, playerid, 1000.0);
    GameTextForPlayer(playerid, "~y~Payout~n~~w~$2000", 5000, 5);
    GivePlayerMoney(playerid, 2000);
    TogglePlayerControllable(playerid, 1);
    return 1;
}
Please reply someone.
Reply
#9

Quote:
Originally Posted by Vince
Посмотреть сообщение
The streamer is programmed and designed to always show the closest checkpoint. Chances are that the newly created isn't the closest so it is simply not created and hence not shown on the map either. In order to show a checkpoint on the map you should probably use a map icon instead. You can use map icon id 0 with color red to mimic the default checkpoint icon, or you can choose any color you want. When the player gets near the checkpoint will show up for them and once they enter it you can remove the map icon.
Update on your reply: When player drive for a while around LV, checkpoint shows up, but when you come to the checkpoint it`s not detecting. Why, I don`t know
Reply
#10

Sorry for bump but anyone have idea why is that happening, or how to fix it? Please it`s urgent.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)