/loc help
#1

Код:
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?
Reply
#2

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;
}
Reply
#3

oops my bad thanks
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)