Get xyz of house pos? - 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: Get xyz of house pos? (
/showthread.php?tid=294963)
Get xyz of house pos? -
System64 - 04.11.2011
Hi all

I have a small problem
I want to make a function witch i can get the position (XYZ) of my house, but it doesn't work, i tried almost everything but... doesn't work, what to do?
pawn Код:
stock GetHouseEnterXYZ(houseid)
{
new gtx[128];
format(gtx, sizeof(gtx), "%f%f%f", HouseInfo[houseid][hEnterX], HouseInfo[houseid][hEnterY], HouseInfo[houseid][hEnterZ]);
return strval(gtx);
}
//test command
YCMD:hprice(playerid, params[], help)
{
#pragma unused help
new houseid1, dure[128];
if(sscanf(params, "i", houseid1)) return SendClientMessage(playerid, -1, "Usage: /hprice [House ID]");
format(dure, sizeof(dure), "Coordiantes of house ID %d is %d", houseid1, GetHouseEnterXYZ(houseid1));
SendClientMessage(playerid, COLOR_ORANGE, dure);
return 1;
}
Re: Get xyz of house pos? -
wups - 04.11.2011
What the hell are you doing? Why'd you do strval for a string with floats?
pawn Код:
stock GetHouseEnterXYZ(houseid)
{
new gtx[128];
format(gtx, sizeof(gtx), "%f %f %f", HouseInfo[houseid][hEnterX], HouseInfo[houseid][hEnterY], HouseInfo[houseid][hEnterZ]);
return gtx;
}
//test command
YCMD:hprice(playerid, params[], help)
{
#pragma unused help
new houseid1, dure[128];
if(sscanf(params, "i", houseid1)) return SendClientMessage(playerid, -1, "Usage: /hprice [House ID]");
format(dure, sizeof(dure), "Coordiantes of house ID %d is %s", houseid1, GetHouseEnterXYZ(houseid1));
SendClientMessage(playerid, COLOR_ORANGE, dure);
return 1;
}
Re: Get xyz of house pos? -
liquor - 04.11.2011
%d = number
%i = integer
%s = string (Text or text AND numbers)
%f = float (x,y,z)
You can't type floats with %d.
And you can't return strval(*); to return a string.
strval is a function that converts a string to an integer.
https://sampwiki.blast.hk/wiki/strval
https://sampwiki.blast.hk/wiki/Category:..._Documentation
Re: Get xyz of house pos? -
System64 - 04.11.2011
guys thanks a lot, specialy wups, I've never know how to use something like this but now I know

Thanks a lot again, rep+ all