Problem with command - 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: Problem with command (
/showthread.php?tid=386575)
Problem with command -
Yako - 20.10.2012
Код:
CMD:buyhouse(playerid, params[])
{
for(new i = 0; i < sizeof(hInfo); i++)
{
if(GetPlayerMoney(playerid) < hInfo[i][Price]) return SendClientMessage(playerid, COLOR_RED, "You don't have that much money!");
if(!IsPlayerInRangeOfPoint(playerid, 10,hInfo[i][enPos][0], hInfo[i][enPos][1], hInfo[i][enPos][2])) return SendClientMessage(playerid, COLOR_RED, "You are not near any house!");
hInfo[i][Owned] = 1;
hInfo[i][Owner] = PlayerName(playerid);
SetPlayerInterior(playerid,hInfo[i][Interior]);
SetPlayerPos(playerid, hInfo[i][exPos][0], hInfo[i][exPos][1], hInfo[i][exPos][2]);
SetPlayerVirtualWorld(playerid, hInfo[i][VirtualWorld]);
GivePlayerMoney(playerid, -hInfo[i][Price]);
OnPropTextdrawUpdate(i,1);
OnHousePickupUpdate(i);
}
return 1;
}
What's wrong here? It always says that you are not standing at any house
Re: Problem with command -
CaRa - 20.10.2012
Код:
CMD:buyhouse(playerid, params[])
{
for(new i = 0; i < sizeof(hInfo); i++)
{
if(GetPlayerMoney(playerid) < hInfo[i][Price]) return SendClientMessage(playerid, COLOR_RED, "You don't have that much money!");
hInfo[i][Owned] = 1;
hInfo[i][Owner] = PlayerName(playerid);
SetPlayerInterior(playerid,hInfo[i][Interior]);
SetPlayerPos(playerid, hInfo[i][exPos][0], hInfo[i][exPos][1], hInfo[i][exPos][2]);
SetPlayerVirtualWorld(playerid, hInfo[i][VirtualWorld]);
GivePlayerMoney(playerid, -hInfo[i][Price]);
OnPropTextdrawUpdate(i,1);
OnHousePickupUpdate(i);
}
return 1;
}
Re: Problem with command -
Yako - 20.10.2012
Omg, nice solution

Maybe somebody knows real solution?
Re: Problem with command -
Memoryz - 20.10.2012
pawn Код:
CMD:buyhouse(playerid, params[])
{
for(new i = 0; i < sizeof(hInfo); i++)
{
if(GetPlayerMoney(playerid) < hInfo[i][Price]) return SendClientMessage(playerid, COLOR_RED, "You don't have that much money!");
if(IsPlayerInRangeOfPoint(playerid, 10,hInfo[i][enPos][0], hInfo[i][enPos][1], hInfo[i][enPos][2])) continue;
hInfo[i][Owned] = 1;
hInfo[i][Owner] = PlayerName(playerid);
SetPlayerInterior(playerid,hInfo[i][Interior]);
SetPlayerPos(playerid, hInfo[i][exPos][0], hInfo[i][exPos][1], hInfo[i][exPos][2]);
SetPlayerVirtualWorld(playerid, hInfo[i][VirtualWorld]);
GivePlayerMoney(playerid, -hInfo[i][Price]);
OnPropTextdrawUpdate(i,1);
OnHousePickupUpdate(i);
}
return 1;
}
Try this.