When I enter checkpoint, second checkpoint is not appearing.
#1

So I made pizzaboy job, player needs to go through few checkpoints, but as soon as I enter first checkpoint, I get message that I delivered goods, but next checkpoint does not appears, I even used DisablePlayerCheckpoint but it still didn't work, see code below.

Code:
public OnPlayerEnterCheckpoint(playerid)
{
	if(checkpointStage == 1)
	{
        DisablePlayerCheckpoint(playerid);
	checkpointStage = 2;
	SendClientMessage(playerid, -1, "Pizza delivered, now go to next checkpoint."); //This gets sent, but I get no checkpoint
	SetPlayerCheckpoint(playerid, 745.1824,-550.9210,17.1799, 5);
	return 1;
	}
	else if(checkpointStage == 2)
	{
	DisablePlayerCheckpoint(playerid);
	checkpointStage = 3;
 	SendClientMessage(playerid, -1, "Pizza delivered, now go to next checkpoint.");
	SetPlayerCheckpoint(playerid, 271.5015,-51.9949,1.9796, 5);
	}
	return 1;
}
by the way, checkpointStage gets set to 1 as soon as you get in the pizza bike. I am not sure what is problem, so help would be appreciated.
Reply
#2

pawn Code:
new checkpointStage[MAX_PLAYERS];

public OnPlayerEnterCheckpoint(playerid)
{
    if(checkpointStage == 1)
    {
        DisablePlayerCheckpoint(playerid);
        checkpointStage[playerid] = 2;
        SendClientMessage(playerid, -1, "Pizza delivered, now go to next checkpoint."); //This gets sent, but I get no checkpoint
        SetPlayerCheckpoint(playerid, 745.1824,-550.9210,17.1799, 5);
    }
    else if(checkpointStage == 2)
    {
        DisablePlayerCheckpoint(playerid);
        checkpointStage[playerid] = 3;
        SendClientMessage(playerid, -1, "Pizza delivered, now go to next checkpoint.");
        SetPlayerCheckpoint(playerid, 271.5015,-51.9949,1.9796, 5);
    }
    return 1;
}
Reply
#3

Quote:
Originally Posted by Affan
View Post
pawn Code:
new checkpointStage[MAX_PLAYERS];

public OnPlayerEnterCheckpoint(playerid)
{
    if(checkpointStage == 1)
    {
        DisablePlayerCheckpoint(playerid);
        checkpointStage[playerid] = 2;
        SendClientMessage(playerid, -1, "Pizza delivered, now go to next checkpoint."); //This gets sent, but I get no checkpoint
        SetPlayerCheckpoint(playerid, 745.1824,-550.9210,17.1799, 5);
    }
    else if(checkpointStage == 2)
    {
        DisablePlayerCheckpoint(playerid);
        checkpointStage[playerid] = 3;
        SendClientMessage(playerid, -1, "Pizza delivered, now go to next checkpoint.");
        SetPlayerCheckpoint(playerid, 271.5015,-51.9949,1.9796, 5);
    }
    return 1;
}
I am getting following errors with that script:

Code:
(111) : error 033: array must be indexed (variable "checkpointStage")
(113) : warning 217: loose indentation
(115) : warning 217: loose indentation
(130) : error 033: array must be indexed (variable "checkpointStage")
(137) : error 033: array must be indexed (variable "checkpointStage")
3 Errors.
Reply
#4

Use [playerid]
Code:
if(checkpointStage[playerid] == 1)
else if(checkpointStage[playerid] == 2)
Reply
#5

Okay I fixed errors but I still don't get checkpoint. I get message that I arrive at first checkpoint but second checkpoint does not appear.
Reply
#6

Give us the code you use to set the checkpoint in the first choice, this wouldn't work because you never set the value to 1.
Reply
#7

Quote:
Originally Posted by Jimmy0wns
View Post
Give us the code you use to set the checkpoint in the first choice, this wouldn't work because you never set the value to 1.
This is where I first set checkpointstage to 1, and checkpoint too.

