Welcome!

Join our community of MMO enthusiasts and game developers! By registering, you'll gain access to discussions on the latest developments in MMO server files and collaborate with like-minded individuals. Join us today and unlock the potential of MMO server development!

Join Today!

[Tutorial] [SA:MP] Set markers on your radar via a command [GM](gamemode)

Super-Moderator
Staff member
Super-Moderator
Joined
Apr 28, 2007
Messages
1,498
Reaction score
756
Welcome to the SA:MP Marker tutorial.
In this tutorial I will teach you how to create a command which will set a marker if a player used that command. The marker will be set on the player's own,personal radar.

Explanation about all functions, commands, coordinates, whatever will be explained at the end of this tutorial, located below.



Tutorial recruitments:
  • Knowledge about commands (strcmp(""/command" etc)
  • Knowledge about the public function OnPlayerCommandText
Step 1
Find the line
Code:
 public OnPlayerCommandText(playerid, cmdtext[])
Shortkey: CTRL+F

If you found the line, you know how to add strcmp commands.
Enter this line:
Code:
 if (strmcp("/lspd", cmdtext, true, 5) == 0)
If you are done, head to Step 2.

Step 2
Now we have to open the content of the command we just made "/lspd".
The content is the functions/stuff we have to enter to let /lspd know what to do if someone enters that command.
We open the content with an opening bracket "{"
So, enter the bracket below the line we entered at Step 1.
Code:
{
If you are done, head to step 3.

Step 3
This is the content of the command /lspd.
We are going to use the SetPlayerCheckpoint function.
Explanation about it is located all way down in this thread.
Enter this line below the opening bracket we 'made' at Step 2,
Code:
 SetPlayerCheckpoint(playerid, 1545.914, -1675.846, 13.561, 3.0);
1545.914, -1675.846, 13.561, 3.0
float:X float:Y float:Z float:Size of the marker
Then we have to return the function with a value of 1.
Enter this line below the SetPlayerCheckpoint function we just 'made':
Code:
return 1;
If you are done, head to Step 4

Step 4
Now we have to close the content of the command "/lspd" in order to make the command work.
If we do not close this content, it will read all stuff below for the "/lspd" command. And usually that's stuff that doesn't fit there.
Enter the closing bracket "}" below the "return 1;" we entered at the end of Step 3.
Code:
}

Now we are done.


------
This is how it should look like if you finished this tutorial:

Code:
if (strmcp("/lspd", cmdtext, true, 5) == 0)
{
         SetPlayerCheckpoint(playerid, 1545.914, -1675.846, 13.561, 3.0);
         return 1;
}
_____________________________________________
Explanations____________________

----------------
Code:
if (strmcp("/lspd", cmdtext, true, 5) == 0
This line is obvious. Except the "5" next to "true,".
This might be new for people, or people saw it and never understood what it means.
The 5 means the amount of letters the command /lspd uses.
/ = 1
l = 2
s = 3
p = 4
d = 5

----------------
Code:
         SetPlayerCheckpoint(playerid, 1545.914, -1675.846, 13.561, 3.0);
This might be a function for unexperienced coders they do not know.
Code:
SetPlayerCheckpoint(playerid, x, y, z, 3.0);
SetPlayerCheckpoint is the function to set the marker on the rader.
But the function needs addintional information for that.
For example the one where the marker needs to be send to.
Here's some information about the information.
playerid - The ID of the player who wants the marker on his radar
float:X - The X coordinate of the marker
float:Y - The Y coordinate of the marker
float:Z - The Z coordinate of the marker
float:size - The size of the marker
For the people who do not know how to find coordinates, I will make a tutorial about that later. It's very simple.

---
This is the end of the tutorial.
Created by Biesmen


 
Last edited:
8===D
Loyal Member
Joined
Jan 19, 2009
Messages
613
Reaction score
96
Re: [Tutorial] [SA:MP] Set markers via a command [GM](gamemode)

Nice :D
 
Joined
Aug 15, 2006
Messages
944
Reaction score
53
Re: [Tutorial] [SA:MP] Set markers via a command [GM](gamemode)

Note: if you just want to say thanks or nice, please don't spam the thread with useless posts, instead use the thanks button.

Thank you.
 
Last edited:
Back
Top