Checkpoint help
#1

I have made one checkpoint that works (Got the help from people awhile back)

I wanted to add another one so i got this checkpoint streamer
http://forum.sa-mp.com/index.php?topic=35977.0

The problem i'm having is, I want to make a checkpoint that when you enter into it, it adds a menu to sell weapons.

I'm not sure how to make the menu, or how to add the weapons part, but when i add a checkpoint, it always links to my other checkpoint

So, when you enter the new checkpoint, it says the things the old checkpoints are suppose to say.

Heres the code for the old checkpoints properties and whats its suppose to do upon entering:

Код:
CPS_AddCheckpoint(2036.4734, -1402.9043,17.2983, 3.0,100); //hospital
Код:
if (strcmp("/heal", cmdtext, true, 10) == 0)
	{
    new Float:HP;
    GetPlayerHealth(playerid, HP);
    if (PlayerToPoint(2, playerid,2036.4734, -1402.9043,17.2983))
    {
    if(HP <= 99)
    {
    GivePlayerMoney(playerid,-100);
    SetPlayerHealth(playerid, 100.0);
    SendClientMessage(playerid, COLOR_GREEN, "You have been healed, Hospital bill was $100");
    }
    else
    {
    SendClientMessage(playerid, RED, "You do not require medical treatment!");
    }
    }
    else
    {
    SendClientMessage(playerid, RED, "To use that command you need to be at the hospital Type /hospital");
    }
	return 1;
 }
Код:
public OnPlayerEnterCheckpoint(playerid)
{
  GameTextForPlayer(playerid, "~w~Welcome to the Hospital, Type /Heal to heal your HP! it costs $100 ~G~", 5000, 5);
return 1;
}
This is the code for my new checkpoint and where it's located

CPS_AddCheckpoint(3867.2412, -1601.9069,1441.6368, 3.0,100);// weapons menu
Reply
#2

Use a timer to use PlayerToPoint to see if a player is close enough to each cp, if so, shwo the specific gametext for that position.
Reply
#3

Quote:
Originally Posted by Swift_
Use a timer to use PlayerToPoint to see if a player is close enough to each cp, if so, shwo the specific gametext for that position.
I want my new checkpoint
Код:
CPS_AddCheckpoint(3867.2412, -1601.9069,1441.6368, 3.0,100);// weapons menu
To say something like "welcome to the weapons shop"

But if i go to the new checkpoint, it says what my hospital is suppose to say, I'm not sure how to do timers and stuff, can you explain it a bit more. Thanks bro
Reply
#4

Something like the following
pawn Код:
//top of script
Check();

//after main()
public Check()
{
  for(new i = 0; i<GetMaxPlayers(); i++)
  {
   if(PlayerToPoint(i, x, y, z))
   {
     GameTextForPlayer(playerid, "blah blah blah blah", 5000, 5);
   }
   else if(PlayertoPoint(i, x, y, z))
   {
     GameTextForPlayer(playerid, "blah blah blah blah", 5000, 5);
   }
  }
}

//On GamemodeInit
SetTimer("Check", 1000, 1);
Reply
#5

Quote:
Originally Posted by killdahobo99
Код:
public OnPlayerEnterCheckpoint(playerid)
{
  GameTextForPlayer(playerid, "~w~Welcome to the Hospital, Type /Heal to heal your HP! it costs $100 ~G~", 5000, 5);
return 1;
}
Doesn't that checkpoint streamer has it own callback where it checks for checkpointids or something?
Reply
#6

Quote:
Originally Posted by Vince
Quote:
Originally Posted by killdahobo99
Код:
public OnPlayerEnterCheckpoint(playerid)
{
  GameTextForPlayer(playerid, "~w~Welcome to the Hospital, Type /Heal to heal your HP! it costs $100 ~G~", 5000, 5);
return 1;
}
Doesn't that checkpoint streamer has it own callback where it checks for checkpointids or something?
It does, but it works with what i have already, But the problem i'm having is, i dont no how to add multiple checkpoints that do different things, My checkpoints do the same things for 2 checkpoints
Reply
#7

Test the code I gave you.
Reply
#8

Quote:
Originally Posted by Swift_
Test the code I gave you.
I'm having trouble with the code you gave me, So i searched and found something else.

Heres the code:

Код:
new CP[MAX_PLAYERS];
(OnPlayerSpawn)
Код:
	if(CP[playerid] != 0) return 1;
  CPS_AddCheckpoint(2036.4734, -1402.9043,17.2983, 3.0,100); //hospital
  CP[playerid] = 1;
  
 	if(CP[playerid] != 1) return 1;
  CPS_AddCheckpoint(3867.2412, -1601.9069,1441.6368, 3.0,100);
 	CP[playerid] = 2;
  return 1;
}
Код:
public OnPlayerEnterCheckpoint(playerid)
{
   if(CP[playerid] == 1)
   {
    GameTextForPlayer(playerid, "~w~Welcome to the Hospital, Type /Heal to heal your HP! it costs $100 ~G~", 5000, 5);
   }
   else if(CP[playerid] == 2)
   {
     GameTextForPlayer(playerid, "~w~Welcome to the Weapon shop, Type /weapons to get weapons!~G~", 5000, 5);
   } 
   CP[playerid] = 0;
   return 1;
}
I got it from here:
http://forum.sa-mp.com/index.php?topic=77156.0

The problem i'm having is, When i enter the checkpoint (for the first time) it displays what i want it to, but after that it doesnt display it at all

Reply
#9

If you're using that method, then you don't need the streamer. The point of a checkpoint streamer is having multiple streamers on a mpa at once, so when you're close enough to one than another, it'll create. With what you're using, it'll only set a specific checkpoint if you set it that way, manually, thought the script.
Reply
#10

Quote:
Originally Posted by Swift_
If you're using that method, then you don't need the streamer. The point of a checkpoint streamer is having multiple streamers on a mpa at once, so when you're close enough to one than another, it'll create. With what you're using, it'll only set a specific checkpoint if you set it that way, manually, thought the script.
So is this method a bad way? like, Say someone is at the /hospital checkpoint, and someone is at my new checkpoint, will they both be able to see it?

If i use the streamer way, I'm not sure how to use your code, I'm not sure where to place it....
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)