Red marker dialog menu
#1

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?
Reply
#2

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;
}
Reply
#3

yes download cpstream.inc
and use onplayerentercheckpoint
Reply
#4

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
Reply
#5

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.
Reply
#6

Quote:
Originally Posted by Gammix
Посмотреть сообщение
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
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;
}
Reply
#7

You must set a string to set the position, then if it change do the action on {
}
Reply
#8

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.
Reply
#9

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
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)