SA-MP Forums Archive
Help with command - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Help with command (/showthread.php?tid=576221)



Help with command - Joseito - 02.06.2015

ї 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



Re: Help with command - NoDi522 - 02.06.2015

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.