23.12.2012, 09:55
(
Last edited by Patrick; 27/12/2012 at 08:31 PM.
)
Hello guys today i am gonna show you how to make a simple gps system using RaceCheckpoint. because i tried Using Checkpoint it bugs you today i am going to release this tutorial. simple and easy when you learn how
You must also have zcmd Include by Zeex Download Link: https://sampforum.blast.hk/showthread.php?tid=91354 if you dont have one
if you are using dcmd make sure you have
This here, is ensuring that you are using the command processor that is by Zeex. You must have the zcmd.inc from the download page which is linked at the top of this tutorial, inside of your "Pawno\includes" folder, if you don't you will have an error saying that it can't read from the file. Just like this:
Then after all of that lets just define the color yellow.
if you didn't define some error will show
You already have that? Lets begin!!
1st - we need to get all X,Y,Z position 'how to get those? enter command go ingame and type the /save [TEXT] it will directly save to your
Documents/GTA San Andreas User Files/SAMP/savedpositions.txt' or if you are lazy you can use Xtremer xyzTaker Download Link: http://forum.sa-mp.com/showthread.ph...light=xyzTaker
after you got all of your positions/X,Y,Z now!
2nd- we need to make DIALOG so player can choose different location where they want to go.
At The Top
After that
Ctrl + G and search public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
Have you found it? lets Begin making DIALOG
After that we need to make a command so player can open the dialog
i will make 3 different commands that i know
strcmp
dcmd
zcmd
After you done the commands. lets move on to the public OnPlayerEnterRaceCheckpoint(playerid)
when player arrives at destination
Extra Command: to turn your GPS off
strcmp
dcmd
zcmd
You must also have zcmd Include by Zeex Download Link: https://sampforum.blast.hk/showthread.php?tid=91354 if you dont have one
pawn Code:
#include <zcmd>
pawn Code:
#define dcmd(%1,%2,%3) if (!strcmp((%3)[1], #%1, true, (%2)) && ((((%3)[(%2) + 1] == '\0') && (dcmd_%1(playerid, ""))) || (((%3)[(%2) + 1] == ' ') && (dcmd_%1(playerid, (%3)[(%2) + 2]))))) return 1
pawn Code:
fatal error 100: cannot read from file: "zcmd"
pawn Code:
#define COLOR_YELLOW 0xFFFF00AA
Code:
Undefined "COLOR_YELLOW"
1st - we need to get all X,Y,Z position 'how to get those? enter command go ingame and type the /save [TEXT] it will directly save to your
Documents/GTA San Andreas User Files/SAMP/savedpositions.txt' or if you are lazy you can use Xtremer xyzTaker Download Link: http://forum.sa-mp.com/showthread.ph...light=xyzTaker
after you got all of your positions/X,Y,Z now!
2nd- we need to make DIALOG so player can choose different location where they want to go.
At The Top
pawn Code:
#define DIALOG_GPS 1 //Change this if you already defined a dialog to 1
Ctrl + G and search public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
Have you found it? lets Begin making DIALOG
pawn Code:
if(dialogid == DIALOG_GPS)//if player types /gps the dialog will pop up
{
if(response)
{
if(listitem == 0)
{
SetPlayerRaceCheckpoint(playerid, 2,X,Y,Z, 0.0,0.0,0.0, 3.0);//only change the X,Y,Z | you can touch it if you know what you are doing
SendClientMessage(playerid, -1,"Follow the red mark on your map");//so player will know what will he follow
}
}
}
i will make 3 different commands that i know
Code:
zcmd, dcmd, strmp
pawn Code:
if (strcmp("/gps", cmdtext, true, 10) == 0)
{
if(!IsPlayerInAnyVehicle(playerid))
{
SendClientMessage(playerid,0xAFAFAFAA,"You're not in a vehicle");
return 1;
}
ShowPlayerDialog(playerid, DIALOG_GPS, DIALOG_STYLE_LIST,"GPS System","Location","Choose","Cancel");
SendClientMessage(playerid,COLOR_YELLOW,"To Cancel Gps use /gpsoff");
return 1;
return 1;
}
pawn Code:
public OnPlayerCommandText(playerid, cmdtext[])
{
dcmd(gps,3,cmdtext);
return 0;
}
dcmd_gps(playerid, params[])
{
#pragma unused params
if(!IsPlayerInAnyVehicle(playerid))
{
SendClientMessage(playerid,0xAFAFAFAA,"You're not in a vehicle");
return 1;
}
ShowPlayerDialog(playerid, DIALOG_GPS, DIALOG_STYLE_LIST,"GPS System","Locations,"Choose","Cancel");
SendClientMessage(playerid,COLOR_YELLOW,"To Cancel Gps use /gpsoff");
return 1;
}
return 1;
}
pawn Code:
cmd(gps, playerid, params[])
{
if(!IsPlayerInAnyVehicle(playerid))
{
SendClientMessage(playerid,0xAFAFAFAA,"You're not in a vehicle");
return 1;
}
ShowPlayerDialog(playerid, DIALOG_GPS, DIALOG_STYLE_LIST,"GPS System","Location","Choose","Cancel");
SendClientMessage(playerid,COLOR_YELLOW,"To Cancel Gps use /gpsoff");
return 1;
}
return 1;
}
when player arrives at destination
pawn Code:
public OnPlayerEnterRaceCheckpoint(playerid)
{
GameTextForPlayer(playerid,"You Have Arrived At Your Destination",3000,5);//Show's a gametext
DisablePlayerRaceCheckpoint(playerid);//Disable The Current Checkpoint
return 1;
}
strcmp
pawn Code:
if (strcmp("gpsoff", cmdtext, true, 10) == 0)
{
DisablePlayerRaceCheckpoint(playerid);//Disable The Current Checkpoint
return 1;
}
pawn Code:
public OnPlayerCommandText(playerid, cmdtext[])
{
dcmd(gpsoff,6,cmdtext);
return 0;
}
dcmd_gpsoff(playerid, params[])
{
DisablePlayerRaceCheckpoint(playerid);//Disable The Current Checkpoint
return 1;
}
pawn Code:
cmd(gpsoff, playerid, params[])
{
DisablePlayerRaceCheckpoint(playerid);//Disable The Current Checkpoint
return 1;
}