[Tutorial] How to Make GPS system
#1

Includes

pawn Код:
#include <samp>
#include <zcmd>
#include <sscanf2>
Define
pawn Код:
#define COLOR_GREEN 0x008000FF // to define color so i don't need to put 0x008000FF code, i will simply put COLOR_GREEN
Commands
Now we will use zcmd to make /gps command

first let me show you some basic zcmd structure.

pawn Код:
CMD:/*command name*/(playerid,params[])
{
    // your codes, i already showed you the example
    return 1;
}
Therefore we can use it like that

pawn Код:
CMD:kill(playerid,params[])
{
    SetPlayerHealth(playerid,0);
    return 1;
}
You've notice that this command is to kill player,

similarly we will use the codes below to make a gps system(using zcmd)

pawn Код:
new targetid; //the player we will locate
    if(sscanf(params, "u", targetid)) return SendClientMessage(playerid, -1, "[USAGE]: /Gps [Part of Name/Player ID]"); // this defines as /Gps [id]
    if(IsPlayerConnected(targetid)) //to check if is player connected or not
pawn Код:
new Float:x, Float:y, Float:z; // code to detect player position
               GetPlayerPos(playerid, x, y, z); // ^
               SetPlayerMapIcon(playerid, 13, x, y, z, 62, 0, MAPICON_GLOBAL); // set a map icon for player , 13 is define as objectid, and 62 define as map icon
now we also need to add /gpsrem command to remove gps icon on map

for that create zcmd

pawn Код:
CMD:gpsrem(playerid,params[])
{
    RemovePlayerMapIcon(playerid, 13); // to rem player map icon(note: 13 is define as object id as i mentioned before)
    return 1;
}
so the whole code will look like this

pawn Код:
CMD:gps(playerid,params[])
    {
    new targetid; //the player we will locate
    if(sscanf(params, "u", targetid)) return SendClientMessage(playerid, -1, "[USAGE]: /Gps [Part of Name/Player ID]"); // this defines as /Gps [id]
    if(IsPlayerConnected(targetid)) //to check if is player connected or not
    {
    new Float:x, Float:y, Float:z; // code to detect player position
    GetPlayerPos(playerid, x, y, z); // ^
    SetPlayerMapIcon(playerid, 13, x, y, z, 62, 0, MAPICON_GLOBAL); // set a map icon for player , 12 is define as objectid, and 62 define as map icon
    SendClientMessage(playerid,COLOR_GREEN,"Last Time he was that location");
    }
    return 1;
}

CMD:gpsrem(playerid,params[])
{
    RemovePlayerMapIcon(playerid, 13); // to rem player map icon
    return 1;
}
Reply
#2

omg? what is that
Reply
#3

Quote:
Originally Posted by Gangster-rocks
Посмотреть сообщение
omg? what is that
Like that:
http://en.wikipedia.org/wiki/GPS_sys...iki/GPS_system
Btw Nice tutorial m8
Reply
#4

We can't see anything with this shit code please use [pawn] tags instead of [code] :O
Reply
#5

Done
Reply
#6

TUT re written
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)