[Include] [INC] CPS - CheckPoint Streamer by DragSta
#21


Ok I have a question , I want to use the use checkpoint for enableing menu's.
How exactly would that look?

Something more like:

Код:
new checkpoint;
Код:
checkpoint = CreateCheckpoint();
Код:
Public OnPlayerEnterStreamedCheckpoint(playerid, streamid);
{
 if(streamid = checkpoint)
 {
 ShowMenuForPlayer(blabla, playerid);
 }
 return 1;
}
Any suggestions for using your streamer in the best way?
Reply
#22

Yeah thats basically it, obviously you need to fill CreateCheckpoint in.
Also your callback is slightly broken, try this:
pawn Код:
public OnPlayerEnterStreamedCheckpoint(playerid, streamid)
{
  if(streamid == checkpoint)
  {
    ShowMenuForPlayer(blabla, playerid);
    return 1;
  }
  return 1;
}
Reply
#23

Good job Dragsta!
Reply
#24

You have any idea what's may causing this ? Because I did everything in the way you told in the first post.

Код:
D:\SA MP servers\RolePlay 0.2.2\pawno\include\cps.inc(140) : warning 208: function with tag result used before definition, forcing reparse
EDIT:

And I do have SyncCheckpoints(playerid); under ClearVars(playerid); at OnPlayerConnect.


Reply
#25

Dragsta had to disable something in the include to make it work, which causes this warning. Just ignore it
Reply
#26

Quote:
Originally Posted by Mikep
Dragsta had to disable something in the include to make it work, which causes this warning. Just ignore it
I hate warnings -.- , but if it aint my mistake I don't mind :P
Reply
#27

Quote:
Originally Posted by Biofreeze
Quote:
Originally Posted by Mikep
Dragsta had to disable something in the include to make it work, which causes this warning. Just ignore it
I hate warnings -.- , but if it aint my mistake I don't mind :P
Yeah its my mistake, I tried to fix it (using Westie's fix posted on the first page) but it stopped the function from working at all so I gave up
Still works perfectly.
Reply
#28

Quote:
Originally Posted by DragSta
Quote:
Originally Posted by Biofreeze
Quote:
Originally Posted by Mikep
Dragsta had to disable something in the include to make it work, which causes this warning. Just ignore it
I hate warnings -.- , but if it aint my mistake I don't mind :P
Yeah its my mistake, I tried to fix it (using Westie's fix posted on the first page) but it stopped the function from working at all so I gave up
Still works perfectly.
Yes I tested it and I'm using , and im still very pleased
Reply
#29

Uhm I encountered a small problem , the checkpoints only activate the menu when I walk through it . When other players walk through my 3 streamed checkpoints , nothing happens :S. They are able to see the checkpoint , but it does not enable the menu for them.

Code >

Код:
public OnPlayerEnterStreamedCheckpoint(playerid, streamid)
{
if(streamid == chickencp1)
{
ShowMenuForPlayer(foodmenu, playerid);
TogglePlayerControllable(playerid,0);
return 1;
}
return 1;
}
Reply
#30

Quote:
Originally Posted by Biofreeze
Uhm I encountered a small problem , the checkpoints only activate the menu when I walk through it . When other players walk through my 3 streamed checkpoints , nothing happens :S. They are able to see the checkpoint , but it does not enable the menu for them.

Code >

Код:
public OnPlayerEnterStreamedCheckpoint(playerid, streamid)
{
if(streamid == chickencp1)
{
ShowMenuForPlayer(foodmenu, playerid);
TogglePlayerControllable(playerid,0);
return 1;
}
return 1;
}
Hmm I havent encountered that problem before, let me do some research and I will get back to you with a resolution...Hopefully.
Reply
#31

Quote:
Originally Posted by [eX
Klutty ]
Code:
if(streamid == dockCP && modelid == infernus))
Pfft, modelid = infernus. FAIL! XD
Replace the "infernus" with "411".
Reply
#32

Quote:
Originally Posted by еddy
Quote:
Originally Posted by [eX
Klutty ]
Code:
if(streamid == dockCP && modelid == infernus))
Pfft, modelid = infernus. FAIL! XD
Replace the "infernus" with "411".
maybe he just did somewhere before
#define infernus 411
and that surly wasnt the reason for the error
Reply
#33

Quote:
Originally Posted by ♣ ⓐⓢⓢ
Quote:
Originally Posted by еddy
Quote:
Originally Posted by [eX
Klutty ]
Code:
if(streamid == dockCP && modelid == infernus))
Pfft, modelid = infernus. FAIL! XD
Replace the "infernus" with "411".
maybe he just did somewhere before
#define infernus 411
and that surly wasnt the reason for the error
Maybe you're right, and maybe not.

