Hey guys, i recently made my script, which is when player writes a command and he is on certain coords, it puts him into sleep.
The thing is, this isplayerinrangeofpoint is simply not working, i saved my coords, made it and in game went on exact same coords, i even made sure by teleporting to them, i wrote command and it said, that i am not on the coords, the range is 2.0, because i cant make bigger, couse than it would call the sleep more times, because cells are right next to each other, do you guys have any idea, what could couse, that it is not detecting the coords? Here is part of the code:
I removed all the variables and everything, so you guys can try it yourselves and see, where is the problem, i also kept the original coords, but you wont have the cells there, but you can try it anyways.
If anyone would be enabled to help me with this problem, i would be really thankful and rep+ him.
It is working, but even if i enter the sleep, so the player is on right coords, that message, that he is not showes up.
Yes, i just did not include return 1; in the code, off course i have it there.
But still, when i enter the sleep, so the player is on good coords, the message "You must be in the middle of your cell in order to get into the sleep." showes up.
Bro, but i have multiple there.
Now only the first one works, other ones, even if i am on the exact same coords, it says, that i am not, i will just paste you whole command:
Код:
CMD:sleep(playerid, params[])
{
if(PlayerInfo[playerid][pEnergy] == 100) return SendClientMessage(playerid, COLOR_ORANGE, "Mбte 100 energie");
if(PlayerInfo[playerid][pSleeping] == 0)
{
if(IsPlayerInRangeOfPoint(playerid, 2.0, 279.1717,1835.2167,17.6481))
{
ApplyAnimation(playerid, "BEACH", "Lay_Bac_Loop", 4.1, 1, 0, 0, 0, 0, 1);
PlayerInfo[playerid][pSleeping] = 1;
sleeping_timer[playerid] = SetTimerEx("Sleeping",60000,false,"i",playerid);
SendClientMessage(playerid, COLOR_YELLOW, "Prбve spнte, budete spať po dobu 1 minъty, zobudiť sa mфћete kedykoľvek opдtovnэm zadanнm prнkazu /sleep");
}
else return SendClientMessage(playerid, COLOR_ORANGE, "Musнte sa postaviť čo najviac do stredu v cele, aby ste mohli spať");
if(IsPlayerInRangeOfPoint(playerid, 2.0, 279.0367,1838.1794,17.6481))
{
ApplyAnimation(playerid, "BEACH", "Lay_Bac_Loop", 4.1, 1, 0, 0, 0, 0, 1);
PlayerInfo[playerid][pSleeping] = 1;
sleeping_timer[playerid] = SetTimerEx("Sleeping",60000,false,"i",playerid);
SendClientMessage(playerid, COLOR_YELLOW, "Prбve spнte, budete spať po dobu 1 minъty, zobudiť sa mфћete kedykoľvek opдtovnэm zadanнm prнkazu /sleep");
}
else return SendClientMessage(playerid, COLOR_ORANGE, "Musнte sa postaviť čo najviac do stredu v cele, aby ste mohli spať");
if(IsPlayerInRangeOfPoint(playerid, 2.0, 279.0129,1841.0363,17.6481))
{
ApplyAnimation(playerid, "BEACH", "Lay_Bac_Loop", 4.1, 1, 0, 0, 0, 0, 1);
PlayerInfo[playerid][pSleeping] = 1;
sleeping_timer[playerid] = SetTimerEx("Sleeping",60000,false,"i",playerid);
SendClientMessage(playerid, COLOR_YELLOW, "Prбve spнte, budete spať po dobu 1 minъty, zobudiť sa mфћete kedykoľvek opдtovnэm zadanнm prнkazu /sleep");
}
else return SendClientMessage(playerid, COLOR_ORANGE, "Musнte sa postaviť čo najviac do stredu v cele, aby ste mohli spať");
if(IsPlayerInRangeOfPoint(playerid, 2.0, 279.2364,1844.1471,17.6481))
{
ApplyAnimation(playerid, "BEACH", "Lay_Bac_Loop", 4.1, 1, 0, 0, 0, 0, 1);
PlayerInfo[playerid][pSleeping] = 1;
sleeping_timer[playerid] = SetTimerEx("Sleeping",60000,false,"i",playerid);
SendClientMessage(playerid, COLOR_YELLOW, "Prбve spнte, budete spať po dobu 1 minъty, zobudiť sa mфћete kedykoľvek opдtovnэm zadanнm prнkazu /sleep");
}
else return SendClientMessage(playerid, COLOR_ORANGE, "Musнte sa postaviť čo najviac do stredu v cele, aby ste mohli spať");
if(IsPlayerInRangeOfPoint(playerid, 2.0, 279.2164,1847.0321,17.6406))
{
ApplyAnimation(playerid, "BEACH", "Lay_Bac_Loop", 4.1, 1, 0, 0, 0, 0, 1);
PlayerInfo[playerid][pSleeping] = 1;
sleeping_timer[playerid] = SetTimerEx("Sleeping",60000,false,"i",playerid);
SendClientMessage(playerid, COLOR_YELLOW, "Prбve spнte, budete spať po dobu 1 minъty, zobudiť sa mфћete kedykoľvek opдtovnэm zadanнm prнkazu /sleep");
}
else return SendClientMessage(playerid, COLOR_ORANGE, "Musнte sa postaviť čo najviac do stredu v cele, aby ste mohli spať");
if(IsPlayerInRangeOfPoint(playerid, 2.0, 279.1401,1850.1205,17.6406))
{
ApplyAnimation(playerid, "BEACH", "Lay_Bac_Loop", 4.1, 1, 0, 0, 0, 0, 1);
PlayerInfo[playerid][pSleeping] = 1;
sleeping_timer[playerid] = SetTimerEx("Sleeping",60000,false,"i",playerid);
SendClientMessage(playerid, COLOR_YELLOW, "Prбve spнte, budete spať po dobu 1 minъty, zobudiť sa mфћete kedykoľvek opдtovnэm zadanнm prнkazu /sleep");
}
else return SendClientMessage(playerid, COLOR_ORANGE, "Musнte sa postaviť čo najviac do stredu v cele, aby ste mohli spať");
if(IsPlayerInRangeOfPoint(playerid, 2.0, 279.1443,1853.1067,17.6406))
{
ApplyAnimation(playerid, "BEACH", "Lay_Bac_Loop", 4.1, 1, 0, 0, 0, 0, 1);
PlayerInfo[playerid][pSleeping] = 1;
sleeping_timer[playerid] = SetTimerEx("Sleeping",60000,false,"i",playerid);
SendClientMessage(playerid, COLOR_YELLOW, "Prбve spнte, budete spať po dobu 1 minъty, zobudiť sa mфћete kedykoľvek opдtovnэm zadanнm prнkazu /sleep");
}
else return SendClientMessage(playerid, COLOR_ORANGE, "Musнte sa postaviť čo najviac do stredu v cele, aby ste mohli spať");
if(IsPlayerInRangeOfPoint(playerid, 2.0, 279.0754,1856.0867,17.6406))
{
ApplyAnimation(playerid, "BEACH", "Lay_Bac_Loop", 4.1, 1, 0, 0, 0, 0, 1);
PlayerInfo[playerid][pSleeping] = 1;
sleeping_timer[playerid] = SetTimerEx("Sleeping",60000,false,"i",playerid);
SendClientMessage(playerid, COLOR_YELLOW, "Prбve spнte, budete spať po dobu 1 minъty, zobudiť sa mфћete kedykoľvek opдtovnэm zadanнm prнkazu /sleep");
}
else return SendClientMessage(playerid, COLOR_ORANGE, "Musнte sa postaviť čo najviac do stredu v cele, aby ste mohli spať");
if(IsPlayerInRangeOfPoint(playerid, 2.0, 279.3103,1859.1453,17.6406))
{
ApplyAnimation(playerid, "BEACH", "Lay_Bac_Loop", 4.1, 1, 0, 0, 0, 0, 1);
PlayerInfo[playerid][pSleeping] = 1;
sleeping_timer[playerid] = SetTimerEx("Sleeping",60000,false,"i",playerid);
SendClientMessage(playerid, COLOR_YELLOW, "Prбve spнte, budete spať po dobu 1 minъty, zobudiť sa mфћete kedykoľvek opдtovnэm zadanнm prнkazu /sleep");
}
else return SendClientMessage(playerid, COLOR_ORANGE, "Musнte sa postaviť čo najviac do stredu v cele, aby ste mohli spať");
if(IsPlayerInRangeOfPoint(playerid, 2.0, 279.0262,1862.1499,17.6406))
{
ApplyAnimation(playerid, "BEACH", "Lay_Bac_Loop", 4.1, 1, 0, 0, 0, 0, 1);
PlayerInfo[playerid][pSleeping] = 1;
sleeping_timer[playerid] = SetTimerEx("Sleeping",60000,false,"i",playerid);
SendClientMessage(playerid, COLOR_YELLOW, "Prбve spнte, budete spať po dobu 1 minъty, zobudiť sa mфћete kedykoľvek opдtovnэm zadanнm prнkazu /sleep");
}
else return SendClientMessage(playerid, COLOR_ORANGE, "Musнte sa postaviť čo najviac do stredu v cele, aby ste mohli spať");
if(IsPlayerInRangeOfPoint(playerid, 2.0, 279.2734,1865.0156,17.6406))
{
ApplyAnimation(playerid, "BEACH", "Lay_Bac_Loop", 4.1, 1, 0, 0, 0, 0, 1);
PlayerInfo[playerid][pSleeping] = 1;
sleeping_timer[playerid] = SetTimerEx("Sleeping",60000,false,"i",playerid);
SendClientMessage(playerid, COLOR_YELLOW, "Prбve spнte, budete spať po dobu 1 minъty, zobudiť sa mфћete kedykoľvek opдtovnэm zadanнm prнkazu /sleep");
}
else return SendClientMessage(playerid, COLOR_ORANGE, "Musнte sa postaviť čo najviac do stredu v cele, aby ste mohli spať");
if(IsPlayerInRangeOfPoint(playerid, 2.0, 279.1436,1868.2026,17.6406))
{
ApplyAnimation(playerid, "BEACH", "Lay_Bac_Loop", 4.1, 1, 0, 0, 0, 0, 1);
PlayerInfo[playerid][pSleeping] = 1;
sleeping_timer[playerid] = SetTimerEx("Sleeping",60000,false,"i",playerid);
SendClientMessage(playerid, COLOR_YELLOW, "Prбve spнte, budete spať po dobu 1 minъty, zobudiť sa mфћete kedykoľvek opдtovnэm zadanнm prнkazu /sleep");
}
else return SendClientMessage(playerid, COLOR_ORANGE, "Musнte sa postaviť čo najviac do stredu v cele, aby ste mohli spať");
if(IsPlayerInRangeOfPoint(playerid, 2.0, 279.2408,1871.2085,17.6481))
{
ApplyAnimation(playerid, "BEACH", "Lay_Bac_Loop", 4.1, 1, 0, 0, 0, 0, 1);
PlayerInfo[playerid][pSleeping] = 1;
sleeping_timer[playerid] = SetTimerEx("Sleeping",60000,false,"i",playerid);
SendClientMessage(playerid, COLOR_YELLOW, "Prбve spнte, budete spať po dobu 1 minъty, zobudiť sa mфћete kedykoľvek opдtovnэm zadanнm prнkazu /sleep");
}
else return SendClientMessage(playerid, COLOR_ORANGE, "Musнte sa postaviť čo najviac do stredu v cele, aby ste mohli spať");
if(IsPlayerInRangeOfPoint(playerid, 2.0, 279.2990,1874.1501,17.6406))
{
ApplyAnimation(playerid, "BEACH", "Lay_Bac_Loop", 4.1, 1, 0, 0, 0, 0, 1);
PlayerInfo[playerid][pSleeping] = 1;
sleeping_timer[playerid] = SetTimerEx("Sleeping",60000,false,"i",playerid);
SendClientMessage(playerid, COLOR_YELLOW, "Prбve spнte, budete spať po dobu 1 minъty, zobudiť sa mфћete kedykoľvek opдtovnэm zadanнm prнkazu /sleep");
}
else return SendClientMessage(playerid, COLOR_ORANGE, "Musнte sa postaviť čo najviac do stredu v cele, aby ste mohli spať");
if(IsPlayerInRangeOfPoint(playerid, 2.0, 279.1245,1877.1086,17.6406))
{
ApplyAnimation(playerid, "BEACH", "Lay_Bac_Loop", 4.1, 1, 0, 0, 0, 0, 1);
PlayerInfo[playerid][pSleeping] = 1;
sleeping_timer[playerid] = SetTimerEx("Sleeping",60000,false,"i",playerid);
SendClientMessage(playerid, COLOR_YELLOW, "Prбve spнte, budete spať po dobu 1 minъty, zobudiť sa mфћete kedykoľvek opдtovnэm zadanнm prнkazu /sleep");
}
else return SendClientMessage(playerid, COLOR_ORANGE, "Musнte sa postaviť čo najviac do stredu v cele, aby ste mohli spať");
if(IsPlayerInRangeOfPoint(playerid, 2.0, 279.1906,1880.0979,17.6406))
{
ApplyAnimation(playerid, "BEACH", "Lay_Bac_Loop", 4.1, 1, 0, 0, 0, 0, 1);
PlayerInfo[playerid][pSleeping] = 1;
sleeping_timer[playerid] = SetTimerEx("Sleeping",60000,false,"i",playerid);
SendClientMessage(playerid, COLOR_YELLOW, "Prбve spнte, budete spať po dobu 1 minъty, zobudiť sa mфћete kedykoľvek opдtovnэm zadanнm prнkazu /sleep");
}
else return SendClientMessage(playerid, COLOR_ORANGE, "Musнte sa postaviť čo najviac do stredu v cele, aby ste mohli spať");
if(IsPlayerInRangeOfPoint(playerid, 2.0, 279.1490,1883.1035,17.6406))
{
ApplyAnimation(playerid, "BEACH", "Lay_Bac_Loop", 4.1, 1, 0, 0, 0, 0, 1);
PlayerInfo[playerid][pSleeping] = 1;
sleeping_timer[playerid] = SetTimerEx("Sleeping",60000,false,"i",playerid);
SendClientMessage(playerid, COLOR_YELLOW, "Prбve spнte, budete spať po dobu 1 minъty, zobudiť sa mфћete kedykoľvek opдtovnэm zadanнm prнkazu /sleep");
}
else return SendClientMessage(playerid, COLOR_ORANGE, "Musнte sa postaviť čo najviac do stredu v cele, aby ste mohli spať");
if(IsPlayerInRangeOfPoint(playerid, 2.0, 279.2195,1886.0560,17.6481))
{
ApplyAnimation(playerid, "BEACH", "Lay_Bac_Loop", 4.1, 1, 0, 0, 0, 0, 1);
PlayerInfo[playerid][pSleeping] = 1;
sleeping_timer[playerid] = SetTimerEx("Sleeping",60000,false,"i",playerid);
SendClientMessage(playerid, COLOR_YELLOW, "Prбve spнte, budete spať po dobu 1 minъty, zobudiť sa mфћete kedykoľvek opдtovnэm zadanнm prнkazu /sleep");
}
else return SendClientMessage(playerid, COLOR_ORANGE, "Musнte sa postaviť čo najviac do stredu v cele, aby ste mohli spať");
if(IsPlayerInRangeOfPoint(playerid, 2.0, 279.1513,1889.1361,17.6406))
{
ApplyAnimation(playerid, "BEACH", "Lay_Bac_Loop", 4.1, 1, 0, 0, 0, 0, 1);
PlayerInfo[playerid][pSleeping] = 1;
sleeping_timer[playerid] = SetTimerEx("Sleeping",60000,false,"i",playerid);
SendClientMessage(playerid, COLOR_YELLOW, "Prбve spнte, budete spať po dobu 1 minъty, zobudiť sa mфћete kedykoľvek opдtovnэm zadanнm prнkazu /sleep");
}
else return SendClientMessage(playerid, COLOR_ORANGE, "Musнte sa postaviť čo najviac do stredu v cele, aby ste mohli spať");
if(IsPlayerInRangeOfPoint(playerid, 2.0, 279.2338,1892.1641,17.6406))
{
ApplyAnimation(playerid, "BEACH", "Lay_Bac_Loop", 4.1, 1, 0, 0, 0, 0, 1);
PlayerInfo[playerid][pSleeping] = 1;
sleeping_timer[playerid] = SetTimerEx("Sleeping",60000,false,"i",playerid);
SendClientMessage(playerid, COLOR_YELLOW, "Prбve spнte, budete spať po dobu 1 minъty, zobudiť sa mфћete kedykoľvek opдtovnэm zadanнm prнkazu /sleep");
}
else return SendClientMessage(playerid, COLOR_ORANGE, "Musнte sa postaviť čo najviac do stredu v cele, aby ste mohli spať");
if(IsPlayerInRangeOfPoint(playerid, 2.0, 279.1690,1895.1287,17.6406))
{
ApplyAnimation(playerid, "BEACH", "Lay_Bac_Loop", 4.1, 1, 0, 0, 0, 0, 1);
PlayerInfo[playerid][pSleeping] = 1;
sleeping_timer[playerid] = SetTimerEx("Sleeping",60000,false,"i",playerid);
SendClientMessage(playerid, COLOR_YELLOW, "Prбve spнte, budete spať po dobu 1 minъty, zobudiť sa mфћete kedykoľvek opдtovnэm zadanнm prнkazu /sleep");
}
else return SendClientMessage(playerid, COLOR_ORANGE, "Musнte sa postaviť čo najviac do stredu v cele, aby ste mohli spať");
if(IsPlayerInRangeOfPoint(playerid, 2.0, 279.2791,1898.1915,17.6481))
{
ApplyAnimation(playerid, "BEACH", "Lay_Bac_Loop", 4.1, 1, 0, 0, 0, 0, 1);
PlayerInfo[playerid][pSleeping] = 1;
sleeping_timer[playerid] = SetTimerEx("Sleeping",60000,false,"i",playerid);
SendClientMessage(playerid, COLOR_YELLOW, "Prбve spнte, budete spať po dobu 1 minъty, zobudiť sa mфћete kedykoľvek opдtovnэm zadanнm prнkazu /sleep");
}
else return SendClientMessage(playerid, COLOR_ORANGE, "Musнte sa postaviť čo najviac do stredu v cele, aby ste mohli spať");
if(IsPlayerInRangeOfPoint(playerid, 2.0, 279.2150,1901.1653,17.6481))
{
ApplyAnimation(playerid, "BEACH", "Lay_Bac_Loop", 4.1, 1, 0, 0, 0, 0, 1);
PlayerInfo[playerid][pSleeping] = 1;
sleeping_timer[playerid] = SetTimerEx("Sleeping",60000,false,"i",playerid);
SendClientMessage(playerid, COLOR_YELLOW, "Prбve spнte, budete spať po dobu 1 minъty, zobudiť sa mфћete kedykoľvek opдtovnэm zadanнm prнkazu /sleep");
}
else return SendClientMessage(playerid, COLOR_ORANGE, "Musнte sa postaviť čo najviac do stredu v cele, aby ste mohli spať");
if(IsPlayerInRangeOfPoint(playerid, 2.0, 279.2301,1904.1849,17.6481))
{
ApplyAnimation(playerid, "BEACH", "Lay_Bac_Loop", 4.1, 1, 0, 0, 0, 0, 1);
PlayerInfo[playerid][pSleeping] = 1;
sleeping_timer[playerid] = SetTimerEx("Sleeping",60000,false,"i",playerid);
SendClientMessage(playerid, COLOR_YELLOW, "Prбve spнte, budete spať po dobu 1 minъty, zobudiť sa mфћete kedykoľvek opдtovnэm zadanнm prнkazu /sleep");
}
else return SendClientMessage(playerid, COLOR_ORANGE, "Musнte sa postaviť čo najviac do stredu v cele, aby ste mohli spať");
if(IsPlayerInRangeOfPoint(playerid, 2.0, 279.1860,1907.1331,17.6481))
{
ApplyAnimation(playerid, "BEACH", "Lay_Bac_Loop", 4.1, 1, 0, 0, 0, 0, 1);
PlayerInfo[playerid][pSleeping] = 1;
sleeping_timer[playerid] = SetTimerEx("Sleeping",60000,false,"i",playerid);
SendClientMessage(playerid, COLOR_YELLOW, "Prбve spнte, budete spať po dobu 1 minъty, zobudiť sa mфћete kedykoľvek opдtovnэm zadanнm prнkazu /sleep");
}
else return SendClientMessage(playerid, COLOR_ORANGE, "Musнte sa postaviť čo najviac do stredu v cele, aby ste mohli spať");
}
if(PlayerInfo[playerid][pSleeping] == 1)
{
ClearAnimations(playerid);
PlayerInfo[playerid][pSleeping] = 0;
KillTimer(sleeping_timer[playerid]);
SendClientMessage(playerid, COLOR_YELLOW, "Zobudil ste sa");
}
return 1;
}