Red marker dialog menu -
DavidSparks - 20.06.2015
I have seen in servers that if you come closer to certain locations, a small red checkpoint pops up and if you walk inside it a dialog opens.
Anyone knows how to do this?
Re: Red marker dialog menu -
Rodri99 - 20.06.2015
Yes thats easy.
Example:
public OnPlayerEnterCheckpoint(playerid)
{
if(CP1 == 1) {
new dwg[1024];
strcat(dwg,"{00FF00}--------- PizzaBoy Job ---------\n\n");
strcat(dwg,"{FFFFFF}Do you want to be a PizzaBoy Delivery ?\n");
strcat(dwg,"{FFFFFF}Chose 'Yes' if you want , and chose 'No' if you don't want.\n\n\n");
strcat(dwg,"{FF0000}Job Salary : {1F45FC}$7000 + 13 score\n");
ShowPlayerDialog(playerid, DIALOG_PIZZA, DIALOG_STYLE_MSGBOX, "{FF0000}Jobs", dwg, "Yes", "No");
CarSpawner(playerid,44
;
}
Re: Red marker dialog menu -
UltraScripter - 20.06.2015
yes download cpstream.inc
and use onplayerentercheckpoint
Re: Red marker dialog menu -
Gammix - 20.06.2015
First you need to detect if the player is near the desired location, use this under a callback like OnPlayerPosChange (not a SAMP function but can be found here:
https://sampforum.blast.hk/showthread.php?tid=573961)
https://sampwiki.blast.hk/wiki/IsPlayerInRangeOfPoint
Now when the player is near, use this:
https://sampwiki.blast.hk/wiki/Function:SetPlayerCheckpoint
To make a dialog open up whenever the player enters the CP, use this callback:
https://sampwiki.blast.hk/wiki/OnPlayerEnterCheckpoint
Or Streamer plugin may help you:
https://sampforum.blast.hk/showthread.php?tid=102865
Re: Red marker dialog menu -
Rodri99 - 20.06.2015
He can do also without an .inc, but just using a 'MUST' so like my script, when you reach this checkpoint the dialog appear in game.
Re: Red marker dialog menu -
DavidSparks - 20.06.2015
Quote:
Originally Posted by Gammix
|
Looks great, can you just show me how to use
Код:
public OnPlayerPosChange(playerid, Float:newx, Float:newy, Float:newz, Float:oldx, Float:oldy, Float:oldz)
{
return 1;
}
Re: Red marker dialog menu -
Rodri99 - 20.06.2015
You must set a string to set the position, then if it change do the action on {
}
Re: Red marker dialog menu -
Gammix - 20.06.2015
Quote:
Originally Posted by DavidSparks
Looks great, can you just show me how to use
Код:
public OnPlayerPosChange(playerid, Float:newx, Float:newy, Float:newz, Float:oldx, Float:oldy, Float:oldz)
{
return 1;
}
|
It's pretty simple, i already gave you the link to IsPlayerInRangeOfPoint. So simply check if the player is near to the coordinates and create a checkpoint.
For example:
pawn Код:
public OnPlayerPosChange(playerid, Float:newx, Float:newy, Float:newz, Float:oldx, Float:oldy, Float:oldz)
{
if(IsPlayerInRangeOfPoint(playerid, 50.0, x, y, z))
{
SetPlayerCheckpoint(playerid, x, y, z);
}
return 1;
}
NOTE:
x, y, z are the coordinates of your checkpoint.
Now when the player is in range of the point (x, y, z), a checkpoint appears.
To show dialog:
pawn Код:
public OnPlayerEnterCheckpoint(playerid)
{
if(IsPlayerInRangeOfPoint(playerid, 5.0, x, y, z))
{
ShowPlayerDialog(playerid, ...);
}
return 1;
}
The callback is self explanatory.
Re: Red marker dialog menu -
DavidSparks - 20.06.2015
Quote:
Originally Posted by Gammix
It's pretty simple, i already gave you the link to IsPlayerInRangeOfPoint. So simply check if the player is near to the coordinates and create a checkpoint.
For example:
pawn Код:
public OnPlayerPosChange(playerid, Float:newx, Float:newy, Float:newz, Float:oldx, Float:oldy, Float:oldz) { if(IsPlayerInRangeOfPoint(playerid, 50.0, x, y, z)) { SetPlayerCheckpoint(playerid, x, y, z); } return 1; }
NOTE: x, y, z are the coordinates of your checkpoint.
Now when the player is in range of the point (x, y, z), a checkpoint appears.
To show dialog:
pawn Код:
public OnPlayerEnterCheckpoint(playerid) { if(IsPlayerInRangeOfPoint(playerid, 5.0, x, y, z)) { ShowPlayerDialog(playerid, ...); } return 1; }
The callback is self explanatory.
|
Thank you! +rep