#1

Hey i'm making a pilots server, and i'm trying to make the "/work" command.

This is what i have:
pawn Код:
new Ccp[MAX_PLAYERS];

if(strcmp("/work", cmdtext, true) == 0)
    {
        Ccp[playerid] = 1;
        SetPlayerCheckpoint(playerid, -1367.5624,-221.9253,14.1484, 3.0);
        SendClientMessage(playerid, 0xFFFFFFFF, "You started with working. Please follow the checkpoints");
        return 1;
    }

// THIS IS OnPlayerEnterCheckpoint

if(Ccp[playerid] == 1) // This checks if our variable equals to 1, if so: it continues
    {
        DisablePlayerCheckpoint(playerid); // This makes sure that there will be a new checkpoint
        Ccp[playerid] = 2; // Changes the variable, so we can use it later again with OnPlayerEnterCheckpoint
        SetPlayerCheckpoint(playerid, -1367.5624,-221.9253,14.1484, 3.0); // Creates a new checkpoint at a different position
        SendClientMessage(playerid, 0xFFFFFFFF, "The passengers are in your plane now.\nNow, go to the new checkpoint to unload the passengers ");
        return 1;
    }
But it doesnt want to compile because then i have this errors:
Код:
C:\Users\r530\Desktop\Pilots Server\gamemodes\pilot.pwn(162) : error 017: undefined symbol "Ccp"
C:\Users\r530\Desktop\Pilots Server\gamemodes\pilot.pwn(162) : warning 215: expression has no effect
C:\Users\r530\Desktop\Pilots Server\gamemodes\pilot.pwn(162) : error 001: expected token: ";", but found "]"
C:\Users\r530\Desktop\Pilots Server\gamemodes\pilot.pwn(162) : error 029: invalid expression, assumed zero
C:\Users\r530\Desktop\Pilots Server\gamemodes\pilot.pwn(162) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


4 Errors.
So, i'm asking someone to fix this for me and i want that you only can use this command if you are in a shamal.
Reply
#2

Someone?
Reply
#3

Just write

Код:
 new Ccp;
When is the variable assigned or when is it reset? Playerconnect/disconnect.

if that still errors you use this:

Код:
 new Ccp[MAX_PLAYERS];
Reply
#4

Check the if it is in correct line and make Ccp as global variable.
Reply
#5

pawn Код:
#include <a_samp>

#define SHAMAL_ID 5

new Ccp[MAX_PLAYERS];
public OnPlayerCommandText(playerid,cmdtext[])
{
    if(strcmp("/work", cmdtext, true) == 0)
    {
        if(GetVehicleModel(GetPlayerVehicleID(playerid)) == SHAMAL_ID)
        {
            Ccp[playerid] = 1;
            SetPlayerCheckpoint(playerid, -1367.5624,-221.9253,14.1484, 3.0);
            SendClientMessage(playerid, 0xFFFFFFFF, "You started with working. Please follow the checkpoints");
        }
        else
        {
        }
        return 1;
    }
    return 0;
}

public OnPlayerEnterCheckpoint(playerid)
{
    if(Ccp[playerid] == 1) // This checks if our variable equals to 1, if so: it continues
    {
        DisablePlayerCheckpoint(playerid); // This makes sure that there will be a new checkpoint
        Ccp[playerid] = 2; // Changes the variable, so we can use it later again with OnPlayerEnterCheckpoint
        SetPlayerCheckpoint(playerid, -1367.5624,-221.9253,14.1484, 3.0); // Creates a new checkpoint at a different position
        SendClientMessage(playerid, 0xFFFFFFFF, "The passengers are in your plane now.\nNow, go to the new checkpoint to unload the passengers ");
        return 1;
    }
    return 1;
}
Reply
#6

Deleted, thanks for helping!
Reply
#7

Now, if i enter the checkpoint to load the passengers then i have to get out of my plane, but when i enter the checkpoint it wont go away,
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)