[HELP]Making checkpoint
#1

I some questions: How to make a Bus driver job. DOn't need commands, only how to create.
Then you know when you do /startroute and the checkpoint's starts and you need to enter it. I wan't know how to this too.

Please helpme

PS. If you teatchme out to do this i will map for you for free.
Reply
#2

at the top of your script:
Код:
new state[MAX_PLAYERS];
then for the command to start:
Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
	if (strcmp("/startroute", cmdtext, true, 10) == 0)
	{
		if(state[playerid] = 0){
		    SetPlayerCheckpoint(playerid, x, y, z, 5.00);   //replace x, y, z with the coordinates of the 1. route point
		    state[playerid] = 1;
		    return 1;
		}
	}
	return 0;
}
then to get the checkpoints and continue with the route:
Код:
public OnPlayerEnterCheckpoint(playerid)
{
	if(state[playerid] == 1){
	    SetPlayerCheckpoint(playerid, x, y, z, 5.00);   //replace x, y, z with the coordinates of the 2. route point
	    state[playerid]++;
	}else if(state[playerid] == 2){
	    SetPlayerCheckpoint(playerid, x, y, z, 5.00);   //replace x, y, z with the coordinates of the 3. route point
	    state[playerid]++;
	}else if(state[playerid] == 3){
	    SetPlayerCheckpoint(playerid, x, y, z, 5.00);   //replace x, y, z with the coordinates of the 4. route point
		state[playerid]++;
	}
	return 1;
}
You can continue with the "else if(state[playerid] == x)" as far as you want... just increase the number by 1 always and at your last checkpoint do this:
Код:
DisablePlayerCheckpoint(playerid);
state[playerid] = 0;
instead of the SetPlayerCheckpoint and the state[playerid]++, otherwise you won't be able to use the command again, later


oh.. and btw.. I don't need a mapper..
if you have anymore questions related to this just send me a pm
Reply
#3

Quote:
Originally Posted by Sascha
Посмотреть сообщение
at the top of your script:
Код:
new state[MAX_PLAYERS];
then for the command to start:
Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
	if (strcmp("/startroute", cmdtext, true, 10) == 0)
	{
		if(state[playerid] = 0){
		    SetPlayerCheckpoint(playerid, x, y, z, 5.00);   //replace x, y, z with the coordinates of the 1. route point
		    state[playerid] = 1;
		    return 1;
		}
	}
	return 0;
}
then to get the checkpoints and continue with the route:
Код:
public OnPlayerEnterCheckpoint(playerid)
{
	if(state[playerid] == 1){
	    SetPlayerCheckpoint(playerid, x, y, z, 5.00);   //replace x, y, z with the coordinates of the 2. route point
	    state[playerid]++;
	}else if(state[playerid] == 2){
	    SetPlayerCheckpoint(playerid, x, y, z, 5.00);   //replace x, y, z with the coordinates of the 3. route point
	    state[playerid]++;
	}else if(state[playerid] == 3){
	    SetPlayerCheckpoint(playerid, x, y, z, 5.00);   //replace x, y, z with the coordinates of the 4. route point
		state[playerid]++;
	}
	return 1;
}
You can continue with the "else if(state[playerid] == x)" as far as you want... just increase the number by 1 always and at your last checkpoint do this:
Код:
DisablePlayerCheckpoint(playerid);
state[playerid] = 0;
instead of the SetPlayerCheckpoint and the state[playerid]++, otherwise you won't be able to use the command again, later


oh.. and btw.. I don't need a mapper..
if you have anymore questions related to this just send me a pm
VERY THANKS I LOVE YOU!
Reply
#4

C:\Users\Antonio Carlos\Desktop\Nuno\gta sa\filterscripts\FS bus.pwn(4) : error 020: invalid symbol name ""
C:\Users\Antonio Carlos\Desktop\Nuno\gta sa\filterscripts\FS bus.pwn(95) : error 001: expected token: "-identifier-", but found "["
C:\Users\Antonio Carlos\Desktop\Nuno\gta sa\filterscripts\FS bus.pwn(95) : error 029: invalid expression, assumed zero
C:\Users\Antonio Carlos\Desktop\Nuno\gta sa\filterscripts\FS bus.pwn(95) : warning 215: expression has no effect
C:\Users\Antonio Carlos\Desktop\Nuno\gta sa\filterscripts\FS bus.pwn(95) : error 001: expected token: ";", but found "]"
C:\Users\Antonio Carlos\Desktop\Nuno\gta sa\filterscripts\FS bus.pwn(95) : fatal error 107: too many error messages on one line
Reply
#5

Thanks for not showing us the lines becuz that really helps.............
Reply
#6

This should fix the warnings:

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if(!strcmp(cmdtext, "/startroute", true, 11))
    {
        if(state[playerid] == 0)
        {
            SetPlayerCheckpoint(playerid, x, y, z, 5.00);   //replace x, y, z with the coordinates of the 1. route point
            state[playerid] = 1;
            return 1;
        }
    }
    return 0;
}

