IsPlayerInRangeOfPoint bug ?
#1

Hello, guys, this command is for a mini game but it does not work restricting the meeting point and the gifts anywhere. How do I fix it?


CMD:chest(playerid, params[])
{
if(IsPlayerInRangeOfPoint(playerid, 2.0, -7.5863,-74.3160,3.1172)) return SendClientMessage(playerid,red,"ERROR:You must be near the Chest to use the command");
if(Minigame[playerid] == 0) return SendClientMessage(playerid,yellow,"* You are not in any New game !.");
if(Restringido(playerid,"cmd(GIFT")) return SendClientMessage(playerid, red, "You have to wait 60 seconds to use this command");
{
Restringir(playerid,"cmd(GIFT",60);
RandomGift = random(4);
switch(RandomGift)
{

case 0: // SCORE GIFT
{
SetPlayerScore(playerid, GetPlayerScore(playerid) + 2000);
SendClientMessage(playerid, COLOR_YELLOW, "Santa Claus gifted you +15 Score. Merry Christmas!");
}
case 1: // WEAPON GIFT
{
GivePlayerWeapon(playerid,35,25);
SendClientMessage(playerid, COLOR_YELLOW, "Santa Claus gifted you Weapon. Merry Christmas!");
}
case 2: // Santa Hat + Armor
{
SendClientMessage(playerid,COLOR_YELLOW,"You Got an armor + Santa Hat from santa! Wear it and enjoy, you got +100 Armor HP");
SetPlayerArmour(playerid,100.0);
}
case 3: //HEAVY ARMOR WITH 300 HP Health
{
SendClientMessage(playerid,COLOR_YELLOW,"You Got a Heavy Armor with +300 HP");
SetPlayerArmour(playerid,300.0);


}
}
}
return 1;
}
Reply
#2

You have to write:

PHP код:
if(!IsPlayerInRangeOfPoint(playerid2.0, -7.5863,-74.3160,3.1172)) 
Reply
#3

yes, but the point of sale does not work does not send the message that has to be near the point and does not restrict the command
Reply
#4

Код:
if(IsPlayerInRangeOfPoint(playerid, 2.0, -7.5863,-74.3160,3.1172)) return SendClientMessage(playerid,red,"ERROR:You must be near the Chest to use the command");
The above code will return the error message only if the player is in range of the point. If the player is not in range of the point then it will continue.

You should change the code to below, this will send the error message if the player is not in range of the point.
Код:
if(!IsPlayerInRangeOfPoint(playerid, 2.0, -7.5863,-74.3160,3.1172)) return SendClientMessage(playerid,red,"ERROR:You must be near the Chest to use the command");
Notice the added exclamation mark preceding IsPlayerInRangeOfPoint - for more information see https://sampwiki.blast.hk/wiki/Control_...ures#Operators
Reply
#5

I already understood thanks bros !!!!!!!!!!! i love
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)