Making a /map
#1

I've been trying to make a /map that brings up a dialogue and sets a SetPlayerCheckpoint on the mini map.

The command code I made works and is here:
Код:
// The map.
 //Disable Checkpoint
 if (strcmp("/kc", cmdtext, true) == 0)
 	{
	 	DisablePlayerCheckpoint(playerid);
	 	SendClientMessage(playerid, COLOR_YELLOW, "You disabled your checkpoint.");


	    return 1;
 	}
//Main Command
 if (strcmp("/map", cmdtext, true) == 0)
 	{
	 	ShowPlayerDialog(playerid, 1024, DIALOG_STYLE_LIST, "Map", "SAPD\nCity Hall\nAD Agency\nDMV\n24/7\nDMV\nArms Dealer\nTransFender\nPrison\nUnity Station\nBank\nVehicle Dealership\nMotel\nPig Pen (Whore Job)\nClothes (Binco)\nGym (Bodyguard)\nFire Department\nAirport\nLawyer", "Close", "");
	 	format(string, sizeof(string), "%s pulls out map from their pocket. ((/map))", PlayerName(playerid));
        ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);

	    return 1;
 	}
For each point I have a simple
Код:
SendClientMessage(playerid, COLOR_YELLOW, "Please follow the red triangle on your gps ((Mini-Map)) | Use /kc to cancel.");
SetPlayerCheckpoint(playerid, 1481.4309,-1749.9603,15.4453,178.5093, 4.0);
But I can't work out how to create a dialog that will work properly, when I try, it just creates loads of errors and crashes the compiler. I know this is really simple stuff, but I'm a bit of a pawn noob, any help would be awesome!

- WGDM
Reply
#2

Show us your OnDialogResponse please
Reply
#3

https://sampwiki.blast.hk/wiki/How_to_Create_a_Dialog

Basically, all you need to do is:

Step 1: Define the ID of the dialog you are creating. It's used to distinguish between responses to different dialogs. For now, say you do:
pawn Код:
#define DIALOG_MAP_SHOW 12516
Step 2: Show it
pawn Код:
ShowPlayerDialog(playerid, DIALOG_MAP_SHOW, DIALOG_TYPE, .....);
Step 3: Get it's response and work with it.
pawn Код:
public OnDialogResponse( .. ) {
if(dialogid == DIALOG_MAP_SHOW)
{
      // Do all that stuff with "inputtext" because that is what the user INPUT in the dialog
      // Like setting checkpoints
}
return 1;
}
Easy, eh?
Reply
#4

Its rather large because of the gamemode dialogues, but
Quote:

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(IsPlayerNPC(playerid))
{
printf("OnDialogResponse: BotKick: %d", playerid);
Kick(playerid);
return 1;
}

I then copied one of the if(dialogid == xxx) and renamed it to 1024 (what I specified for the /map cmd)
Quote:

if(dialogid == 1024) // MapDialog
{
if(response == 1)
{
switch(listitem)
{
case 0: /* LSPD */
{
SendClientMessage(playerid, COLOR_YELLOW, "Please follow the red triangle on your gps ((Mini-Map)) | Use /kc to cancel.");
SetPlayerCheckpoint(playerid, 1545.4938,-1675.8000,13.5605,98.9219, 4.0);

}
case 1: /* City Hall */
{
SendClientMessage(playerid, COLOR_YELLOW, "Please follow the red triangle on your gps ((Mini-Map)) | Use /kc to cancel.");
SetPlayerCheckpoint(playerid, 1481.4309,-1749.9603,15.4453,178.5093, 4.0);
}
case 2: /* AD */
{
SendClientMessage(playerid, COLOR_YELLOW, "Please follow the red triangle on your gps ((Mini-Map)) | Use /kc to cancel.");
SetPlayerCheckpoint(playerid, 1413.9763,-1700.6448,13.5395,57.8748, 4.0);
}

}
}
}

Reply
#5

What I'm confused about is how to create multiple items, having each list item trigger a different checkpoint
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)