public OnPlayerEnterCheckpoint(playerid)
{
    switch(state[playerid])
    {
        case 1:
        {
            SetPlayerCheckpoint(playerid, x, y, z, 5.00);   //replace x, y, z with the coordinates of the 2. route point
            state[playerid]++;
        }
        case 2:
        {
            SetPlayerCheckpoint(playerid, x, y, z, 5.00);   //replace x, y, z with the coordinates of the 3. route point
            state[playerid]++;
        }
        case 3:
        {
            SetPlayerCheckpoint(playerid, x, y, z, 5.00);   //replace x, y, z with the coordinates of the 4. route point
            state[playerid]++;
        }
    }
    return 1;
}
Quote:
Originally Posted by Steven82
Посмотреть сообщение
Thanks for not showing us the lines becuz that really helps.............
The code is posted above...
Reply
#7

C:\Users\Antonio Carlos\Desktop\Nuno\gta sa\filterscripts\FS bus.pwn(4) : error 020: invalid symbol name ""
C:\Users\Antonio Carlos\Desktop\Nuno\gta sa\filterscripts\FS bus.pwn(93) : error 029: invalid expression, assumed zero
C:\Users\Antonio Carlos\Desktop\Nuno\gta sa\filterscripts\FS bus.pwn(93) : error 029: invalid expression, assumed zero
C:\Users\Antonio Carlos\Desktop\Nuno\gta sa\filterscripts\FS bus.pwn(94) : warning 217: loose indentation
C:\Users\Antonio Carlos\Desktop\Nuno\gta sa\filterscripts\FS bus.pwn(97) : error 001: expected token: "-identifier-", but found "["
C:\Users\Antonio Carlos\Desktop\Nuno\gta sa\filterscripts\FS bus.pwn(97) : error 029: invalid expression, assumed zero
C:\Users\Antonio Carlos\Desktop\Nuno\gta sa\filterscripts\FS bus.pwn(97) : warning 215: expression has no effect
C:\Users\Antonio Carlos\Desktop\Nuno\gta sa\filterscripts\FS bus.pwn(97) : error 001: expected token: ";", but found "]"
C:\Users\Antonio Carlos\Desktop\Nuno\gta sa\filterscripts\FS bus.pwn(97) : fatal error 107: too many error messages on one line
Reply
#8

More easly way
pawn Код:
new BusCP[MAX_PLAYERS];

public OnPlayerConnect(playerid)
{
    BusCP[playerid] = 9999;
}

new Float:BusStops[10][3] = {
{x,y,z),
{x,y,z),
{x,y,z),
{x,y,z),
{x,y,z),
{x,y,z),
{x,y,z),
{x,y,z),
{x,y,z),
{x,y,z)
};


public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/startroute", cmdtext, true, 10) == 0)
    {
        if(BusCP[playerid] == 9999)
        {
            SetPlayerRaceCheckpoint(playerid,0,BusStop[0][0],BusStop[0][1],BusStop[0][2],BusStop[1][0],BusStop[1][1],BusStop[1][2],5.00);
            BusCP[playerid] = 0;
            return 1;
        }
        else
        {
            SendClientMessage(playerid,COLOR,"You are already on route!");
        }
    }
    return 1;
}

public OnPlayerEnterRaceCheckpoint(playerid)
{
    if(BusCP[playerid] < 9999)
    {
        BusCP[playerid]++;
        new b = BusCP[playerid];
        if(b == 9)
        {
            SendClientMessage(playerid,COLOR,"You end the route.");
        }
        else if(b <= 7)
        {
            SetPlayerRaceCheckpoint(playerid,0,BusStop[b][0],BusStop[b][1],BusStop[b][2],BusStop[b+1][0],BusStop[b+1][1],BusStop[b+1][2],5);
        }
        else
        {
            SetPlayerRaceCheckpoint(playerid,1,BusStop[b][0],BusStop[b][1],BusStop[b][2],BusStop[b+1][0],BusStop[b+1][1],BusStop[b+1][2],5);
        }
    }
    return 1;
}
with this you dont need on checkpoints else if else if, because Bus routes usual is about 10+ stops, so for each bus stop else if, is abit masive
Reply
#9

OHHH thanks
Reply
#10

C:\Users\Antonio Carlos\Desktop\Nuno\gta sa\gamemodes\bus.pwn(11) : error 001: expected token: ";", but found ")"
C:\Users\Antonio Carlos\Desktop\Nuno\gta sa\gamemodes\bus.pwn(173) : error 017: undefined symbol "BusStop"
C:\Users\Antonio Carlos\Desktop\Nuno\gta sa\gamemodes\bus.pwn(173) : warning 215: expression has no effect
C:\Users\Antonio Carlos\Desktop\Nuno\gta sa\gamemodes\bus.pwn(173) : error 001: expected token: ";", but found "]"
C:\Users\Antonio Carlos\Desktop\Nuno\gta sa\gamemodes\bus.pwn(173) : error 029: invalid expression, assumed zero
C:\Users\Antonio Carlos\Desktop\Nuno\gta sa\gamemodes\bus.pwn(173) : fatal error 107: too many error messages on one line




All errors in this line:

SetPlayerRaceCheckpoint(playerid,0,BusStop[0][0],BusStop[0][1],BusStop[0][2],BusStop[1][0],BusStop[1][1],BusStop[1][2],5.00);
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)