Checkpoint !help!
#1

Hello!

Actually im first time using Checkpoints and I have one question:

If I make two checkpoints, for first one I want so when you enter the first checkpoint -> comes message "This is the first checkpoint!" and when you enter the second checkpoint -> comes message "This is the second added Checkpoint!"

Should be easy and simple to make, ha? Give me example and I get in speed.

Regards,
Assyria
Reply
#2

Make a variable for example
pawn Код:
new Checkpoint[MAX_PLAYERS] = 0;
When you setting checkpoint do this
pawn Код:
Checkpoint[playerid] = 1;
In OnPlayerEnterCheckPoint
pawn Код:
if(Checkpoint[playerid] == 1)
{
 //Your Text here...
 //Setting second checkpoint
 Checkpoint[playerid] = 2;
}
else if(Checkpoint[playerid] == 2)
{
 //Your second text here
 //Another checkpoint if nedeed
}
Reply
#3

hm, this solution would work but its not the best, because when you -lets say- have 50 checkpoints you need to write 49 "else if" checks.

i would do something like this:

Код:
new cpcounter[MAX_PLAYERS], string[50];
OnPlayerEnterCheckponint:

Код:
DisablePlayerCheckpoint(playerid);
cpcounter[playerid]++;
format(string, sizeof(string), "This is Checkpoint number %d", cpcounter[playerid]);
SendClientMessage(playerid, red, string);
SetPlayerCheckpoint(*your coords*);
so you can use as many chaeckpoints as you need without huge loads of code
Reply
#4

Know that) But as you writted isn't fully working. And for the newbie my solution is easier In your solution you need to do massives with checkpoints and other things
Reply
#5

You mean like this?:
Код:
if(strcmp("/meow", cmdtext, true) == 0)
	{
    Checkpoint[playerid] = 1;
    SendClientMessage(playerid, COLOR_RED, "placed meow");
		SetPlayerCheckpoint(playerid,X,Y,Z,Size);
		}
	return 1;
	}
Код:
public OnPlayerEnterCheckpoint(playerid)
{
  if(Checkpoint[playerid] == 1)
{
	SendClientMessage(playerid,COLOR_RED,"meow");
  	SetPlayerCheckpoint(playerid,2645.297, -2018.093, 13.323,3); <- Next Checkpoint
}
Correct or total wrong? Please show me better what do you mean, if this isnt how...?
Reply
#6

Before, in the top of mod:
pawn Код:
new Checkpoint[MAX_PLAYERS];
Command:
pawn Код:
if(strcmp("/meow", cmdtext, true) == 0)
{
    Checkpoint[playerid] = 1;
    SendClientMessage(playerid, COLOR_RED, "placed meow");
    SetPlayerCheckpoint(playerid,X,Y,Z,Size);
    return 1;
}
pawn Код:
public OnPlayerEnterCheckpoint(playerid)
{
  if(Checkpoint[playerid] == 1)
  {
    Checkpoint[playerid] = 2; // If you want to write something when player enters next checkpoint
    SendClientMessage(playerid,COLOR_RED,"meow");
    SetPlayerCheckpoint(playerid,2645.297, -2018.093, 13.323,3); <- Next Checkpoint
  }
  else if(Checkpoint[playerid] == 2)
  {
Checkpoint[playerid] = 3; // If you want to write something when player enters next checkpoint
    SendClientMessage(playerid,COLOR_RED,"meow 2");
    SetPlayerCheckpoint(playerid,2645.297, -2018.093, 13.323,3); <- Next Checkpoint  
   }
}
And like that
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)