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

Results 1 to 4 of 4
  1. #1
    01010010 01011010 Biesmen is offline
    Super ModRank
    Apr 2007 Join Date
    2,517Posts

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

    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 by Biesmen; 20-06-10 at 06:31 PM.


  2. #2
    8===D Hubba is offline
    MemberRank
    Jan 2009 Join Date
    CanadaLocation
    1,009Posts

    Re: [Tutorial] [SA:MP] Set markers via a command [GM](gamemode)

    Nice :D

  3. #3
    Account Upgraded | Title Enabled! Zaat is offline
    MemberRank
    Apr 2010 Join Date
    Local Disk (C:)Location
    219Posts

    Re: [Tutorial] [SA:MP] Set markers via a command [GM](gamemode)

    Nice release :)

  4. #4
    Alpha Member bramdebouvere is offline
    MemberRank
    Aug 2006 Join Date
    BelgiumLocation
    2,409Posts

    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 by bramdebouvere; 22-06-10 at 12:05 AM.



Advertisement