Loop or IsPlayerInRange problem - 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: Loop or IsPlayerInRange problem (
/showthread.php?tid=159146)
Loop or IsPlayerInRange problem -
Schnacke - 12.07.2010
Hi all,
excuse me for bad english!.
So,
my problem is this command:
PHP код:
if(strcmp(cmd,"/kaufen",true)==0)
{
if(INI_Open("Haus.cfg"))
{
for(new h = 0; h < sizeof(HausInfo); h++)
{
if(IsPlayerInRangeOfPoint(playerid, 3.0, HausInfo[h][eX], HausInfo[h][eY], HausInfo[h][eZ]))
{
new kString[195];
format(kString, 64, "eX%d", h);
HausInfo[h][eX] = INI_ReadFloat(kString);
format(kString, 64, "eY%d", h);
HausInfo[h][eY] = INI_ReadFloat(kString);
format(kString, 64, "eZ%d", h);
HausInfo[h][eZ] = INI_ReadFloat(kString);
if(SpielerInfo[playerid][pHaus] == 0)
{
if(GetPlayerMoney(playerid) < HausInfo[h][Preis])return 1;
new Name[MAX_PLAYER_NAME];
GetPlayerName(playerid, Name, MAX_PLAYER_NAME);
GivePlayerMoney(playerid, - HausInfo[h][Preis]);
SendClientMessage(playerid,FARBE_WEIЯ,"Du hast dir ein Haus gekauft, die befehle kannst du unter /hh sehen!");
HausInfo[h][Vergeben] = 1;
SpielerInfo[playerid][pHaus] = 1;
SpielerInfo[playerid][pId] = h+1;
strmid(HausInfo[h][Besitzer], Name, 0, strlen(Name), 24);
WennSpielerUpdatet(playerid);
Kauf(playerid);
return 1;
}
else
{
SendClientMessage(playerid,FARBE_WEIЯ,"Du hast bereits ein Haus, dieses musst du verkaufen!");
return 1;
}
}
else
{
SendClientMessage(playerid,FARBE_WEIЯ,"Du stehst an keinem Haus!");
return 1;
}
}
}
INI_Close();
return 1;
}
Always when i write /kaufen, then comming the else message
PHP код:
else
{
SendClientMessage(playerid,FARBE_WEIЯ,"Du stehst an keinem Haus!");
return 1;
}
but i stand in front of a house
I dont know what is wrong, but i hope anywhere can help me.
thx
Re: Loop or IsPlayerInRange problem -
Osviux - 12.07.2010
I think you need to add SetPlayerPos
Re: Loop or IsPlayerInRange problem -
Schnacke - 12.07.2010
Why SetPlayerPos that has nothing to do with it?
Re: Loop or IsPlayerInRange problem -
Donny_k - 12.07.2010
You are reading the values into the arrays after checking them, this should be the other way around or it will always be 0.0 (middle of map, that farm):
pawn Код:
x = my_ini_x;
y = my_ini_y;
//.........and so on then
if (IsPlayerInRangeOfPoint(playerid, 3.0, x, y................
Re: Loop or IsPlayerInRange problem -
Schnacke - 12.07.2010
I'm so tried, has not worked