03.11.2012, 04:48
(
Последний раз редактировалось verlaj; 03.11.2012 в 14:10.
)
Includes
Define
Commands
Now we will use zcmd to make /gps command
first let me show you some basic zcmd structure.
Therefore we can use it like that
You've notice that this command is to kill player,
similarly we will use the codes below to make a gps system(using zcmd)
now we also need to add /gpsrem command to remove gps icon on map
for that create zcmd
so the whole code will look like this
pawn Код:
#include <samp>
#include <zcmd>
#include <sscanf2>
pawn Код:
#define COLOR_GREEN 0x008000FF // to define color so i don't need to put 0x008000FF code, i will simply put COLOR_GREEN
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;
}
pawn Код:
CMD:kill(playerid,params[])
{
SetPlayerHealth(playerid,0);
return 1;
}
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
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;
}
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;
}