SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 02/03/2014, 11:36 AM   #1
Immortal_LTU
Big Clucker
 
Join Date: Feb 2011
Location: Lithuania
Posts: 120
Reputation: 1
Default IsPlayerInRangeOfPoint help.

How i can make this cmd with isplayerinrangeofpoint ?

Code:
CMD:drink(playerid, params[]) {
	new amount,str1[256];
	if(sscanf(params,"d",amount)) return SendClientMessage(playerid, COLOR_RED, "use: /drink <percents>");
	if(amount <= 100-PlayerInfo[playerid][Drink]){
	GivePlayerMoney(playerid,-100*amount);
	PlayerInfo[playerid][Drink]=amount+PlayerInfo[playerid][Drink];
	format(str1, sizeof(str1), "Drink +%d", amount);
	SendClientMessage(playerid,COLOR_GREEN,str1);
	format(DrinkS, sizeof(DrinkS), "%d %", PlayerInfo[playerid][Drink]);
  	PlayerTextDrawSetString(playerid,DrinkT[playerid], DrinkS);
	return 1;
	} else return SendClientMessage(playerid,COLOR_RED," You dont want to drink..");
}
Immortal_LTU is offline   Reply With Quote
Old 02/03/2014, 12:02 PM   #2
TunisianoGamer
Big Clucker
 
TunisianoGamer's Avatar
 
Join Date: Sep 2013
Location: Tunisia,Monastir,Teboulba
Posts: 62
Reputation: 10
Default Re : IsPlayerInRangeOfPoint help.

Use the Function IsPlayerInRangeOfPoint(playerid, range, X, Y, Z)

//Exemple

CMD:drink(playerid, params[]) {
if(IsPlayerInRangeOfPoint(playerid,20.0,-103.9105,-22.3268,1000.7188))
{
new amount,str1[256];
if(sscanf(params,"d",amount)) return SendClientMessage(playerid, COLOR_RED, "use: /drink <percents>");
if(amount <= 100-PlayerInfo[playerid][Drink]){
GivePlayerMoney(playerid,-100*amount);
PlayerInfo[playerid][Drink]=amount+PlayerInfo[playerid][Drink];
format(str1, sizeof(str1), "Drink +%d", amount);
SendClientMessage(playerid,COLOR_GREEN,str1);
format(DrinkS, sizeof(DrinkS), "%d %", PlayerInfo[playerid][Drink]);
PlayerTextDrawSetString(playerid,DrinkT[playerid], DrinkS);
return 1;
} else return SendClientMessage(playerid,COLOR_RED," You dont want to drink..");
}
}
TunisianoGamer is offline   Reply With Quote
Old 02/03/2014, 12:35 PM   #3
Immortal_LTU
Big Clucker
 
Join Date: Feb 2011
Location: Lithuania
Posts: 120
Reputation: 1
Default Re: Re : IsPlayerInRangeOfPoint help.

Quote:
Originally Posted by TunisianoGamer View Post
Use the Function IsPlayerInRangeOfPoint(playerid, range, X, Y, Z)

//Exemple

CMD:drink(playerid, params[]) {
if(IsPlayerInRangeOfPoint(playerid,20.0,-103.9105,-22.3268,1000.7188))
{
new amount,str1[256];
if(sscanf(params,"d",amount)) return SendClientMessage(playerid, COLOR_RED, "use: /drink <percents>");
if(amount <= 100-PlayerInfo[playerid][Drink]){
GivePlayerMoney(playerid,-100*amount);
PlayerInfo[playerid][Drink]=amount+PlayerInfo[playerid][Drink];
format(str1, sizeof(str1), "Drink +%d", amount);
SendClientMessage(playerid,COLOR_GREEN,str1);
format(DrinkS, sizeof(DrinkS), "%d %", PlayerInfo[playerid][Drink]);
PlayerTextDrawSetString(playerid,DrinkT[playerid], DrinkS);
return 1;
} else return SendClientMessage(playerid,COLOR_RED," You dont want to drink..");
}
}
still lets me drink everywhere ...
Immortal_LTU is offline   Reply With Quote
Old 02/03/2014, 12:38 PM   #4
Urukhay
Gangsta
 
Join Date: Sep 2013
Posts: 639
Reputation: 2
Default Re: IsPlayerInRangeOfPoint help.

pawn Code:
CMD:drink(playerid, params[]) {
if(!IsPlayerInRangeOfPoint(playerid,20.0,-103.9105,-22.3268,1000.7188)) return SendClientMessage(playerid,COLOR_RED," You dont want to drink..");
new amount,str1[256];
if(sscanf(params,"d",amount)) return SendClientMessage(playerid, COLOR_RED, "use: /drink <percents>");
if(amount <= 100-PlayerInfo[playerid][Drink]){
GivePlayerMoney(playerid,-100*amount);
PlayerInfo[playerid][Drink]=amount+PlayerInfo[playerid][Drink];
format(str1, sizeof(str1), "Drink +%d", amount);
SendClientMessage(playerid,COLOR_GREEN,str1);
format(DrinkS, sizeof(DrinkS), "%d %", PlayerInfo[playerid][Drink]);
PlayerTextDrawSetString(playerid,DrinkT[playerid], DrinkS);
return 1;
}
return 1;
}
Urukhay is offline   Reply With Quote
Old 02/03/2014, 12:46 PM   #5
Immortal_LTU
Big Clucker
 
Join Date: Feb 2011
Location: Lithuania
Posts: 120
Reputation: 1
Default Re: IsPlayerInRangeOfPoint help.

Quote:
Originally Posted by Urukhay View Post
pawn Code:
CMD:drink(playerid, params[]) {
if(!IsPlayerInRangeOfPoint(playerid,20.0,-103.9105,-22.3268,1000.7188)) return SendClientMessage(playerid,COLOR_RED," You dont want to drink..");
new amount,str1[256];
if(sscanf(params,"d",amount)) return SendClientMessage(playerid, COLOR_RED, "use: /drink <percents>");
if(amount <= 100-PlayerInfo[playerid][Drink]){
GivePlayerMoney(playerid,-100*amount);
PlayerInfo[playerid][Drink]=amount+PlayerInfo[playerid][Drink];
format(str1, sizeof(str1), "Drink +%d", amount);
SendClientMessage(playerid,COLOR_GREEN,str1);
format(DrinkS, sizeof(DrinkS), "%d %", PlayerInfo[playerid][Drink]);
PlayerTextDrawSetString(playerid,DrinkT[playerid], DrinkS);
return 1;
}
return 1;
}
Thanks , works like a charm
Immortal_LTU is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
help , IsPlayerInRangeOfPoint morocco Scripting Help 9 19/04/2013 06:22 AM
IsPlayerInRangeOfPoint Shean Scripting Help 0 21/03/2013 06:35 PM
How do i get the if(IsPlayerInRangeOfPoint Hussain Server Support 6 19/03/2013 05:26 PM
IsPlayerInRangeOfPoint ????? SumX Scripting Help 6 13/02/2012 03:07 PM
IsPlayerInRangeOfPoint gagnier91 Scripting Help 8 09/12/2011 09:30 PM


All times are GMT. The time now is 06:36 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.