Help with command
#1

ї What I try to develop ?

A command to locate people and vehicle with public OnPlayerCommandText(playerid, cmdtext[])
Help

I need to create a command to serve in this way /locate [Person/Vehicle] [ID] how could you do? and mark it with a dot on the map : l
Reply
#2

IDK if this works i made it in a few minutes,test and reply here.

For this to work you will need: ZCMD,sscanf2
Download ZCMD: https://sampforum.blast.hk/showthread.php?tid=91354
Download SSCANF: https://sampforum.blast.hk/showthread.php?tid=570927

You have to #include them at the top of the script and put sscanf in plugins folder. ++ You have to make new line in your server.cfg called "plugins sscanf" or if you get errors "plugins sscanf2".
And yes you must put .inc files into the pawno/include folder.

PHP код:
CMD:locate(playerid,params[])
{
    new 
ID,msg[256],name[MAX_PLAYER_NAME];
    new 
Float:X,Float:Y,Float:Z;
    if(!
IsPlayerConnected(playerid)) return SendClientMessage(playerid,-1,"ERROR: You must login before using that");
    if(
sscanf(params,"u",ID)) return SendClientMessage(playerid,-1,"SYNTAX: /Locate [ID/Name]"); // If you fail a command you will get this message.
    
if(ID == playerid) return SendClientMessage(playerid,-1,"You can't locate yourself"); // I think you understand this :D
    
if(ID == INVALID_PLAYER_ID) return SendClientMessage(playerid,-1,"ERROR: Player is not connected"); // If ID is not connected return 0.
    
GetPlayerPos(ID,X,Y,Z); // We are taking ID's position. To know where he is.
    
GetPlayerName(ID,name,sizeof(name)); // We are taking ID's name.
    
    
SetPlayerMapIcon(playerid,12X,Y,Z,0,3,MAPICON_GLOBAL_CHECKPOINT); // You could use setplayercheckpoints or markers etc... This is an example.
    
format(msg,256,"You located %s whose id is: %d on the map.",name,ID); // Prepared message
    
SendClientMessage(playerid,-1,msg); // Sent message
    
return 1;

About vehicles first try this because i didn't get any errors.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)