Code:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
	
	//if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 448)
	 if(GetVehicleModel(vehicleid) == 448) {

        SendClientMessage(playerid, -1, "You jumped on a Pizza Boy bike!");
        checkpointStage[playerid] = 1; // stage 1 - getting on a bike.
	// do the rest
	SetPlayerCheckpoint(playerid, 1450.4535,373.7550,19.0953, 5);
    }
    return 1;
}
Reply
#8

Hello!

Where is the code that is available in OnPlayerEnterCheckpoint?

Mencent
Reply
#9

Quote:
Originally Posted by Mencent
View Post
Hello!

Where is the code that is available in OnPlayerEnterCheckpoint?

Mencent
Its at the very top...
Reply
#10

Quote:
Originally Posted by Mencent
View Post
Hello!

Where is the code that is available in OnPlayerEnterCheckpoint?

Mencent
Hi, its in original post.
Reply
#11

Quote:
Originally Posted by Nika1010
Посмотреть сообщение
Hi, its in original post.
Sorry, I don't saw it.

Well, what is printing?
PHP код:
public OnPlayerEnterCheckpoint(playerid)
{
    print(
"OnPlayerEnterCheckpoint called");
    
DisablePlayerCheckpoint(playerid);
    if(
checkpointStage[playerid] == 1)
    {
        print(
"checkpointStage[playerid] == 1");
        
checkpointStage[playerid] = 2;
        
SendClientMessage(playerid, -1"Pizza delivered, now go to next checkpoint."); //This gets sent, but I get no checkpoint
        
SetPlayerCheckpoint(playerid745.1824,-550.9210,17.17995);
        return 
1;
    }
    else if(
checkpointStage[playerid] == 2)
    {
        print(
"checkpointStage[playerid] == 2");
        
checkpointStage[playerid] = 3;
         
SendClientMessage(playerid, -1"Pizza delivered, now go to next checkpoint.");
        
SetPlayerCheckpoint(playerid271.5015,-51.9949,1.97965);
    }
    return 
1;

Mencent
Reply
#12

Quote:
Originally Posted by Mencent
Посмотреть сообщение
Sorry, I don't saw it.

Well, what is printing?
PHP код:
public OnPlayerEnterCheckpoint(playerid)
{
    print(
"OnPlayerEnterCheckpoint called");
    
DisablePlayerCheckpoint(playerid);
    if(
checkpointStage[playerid] == 1)
    {
        print(
"checkpointStage[playerid] == 1");
        
checkpointStage[playerid] = 2;
        
SendClientMessage(playerid, -1"Pizza delivered, now go to next checkpoint."); //This gets sent, but I get no checkpoint
        
SetPlayerCheckpoint(playerid745.1824,-550.9210,17.17995);
        return 
1;
    }
    else if(
checkpointStage[playerid] == 2)
    {
        print(
"checkpointStage[playerid] == 2");
        
checkpointStage[playerid] = 3;
         
SendClientMessage(playerid, -1"Pizza delivered, now go to next checkpoint.");
        
SetPlayerCheckpoint(playerid271.5015,-51.9949,1.97965);
    }
    return 
1;

Mencent
Well, its still same, as I commented it does print that pizza is delivered but I am getting no new checkpoint..

EDIT: I am getting this in server:
OnPlayerEnterCheckpoint called
checkpointStage[playerid] == 1
Reply
#13

You should send me your server-log.

EDIT:
@Nicka1010:
What is printing now?
PHP код:
public OnPlayerEnterCheckpoint(playerid)
{
    print(
"OnPlayerEnterCheckpoint called");
    
printf("checkpointStage[playerid] = %d",checkpointStage[playerid]);
    
DisablePlayerCheckpoint(playerid);
    if(
checkpointStage[playerid] == 1)
    {
        print(
"checkpointStage[playerid] == 1");
        
checkpointStage[playerid] = 2;
        
SendClientMessage(playerid, -1"Pizza delivered, now go to next checkpoint."); //This gets sent, but I get no checkpoint
        
SetPlayerCheckpoint(playerid745.1824,-550.9210,17.17995);
        
printf("checkpointStage[playerid] == %d",checkpointStage[playerid]);
        return 
1;
    }
    else if(
checkpointStage[playerid] == 2)
    {
        print(
"checkpointStage[playerid] == 2");
        
checkpointStage[playerid] = 3;
         
SendClientMessage(playerid, -1"Pizza delivered, now go to next checkpoint.");
        
SetPlayerCheckpoint(playerid271.5015,-51.9949,1.97965);
    }
    return 
1;

Mencent
Reply
#14

Quote:
Originally Posted by Mencent
Посмотреть сообщение
You should send me your server-log.

Mencent
I edited post above, check it .
Reply
#15

Ok! I also edited my post.

Mencent
Reply
#16

Quote:
Originally Posted by Mencent
Посмотреть сообщение
You should send me your server-log.

EDIT:
@Nicka1010:
What is printing now?
PHP код:
public OnPlayerEnterCheckpoint(playerid)
{
    print(
"OnPlayerEnterCheckpoint called");
    
printf("checkpointStage[playerid] = %d",checkpointStage[playerid]);
    
DisablePlayerCheckpoint(playerid);
    if(
checkpointStage[playerid] == 1)
    {
        print(
"checkpointStage[playerid] == 1");
        
checkpointStage[playerid] = 2;
        
SendClientMessage(playerid, -1"Pizza delivered, now go to next checkpoint."); //This gets sent, but I get no checkpoint
        
SetPlayerCheckpoint(playerid745.1824,-550.9210,17.17995);
        
printf("checkpointStage[playerid] == %d",checkpointStage[playerid]);
        return 
1;
    }
    else if(
checkpointStage[playerid] == 2)
    {
        print(
"checkpointStage[playerid] == 2");
        
checkpointStage[playerid] = 3;
         
SendClientMessage(playerid, -1"Pizza delivered, now go to next checkpoint.");
        
SetPlayerCheckpoint(playerid271.5015,-51.9949,1.97965);
    }
    return 
1;

Mencent
Код:
OnPlayerEnterCheckpoint called
checkpointStage[playerid] = 1
checkpointStage[playerid] == 1
checkpointStage[playerid] == 2
Reply
#17

So, I have test it. For me it works.
Код:
[22:01:13] OnPlayerEnterCheckpoint called
[22:01:13] checkpointStage[playerid] = 1
[22:01:13] checkpointStage[playerid] == 1
[22:01:13] checkpointStage[playerid] == 2
[22:02:29] OnPlayerEnterCheckpoint called
[22:02:29] checkpointStage[playerid] = 1
[22:02:29] checkpointStage[playerid] == 1
[22:02:29] checkpointStage[playerid] == 2
[22:03:46] OnPlayerEnterCheckpoint called
[22:03:46] checkpointStage[playerid] = 2
[22:03:46] checkpointStage[playerid] == 2
If that does not work for you, then add the code once in an empty game mode, and then test it. Does it work then?

Mencent
Reply
#18

Quote:
Originally Posted by Mencent
Посмотреть сообщение
So, I have test it. For me it works.
Код:
[22:01:13] OnPlayerEnterCheckpoint called
[22:01:13] checkpointStage[playerid] = 1
[22:01:13] checkpointStage[playerid] == 1
[22:01:13] checkpointStage[playerid] == 2
[22:02:29] OnPlayerEnterCheckpoint called
[22:02:29] checkpointStage[playerid] = 1
[22:02:29] checkpointStage[playerid] == 1
[22:02:29] checkpointStage[playerid] == 2
[22:03:46] OnPlayerEnterCheckpoint called
[22:03:46] checkpointStage[playerid] = 2
[22:03:46] checkpointStage[playerid] == 2
If that does not work for you, then add the code once in an empty game mode, and then test it. Does it work then?

Mencent
Yes, it works on empty gamemode, we are going to start over whole gamemode, any tips on how to avoid it next time? or any idea what is the problem?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)