IsPlayerInArea - 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: IsPlayerInArea (
/showthread.php?tid=124484)
IsPlayerInArea -
scott1 - 30.01.2010
hello guys, i have an big probleme with IsPlayerinArea
Look at my code
Код:
forward IsAtFouriere2(playerid);
Код:
public IsAtFouriere2(playerid)
{
if (IsPlayerInArea(playerid, 1100.0583 , 1061.1190 , -1775.1643 , -1737.7003)) return 1;
return 1;
}
Код:
forward IsPlayerInArea(playerid, Float:minx, Float:maxx, Float:miny, Float:maxy);
Код:
public IsPlayerInArea(playerid, Float:minx, Float:maxx, Float:miny, Float:maxy)
{
new Float:x, Float:y, Float:z;
GetPlayerPos(playerid, x, y, z);
if (x > minx && x < maxx && y > miny && y < maxy) return 1;
return 0;
}
Код:
if(strcmp(cmd, "/mgarer", true) == 0)
{
if(IsPlayerConnected(playerid))
{
new Float:x,Float:y,Float:z;
new Float:a;
new carid;
carid = GetPlayerVehicleID(playerid);
GetPlayerName(playerid, playername, sizeof(playername));
GetVehiclePos(carid, x, y, z);
//GetPlayerFacingAngle(playerid, a);
GetVehicleZAngle(carid, a);
if(PlayerInfo[playerid][pJob] == 7)
{
if(IsAtFouriere2(playerid))
{
if(CarInfo[carid][cFour] == 0)
{
if(carid >= 184)
{
if(CarInfo[carid][cOwned]==1)
{
CarInfo[carid][cLocationx] = x;
CarInfo[carid][cLocationy] = y;
CarInfo[carid][cLocationz] = z;
CarInfo[carid][cAngle] = a;
CarInfo[carid][cLock] = 1;
CarInfo[carid][cFour] = 1;
engineOn[carid] = false;
new payout = 200;
SBizzInfo[12][sbTill] += payout;
SendClientMessage(playerid, TEAM_AZTECAS_COLOR, "Vous gagner 200$!");
format(string, sizeof(string), "~n~ Vous avez mis ce vйhicule en fouriere. ~n~");
SafeGivePlayerMoney(playerid, 200);
OnPropUpdate();
OnPlayerUpdate(playerid);
DestroyVehicle(carid);
CreateVehicle(CarInfo[carid][cModel],CarInfo[carid][cLocationx],CarInfo[carid][cLocationy],CarInfo[carid][cLocationz]+1.0,CarInfo[carid][cAngle],CarInfo[carid][cColorOne],CarInfo[carid][cColorTwo],60000);
new year, month,day;
getdate(year, month, day);
GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, sizeof(string), "%s a mgarer %d Datte:(%d-%d-%d)", sendername, carid, day,month,year);
Remlog(string);
return 1;
}
else
{
SendClientMessage(playerid, COLOR_GREY, "Ce vйhicule n'appartient a personne!");
return 1;
}
}
}
}
}
}
return 1;
}
And i can do /mgarer where i want, not in "fourriere" :/, plz help me
Re: IsPlayerInArea -
ray187 - 30.01.2010
Your function IsAtFouriere2 always returns 1 while it only should when the player is in that area.
Код:
public IsAtFouriere2(playerid)
{
if (IsPlayerInArea(playerid, 1100.0583 , 1061.1190 , -1775.1643 , -1737.7003)) return 1;
return 0;
}
Should do the trick.
Re: IsPlayerInArea -
scott1 - 30.01.2010
Thank i raplaced it, but now when we are in "fourriere" we can't do /magarer lol
Re: IsPlayerInArea -
scott1 - 01.02.2010
Up
Re: IsPlayerInArea -
ray187 - 01.02.2010
Maybe you`re Area values aren`t the rights ones?
Re: IsPlayerInArea -
scott1 - 01.02.2010
i type /save twice at different position.
Код:
AddPlayerClass(264,1061.1190,-1737.7003,13.4772,238.2554,0,0,0,0,0,0); // pos1four
AddPlayerClass(264,1100.0583,-1775.1643,13.3448,45.5129,0,0,0,0,0,0); // pos2four
Re: IsPlayerInArea -
scott1 - 02.02.2010
up
Re: IsPlayerInArea -
scott1 - 03.02.2010
up