PLEASE, I am SO close now! [JOB SCRIPT]
#1

So, now I got all the checkpoints set up, but the thing is that, everytime I go to the checkpoint it doesnt automaticly start the other checkpoint.. help plz?


pawn Код:
#define FILTERSCRIPT
#include <a_samp>





//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
public OnGameModeInit()
{

    CreateVehicle(574, -2273.1279,2306.4246,4.5453,87.7054, 1, 1, 10);
    CreateVehicle(574, -2272.5564,2309.2610,4.5453,91.0751, 1, 1, 10);
    CreateVehicle(574, -2272.8257,2312.2505,4.5454,89.3365, 1, 1, 10);
    CreateVehicle(574, -2273.1941,2315.2334,4.5453,90.2443, 1, 1, 10);

    return 1;
}
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
public OnPlayerEnterCheckpoint(playerid)
{
    if  (IsPlayerInRangeOfPoint(playerid, 2, -2272.1460,2354.0540,4.5454))
    {
   
        SetPlayerCheckpoint(playerid, -2334.6729,2385.2109,5.5064, 3.0);
    }
    else if (IsPlayerInRangeOfPoint(playerid, 2, -2334.6729,2385.2109,5.5064))
    {
   
        SetPlayerCheckpoint(playerid, -2454.7063,2334.3398,4.5608, 3.0);
    }
    if (IsPlayerInRangeOfPoint(playerid, 2, -2454.7063,2334.3398,4.5608))
    {
       
        SetPlayerCheckpoint(playerid, -2468.2590,2322.1565,4.5611, 3.0);
    }
    else if(IsPlayerInRangeOfPoint(playerid, 2, -2468.2590,2322.1565,4.5611))
    {
       
        SetPlayerCheckpoint(playerid, -2475.2698,2264.7302,4.5627, 3.0);
    }
    if (IsPlayerInRangeOfPoint(playerid, 2, -2475.2698,2264.7302,4.5627))
    {

        SetPlayerCheckpoint(playerid, -2571.5884,2333.4280,4.5634, 3.0);
    }
    else if(IsPlayerInRangeOfPoint(playerid, 2, -2571.5884,2333.4280,4.5634))
    {
       
        SetPlayerCheckpoint(playerid, -2612.8010,2340.5071,7.9364, 3.0);
    }
    if (IsPlayerInRangeOfPoint(playerid, 2, -2612.8010,2340.5071,7.9364))
    {
       
        SetPlayerCheckpoint(playerid, -2536.2373,2400.0557,14.5013, 3.0);
    }
    else if(IsPlayerInRangeOfPoint(playerid, 2, -2536.2373,2400.0557,14.5013))
    {
       
        SetPlayerCheckpoint(playerid, -2416.5896,2430.4604,12.1526, 3.0);
    }
    if (IsPlayerInRangeOfPoint(playerid, 2, -2416.5896,2430.4604,12.1526))
    {
     
        SetPlayerCheckpoint(playerid, -2273.8125,2348.2114,4.5434, 3.0);
    }
    else if(IsPlayerInRangeOfPoint(playerid, 2, -2273.8125,2348.2114,4.5434))
    {
       
        SendClientMessage(playerid, 0xAA3333AA, "You have finished your job! Here is 1000 dollars for your effort!");
        GivePlayerMoney(playerid, 1000);
    }
    return 1;
}

public OnPlayerLeaveCheckpoint(playerid)
{
    if (IsPlayerInRangeOfPoint(playerid, 2, -2273.8125,2348.2114,4.5434))
    {
    IsPlayerInCheckpoint(playerid);
    DisablePlayerCheckpoint(playerid);
    }

    return 1;
}






public OnPlayerCommandText(playerid, cmdtext[])
{

    if(strcmp("/startsweep", cmdtext, true, 6) == 0)
    {
        if(IsPlayerInAnyVehicle(playerid))
        {
            new vehid = GetPlayerVehicleID(playerid);
            if(GetVehicleModel(vehid) == 574)
            {
               
            SetPlayerCheckpoint(playerid, -2272.1460,2354.0540,4.5454, 3.0);
            SendClientMessage(playerid, 0xFFFFFFAA, "Remember to do /startsweep every time your at a checkpoint!");

            }
            else SendClientMessage(playerid, 0xFFFFFFAA, "You need to be in a sweeper, to use this command!");
        }
        else SendClientMessage(playerid, 0xFFFFFFAA, "You need to be in a vehicle, to use this command!");
        return 1;
    }
    return 0;
}
Reply
#2

2 is a small range. Try making it larger.
Reply
#3

why are you using IsPlayerInRangeOfPoint when they just entered a checkpoint? store the created checkpoints into variables and when they enter a checkpoint check which one they entered according to the checkpointid
Reply
#4

Sorry for this Off-Topic, but Facepunch, there is no need to create multiple topics posting the same problem. Just create one topic for ONE situation. If no one ever helps you can always bump it.
Reply
#5

Quote:
Originally Posted by cessil
Посмотреть сообщение
why are you using IsPlayerInRangeOfPoint when they just entered a checkpoint? store the created checkpoints into variables and when they enter a checkpoint check which one they entered according to the checkpointid
Because checkpointid's don't exist. SetPlayerCheckpoint doesn't return a specific value.
Reply
#6

it returns the id of the newly created checkpoint, if you don't believe me try it yourself, just don't teach new scripters the wrong things
Reply
#7

Quote:
Originally Posted by cessil
Посмотреть сообщение
it returns the id of the newly created checkpoint, if you don't believe me try it yourself, just don't teach new scripters the wrong things
https://sampwiki.blast.hk/wiki/SetPlayerCheckpoint
Reply
#8

I haven't worked with non streamed checkpoints in a while, but incognito's is much easier to use than normal SetPlayerCheckPoint, you can actually check which checkpointid they entered and exited
Reply
#9

....

If it did return something, why wouldn't the callback OnPlayerEnterCheckpoint have more than just the playerid parameter? It would have playerid and checkpointid.
Reply
#10

Thank you all for the replies, but can you give me something "concrete" that works, so I can work from that?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)