Is this alright?
#1

Is this right?

When I do the command,

pawn Код:
command(playerid, params[])
{
    if(Player[playerid][CPSET] == 0)
    {
        SetPlayerCheckpoint(playerid, x, y, z, size);
        Player[playerid][CPSET] == 1;
        SendClientMessage(playerid, WHITE, "You must go and pick up the delivery things, to get them delivered.");
    }
    else
    {
         SendClientMessage(playerid, WHITE, "You already have a checkpoint set, please go to it.");
    }
    return 1;
}
How would I do the thing for OnPlayerEnterCheckpoint?

I've tried to to it, would it be something like this?

pawn Код:
public OnPlayerEnterCheckpoint(playerid)
{
    if(Player[playerid][CPSET] == 0)
    {
        SetPlayerCheckpoint(playerid, x, y, z, size);
        SendClientMessage(playerid, WHITE, "You must deliver the products to the delivery point.");
        DisablePlayerCheckpoint(playerid);
        Player[playerid][CPSET] == 2;
    }
    return 1;
}
pawn Код:
public OnPlayerEnterCheckpoint(playerid)
{
    if(Player[playerid][CPSET] == 2)
    {
        SendClientMessage(playerid, WHITE, "Well done, you have completed the trucking side-job.");
        DisablePlayerCheckpoint(playerid);
        Player[playerid][CPSET] == 0;
    }
    return 1;
}
Does that look alright to you?, if not please could you help me on how to complete this so it works.
Reply
#2

You should read up more on the Pawn syntax, you can't use two equal signs to set values, you can only use them to compare values inside an if statement (for example).

Also, if you're adding code to a function, you can't replicate the function, you have to nest the code inside the pre-existing function, like this:

pawn Код:
public OnPlayerEnterCheckpoint(playerid)
{
    if(Player[playerid][CPSET] == 0)
    {
        SetPlayerCheckpoint(playerid, x, y, z, size); // don't forget to set these parameters also
        SendClientMessage(playerid, WHITE, "You must deliver the products to the delivery point.");
        DisablePlayerCheckpoint(playerid);
        Player[playerid][CPSET] = 2;
    }
    if(Player[playerid][CPSET] == 2)
    {
        SendClientMessage(playerid, WHITE, "Well done, you have completed the trucking side-job.");
        DisablePlayerCheckpoint(playerid);
        Player[playerid][CPSET] = 0;
    }
    return 1;
}
Finally, you haven't added the command name to the command declaration, if you look closely you'll notice that you only added 'command(playerid, params[])' which wouldn't work, you need to (if you're using zcmd) declare commands like so:

pawn Код:
command(cmdname, playerid, params[]) // replace 'cmdname' with the name of the command you're creating
Reply
#3

Aye mate, I figured all of that when I compiled it :3, I edited the pawn script, and got no warnings/errors, so I went in game, and did /truck, which was the command, the checkpoint appeared, I drove to it, but when I got to it, and got on top of it, the checkpoint didn't disappear, and create the next one, what could be the matter?
Reply
#4

I recommend you use a checkpoint streamer for trucking. Here are the native examples:

pawn Код:
native CreateDynamicObject(modelid, Float:x, Float:y, Float:z, Float:rx, Float:ry, Float:rz, worldid = -1, interiorid = -1, playerid = -1, Float:distance = 200.0);
native DestroyDynamicObject(objectid);
native IsValidDynamicObject(objectid);
native SetDynamicObjectPos(objectid, Float:x, Float:y, Float:z);
native GetDynamicObjectPos(objectid, &Float:x, &Float:y, &Float:z);
native SetDynamicObjectRot(objectid, Float:rx, Float:ry, Float:rz);
native GetDynamicObjectRot(objectid, &Float:rx, &Float:ry, &Float:rz);
native MoveDynamicObject(objectid, Float:x, Float:y, Float:z, Float:speed);
native StopDynamicObject(objectid);
native DestroyAllDynamicObjects();
native CountDynamicObjects();
Reply
#5

What kind of Checkpoint streamer could there be?, sorry if I seem newbie to this, because I have no idea on checkpoints. :3.
Reply
#6

You can use incognito's checkpoint streamer:

http://forum.sa-mp.com/showthread.ph...light=streamer

This is pretty much the most important callback:

pawn Код:
public OnPlayerEnterDynamicCP(playerid, checkpointid)
{
}
Reply
#7

Thanks mate, appreciate it.
Reply
#8

pawn Код:
public OnPlayerEnterCheckpoint(playerid)
{
    if(Player[playerid][CPSET] == 1)
    {
        SendClientMessage(playerid, WHITE, "You must deliver the products to the delivery point.");
        DisablePlayerCheckpoint(playerid);
        SetPlayerCheckpoint(playerid, x, y, z, size);
        Player[playerid][CPSET] = 2;
    }
    else if(Player[playerid][CPSET] == 2)
    {
        SendClientMessage(playerid, WHITE, "Well done, you have completed the trucking side-job.");
        DisablePlayerCheckpoint(playerid);
        Player[playerid][CPSET] = 0;
    }
    return 1;
}
I see no reason to use a streamer here.
Reply


Forum Jump:


Users browsing this thread: 5 Guest(s)