/loc help - 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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: /loc help (
/showthread.php?tid=234260)
/loc help -
THE_KNOWN - 03.03.2011
Код:
CMD:loc(playerid, params[])
{
new id;
if(otype[playerid] != 1) return SendClientMessage(playerid, red, "You cannot use this command.");
if(sscanf(params,"u",id)) return SendClientMessage(playerid, red, "USAGE:/loc [id]");
new r[64],zone[128],t[128];
format(t,32,"%s",GetPlayer2DZone(id, zone, sizeof(zone)));
format(r,128,"Suspect is in %s",t);
SendClientMessage(playerid, COLOR_ORANGE, r);
return 1;
}
smthings wrong with this. when i use it it shows sm other string instead of the zone (zone).
eg:
i type "hello" in the chat or smthn and use /loc, it says "Suspect is in hello".
so help anyone?
Re: /loc help -
JaTochNietDan - 03.03.2011
Well it looks like your code doesn't make much sense, looking at this GetPlayer2DZone function, it doesn't return a string at all, it actually stores it in the string "zone", which you are not using at all!
So forget about the t variable and its format, and just add zone into the format directly, for example:
pawn Код:
CMD:loc(playerid, params[])
{
new id;
if(otype[playerid] != 1) return SendClientMessage(playerid, red, "You cannot use this command.");
if(sscanf(params,"u",id)) return SendClientMessage(playerid, red, "USAGE:/loc [id]");
new r[64],zone[128];
GetPlayer2DZone(id, zone, sizeof(zone));
format(r, sizeof(r),"Suspect is in %s",zone);
SendClientMessage(playerid, COLOR_ORANGE, r);
return 1;
}
Re: /loc help -
THE_KNOWN - 03.03.2011
oops my bad thanks