SA-MP Forums Archive
Checkpoint !help! - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Checkpoint !help! (/showthread.php?tid=141842)



Checkpoint !help! - Assyria - 15.04.2010

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



Re: Checkpoint !help! - McSquizzy - 15.04.2010

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
}



Re: Checkpoint !help! - Cank - 15.04.2010

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



Re: Checkpoint !help! - McSquizzy - 15.04.2010

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


Re: Checkpoint !help! - Assyria - 15.04.2010

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...?


Re: Checkpoint !help! - McSquizzy - 16.04.2010

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