Is there a line to check if the player has typed the command before
#1

I would like to make a system where the player firstly has to type /start and afterwards he must go to a specific location and type /delivergoods but he must type /start first.
Reply
#2

Top of script:

pawn Код:
new Delivering[MAX_PLAYERS];
on the /start command, you can add:

pawn Код:
COMMAND:start(playerid,params[])
{
    // Your code here, e.g. tell the player he has started the job
    Delivering[playerid] = 1;
    return 1;
}
then on the delivergoods command:

pawn Код:
COMMAND:delivergoods(playerid,params[])
{
    if(Delivering[playerid] != 1)
    {
        SendClientMessage(playerid, COLOR-HERE, "You need to type /start - blablabla ;p");
        return 1;
    }
    // he is delivering, put your code here :)
    Delivering[playerid] = 0; // Set this back to 0 so he can do the job again ;)
    return 1;
}
Reply
#3

pawn Код:
new HasStarted[MAX_PLAYERS];

public OnPlayerConnect(playerid)
{
    HasStarted[playerid] = 0;
    return 1;
}

CMD:start(playerid, params[])
{
    HasStarted[playerid] = 1;
    SendClientMessage(playerid, 0xFFFFFFFF, "SERVER: You've started the delivery job.");
    return 1;
}

CMD:delivergoods(playerid, params[])
{
    if(HasStarted[playerid] == 1)
    {
        //He has started
    }
    else
    {
        //He hasn't started yet
    }
    return 1;
}
Edit: Oops too late.
Reply
#4

Suggestion: You can use boolean instead for such as things (false/true only).
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)