@Klutty: Try this:

Code:
if(streamid == dockCP && modelid == infernus) // With infernus, 411, or whatever you want. >_<
Reply
#34

Quote:
Originally Posted by еddy
Quote:
Originally Posted by ♣ ⓐⓢⓢ
Quote:
Originally Posted by еddy
Quote:
Originally Posted by [eX
Klutty ]
Code:
if(streamid == dockCP && modelid == infernus))
Pfft, modelid = infernus. FAIL! XD
Replace the "infernus" with "411".
maybe he just did somewhere before
#define infernus 411
and that surly wasnt the reason for the error
Maybe you're right, and maybe not.

@Klutty: Try this:

Code:
if(streamid == dockCP && modelid == infernus) // With infernus, 411, or whatever you want. >_<
I have an include so I can write vehicle names instead of wandering around SA-MP wiki for id's.

EDIT: Thanks, it works.
Reply
#35

Sorry for double post.

When I enter the checkpoint with an infernus im supposed to get 100.000, but I dont get that money when I enter..

My code:

Code:
public OnPlayerEnterStreamedCheckpoint(playerid, streamid)
{
  new modelid = GetVehicleModel(GetPlayerVehicleID(playerid));
	if(streamid == dockCP && modelid == 411)
	{
	GivePlayerMoney(playerid, 100000);
	new string[128];
	new playername[MAX_PLAYER_NAME];
	GetPlayerName(playerid,playername,sizeof(playername));
	format(string, sizeof(string), "%s has won the event!",playername);
	SendClientMessageToAll(COLOR_LIGHTBLUE,string);
	DestroyCheckpoint(dockCP);
	}
	else
	{
	SendClientMessage(playerid,COLOR_BRIGHTRED,"ERROR: Wrong car! This is not an infernus!");
	}
	return 1;
}
Reply
#36

Quote:
Originally Posted by [eX
Klutty ]
Sorry for double post.

When I enter the checkpoint with an infernus im supposed to get 100.000, but I dont get that money when I enter..

My code:

Code:
public OnPlayerEnterStreamedCheckpoint(playerid, streamid)
{
  new modelid = GetVehicleModel(GetPlayerVehicleID(playerid));
	if(streamid == dockCP && modelid == 411)
	{
	GivePlayerMoney(playerid, 100000);
	new string[128];
	new playername[MAX_PLAYER_NAME];
	GetPlayerName(playerid,playername,sizeof(playername));
	format(string, sizeof(string), "%s has won the event!",playername);
	SendClientMessageToAll(COLOR_LIGHTBLUE,string);
	DestroyCheckpoint(dockCP);
	}
	else
	{
	SendClientMessage(playerid,COLOR_BRIGHTRED,"ERROR: Wrong car! This is not an infernus!");
	}
	return 1;
}
Try to add the GivePlayerMoney above the DestroyCheckpoint.
Reply
#37

Quote:
Originally Posted by еddy
Quote:
Originally Posted by [eX
Klutty ]
Sorry for double post.

When I enter the checkpoint with an infernus im supposed to get 100.000, but I dont get that money when I enter..

My code:

Code:
public OnPlayerEnterStreamedCheckpoint(playerid, streamid)
{
  new modelid = GetVehicleModel(GetPlayerVehicleID(playerid));
	if(streamid == dockCP && modelid == 411)
	{
	GivePlayerMoney(playerid, 100000);
	new string[128];
	new playername[MAX_PLAYER_NAME];
	GetPlayerName(playerid,playername,sizeof(playername));
	format(string, sizeof(string), "%s has won the event!",playername);
	SendClientMessageToAll(COLOR_LIGHTBLUE,string);
	DestroyCheckpoint(dockCP);
	}
	else
	{
	SendClientMessage(playerid,COLOR_BRIGHTRED,"ERROR: Wrong car! This is not an infernus!");
	}
	return 1;
}
Try to add the GivePlayerMoney above the DestroyCheckpoint.
It is already above that.
Reply
#38

Quote:
Originally Posted by [eX
Klutty ]
It is already above that.
No, I mean:

Code:
SendClientMessageToAll(COLOR_LIGHTBLUE,string);
GivePlayerMoney(playerid, 100000);
DestroyCheckpoint(dockCP);
Above the DestroyCheckpoint, and below the SendClientMessageToAll.
Reply
#39

DestroyCheckpoint() won't work for me...
Reply
#40

If you get the error "function with tag result used before definition, forcing reparse" then you need to open the cp.inc file go at the bottom of the script and uncomment this:

Code:
forward Float:DistanceBetweenPoints(Float:x11, Float:y11, Float:z11, Float:x22, Float:y22, Float:z22);
Hope this helps
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)