Checkpoint help
#1

Well, I'm making some bus route script.
I already made it, but there are some problems, see below please

Код:
new Bus1;
new Bus2;
new Bus3;
new Bus4;
Код:
if(strcmp(cmd, "/bus", true) == 0)
		{
    Bus1 = SetPlayerCheckpoint(playerid, 2369.2412,1984.2220,10.8203, 3.0);
		SendClientMessage(playerid, COLOR_WHITE, "Go to each checkpoints around Las Vanturas, if you work hard, you can get some money" );
		}
Код:
public OnPlayerEnterCheckpoint(playerid)
{
	if(IsPlayerInCheckpoint(playerid) == Bus1)
  {
    GivePlayerMoney(playerid, 2);
    DisablePlayerCheckpoint(playerid);
    Bus2 = SetPlayerCheckpoint(playerid, 2369.2412,1984.2220,10.8203, 3.0);
  }
  if (IsPlayerInCheckpoint(playerid) == Bus2)
  {
    GivePlayerMoney(playerid, 2);
    DisablePlayerCheckpoint(playerid);
    Bus3 = SetPlayerCheckpoint(playerid, 2102.0513,2257.3037,11.0234, 3.0);
  }
  if (IsPlayerInCheckpoint(playerid) == Bus3)
  {
    GivePlayerMoney(playerid, 20);
    DisablePlayerCheckpoint(playerid);
    Bus4 = SetPlayerCheckpoint(playerid, 2019.4841,1916.2048,12.3330, 3.0);

  }
  if (IsPlayerInCheckpoint(playerid) == Bus4)
  {
    GivePlayerMoney(playerid, 20);
    DisablePlayerCheckpoint(playerid);
    SendClientMessage(playerid, red, "You served Las Vanturas as well!! here some money, but now I advice you to get this bus back...");
    SendClientMessage(playerid, red, "or continue working with it, without checkpoints.");
  }

  return 1;
}
When the player goes to bus1 checkpoint, it works as well and he gets next checkpoint, but when he goes to next one, the checkpoint doesn't move, I found out the problem which it shouldn't be "if" function in "OnPlayerEnterCheckpoint", I don't know how to make it reaching in ever checkpoint.
Reply
#2

// top of script
pawn Код:
#define Bus1 2369.2412,1984.2220,10.8203
#define Bus2 2102.0513,2257.3037,11.0234
#define Bus3 2019.4841,1916.2048,12.3330
#define Bus4 Last Cordinates Here
// OnPlayerCommandText
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
if(strcmp(cmd, "/bus", true) == 0)
{
SetPlayerCheckpoint(playerid, Bus1, 3.0);
SendClientMessage(playerid, COLOR_WHITE, "Go to each checkpoints around Las Vanturas, if you work hard, you can get some money" );
}
return 0;
}
// ONplayerEnterCheckpoint
pawn Код:
public OnPlayerEnterCheckpoint(playerid)
{
if (IsPlayerInRangeOfPoint(playerid, 3.0,Bus1))
{
SetPlayerCheckpoint(playerid, Bus2, 3.0);
PlayerPlaySound(playerid,1058,0.0,0.0,0.0);
}
if (IsPlayerInRangeOfPoint(playerid, 3.0,Bus2))
{
SetPlayerCheckpoint(playerid, Bus3, 3.0);
PlayerPlaySound(playerid,1058,0.0,0.0,0.0);
}
if (IsPlayerInRangeOfPoint(playerid, 3.0,Bus3))
{
SetPlayerCheckpoint(playerid, Bus4, 3.0);
PlayerPlaySound(playerid,1058,0.0,0.0,0.0);
}
if (IsPlayerInRangeOfPoint(playerid, 3.0,Bus4))
{
SendClientMessage(playerid, COLOR_WHITE, "This Is All !!!" );
GivePlayerMoney(playerid, 20);
DisablePlayerCheckpoint(playerid);
PlayerPlaySound(playerid,1058,0.0,0.0,0.0);
}
}
Hope it helped




Reply
#3

Personally, I use:

pawn Код:
new Checkpoint[MAX_PLAYERS];
And I do this:

pawn Код:
cmd(bus, playerid, params[])
{
Checkpoint[playerid] = 1;
return 1;
}
and..

pawn Код:
OnPlayerEnterCheckpoint(playerid)
{
if(Checkpoint[playerid] == 1)
{
//blah
}
else if(Checkpoint[playerid] == 2)
{
//blah
}
//..et cetera
return 1;
}
Reply
#4

Your way is Unknown for me
Reply
#5

Quote:
Originally Posted by » Titan «
// top of script
pawn Код:
#define Bus1 2369.2412,1984.2220,10.8203
#define Bus2 2102.0513,2257.3037,11.0234
#define Bus3 2019.4841,1916.2048,12.3330
#define Bus4 Last Cordinates Here
// OnPlayerCommandText
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
if(strcmp(cmd, "/bus", true) == 0)
{
SetPlayerCheckpoint(playerid, Bus1, 3.0);
SendClientMessage(playerid, COLOR_WHITE, "Go to each checkpoints around Las Vanturas, if you work hard, you can get some money" );
}
return 0;
}
// ONplayerEnterCheckpoint
pawn Код:
public OnPlayerEnterCheckpoint(playerid)
{
if (IsPlayerInRangeOfPoint(playerid, 3.0,Bus1))
{
SetPlayerCheckpoint(playerid, Bus2, 3.0);
PlayerPlaySound(playerid,1058,0.0,0.0,0.0);
}
if (IsPlayerInRangeOfPoint(playerid, 3.0,Bus2))
{
SetPlayerCheckpoint(playerid, Bus3, 3.0);
PlayerPlaySound(playerid,1058,0.0,0.0,0.0);
}
if (IsPlayerInRangeOfPoint(playerid, 3.0,Bus3))
{
SetPlayerCheckpoint(playerid, Bus4, 3.0);
PlayerPlaySound(playerid,1058,0.0,0.0,0.0);
}
if (IsPlayerInRangeOfPoint(playerid, 3.0,Bus4))
{
SendClientMessage(playerid, COLOR_WHITE, "This Is All !!!" );
GivePlayerMoney(playerid, 20);
DisablePlayerCheckpoint(playerid);
PlayerPlaySound(playerid,1058,0.0,0.0,0.0);
}
}
Hope it helped




Thanks dude, gonna try later!
Quote:
Originally Posted by Sky4D
Personally, I use:

pawn Код:
new Checkpoint[MAX_PLAYERS];
And I do this:

pawn Код:
cmd(bus, playerid, params[])
{
Checkpoint[playerid] = 1;
return 1;
}
and..

pawn Код:
OnPlayerEnterCheckpoint(playerid)
{
if(Checkpoint[playerid] == 1)
{
//blah
}
else if(Checkpoint[playerid] == 2)
{
//blah
}
//..et cetera
return 1;
}
I personelly, didn't understand anything from your script.
Reply
#6

Quote:
Originally Posted by samuel_hamza
I personelly, didn't understand anything from your script.
That's quite alright, just thought i'd give you the way I do things, and see if you liked it better. Glad to see you found your answer.
Reply
#7

Quote:
Originally Posted by Sky4D
Quote:
Originally Posted by samuel_hamza
I personelly, didn't understand anything from your script.
That's quite alright, just thought i'd give you the way I do things, and see if you liked it better. Glad to see you found your answer.
Thanks.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)