/locate cmd -
tommzy09 - 07.08.2014
hey guys, i am trying to make a command where i can /locate another player.
when i locate them, it will send me a message saying "Player(id) has been Located in Ganton"
im using this filterscript as my servers gps system.
https://sampforum.blast.hk/showthread.php?tid=94353
is there a way, somewhere in that script that i can add a /locate cmd?
thanks
edit: this was my attempt lol, i know it makes no sense whatsoever
Код:
public OnPlayerCommandPerformed(playerid, cmdtext[], success)
{
new cmd[256];
if(success)
{
return 1;
}
if(strcmp(cmd, "/loc", true) == 0)
{
new str[256];
for(new i=0; i<gMax; i++)
format(str,sizeof(str),"%s", GetPlayerArea(i));
SendClientMessage(playerid, COLOR_YELLOW, str);
return 1;
}
return 0;
}
Re: /locate cmd -
ViniBorn - 07.08.2014
Are you using zcmd?
Re: /locate cmd -
tommzy09 - 07.08.2014
either one because i alternate between both depending on my script
Re: /locate cmd -
ViniBorn - 07.08.2014
ZCMD commands are like callbacks, don't put your commands in another functions.
For this type of commands(with parameters), you can use sscanf
pawn Код:
CMD:loc(playerid, params[])
{
new ID;
if(sscanf(params, "u",ID))
return SendClientMessage(playerid, -1, "/loc [ID]");
new str[36];
format(str,sizeof(str),"%s", GetPlayerArea(ID));
SendClientMessage(playerid, COLOR_YELLOW, str);
return 1;
}
Re: /locate cmd -
tommzy09 - 07.08.2014
okay, i added in what you said but i got the error "error 017: undefined symbol "params"
here's the top of my script
Код:
#include <a_samp>
#include <sscanf2>
#include <zcmd>
what could be wrong?
--------------------------------------------------------------------------------------
edit: no problemo, had to add the params there CMD:loc(playerid, params[])
thanks with the help, but i'd like it to say "Player(ID) is Located in "AREA"
how would i go about adding the players name and id there also?
also rep + for the help!
Re: /locate cmd -
ViniBorn - 07.08.2014
Just change this line
pawn Код:
format(str,sizeof(str),"Player(%d) is located in %s", ID, GetPlayerArea(ID));
If you need the exact name, use
GetPlayerName
Re: /locate cmd -
Jimmy0wns - 07.08.2014
Quote:
Originally Posted by ViniBorn
Just change this line
pawn Код:
format(str,sizeof(str),"Player(%d) is located in %s", ID, GetPlayerArea(ID));
If you need the exact name, use GetPlayerName
|
Using getplayername is such a waste of time, I always use this instead:
pawn Код:
stock PlayerName(playerid)
{
new name[24];
GetPlayerName(playerid, name, 24);
return name;
}
e.g: PlayerName(targetid);
Re: /locate cmd -
tommzy09 - 07.08.2014
Okay I'll give it a crack! Thanks for the help
Re: /locate cmd -
XaibBaba - 07.08.2014
like you neeed /find cmd as a detactive job?
Re: /locate cmd -
Jimmy0wns - 07.08.2014
Quote:
Originally Posted by XaibBaba
like you neeed /find cmd as a detactive job?
|
Question has already been answered.