SA-MP Forums

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

 
 
Thread Tools Display Modes
Old 19/01/2010, 06:31 PM   #1
Rangard
Little Clucker
 
Join Date: Jan 2008
Posts: 16
Reputation: 0
Default Making an restaurant..

I've decided to make a restaurant in MTA and convert it to SA:MP, but 1 question, how to make the "area" of "buying"

I mean you come to restaurant and how to make the command /buy or something and it gives you HP and makes /me eats bla bla.
Rangard is offline  
Old 19/01/2010, 06:32 PM   #2
MaykoX
Banned
 
Join Date: Apr 2009
Posts: 607
Reputation: 0
Default Re: Making an restaurant..

you shuld use ifplayertopoint for /me and give helath use SetPlayerHealth... Use search :P Or go to sampWIKI
MaykoX is offline  
Old 19/01/2010, 06:35 PM   #3
Rangard
Little Clucker
 
Join Date: Jan 2008
Posts: 16
Reputation: 0
Default Re: Making an restaurant..

I didn't mean it.

I meant like:

You come to restaurant,
type /buy
the list of commands shows
you do /buy sprunk
and it gives you like 50 hp and makes /me drinks sprunk
Rangard is offline  
Old 19/01/2010, 06:38 PM   #4
mansonh
Gangsta
 
Join Date: Jun 2009
Posts: 602
Reputation: 0
Default Re: Making an restaurant..

use onplayercommandtext, look on wiki for how this works

Then if player types /buy do a check to see if they are in the restaurant, as suggested playertopoint function.

then if they are display a menu or something with a list. Again you can find tutorials on how to do menues on the forum and on the wiki.

hope that helps.

I assume you already have some way for someone to enter the restaurant?
__________________
mansonh is offline  
Old 19/01/2010, 06:39 PM   #5
Rangard
Little Clucker
 
Join Date: Jan 2008
Posts: 16
Reputation: 0
Default Re: Making an restaurant..

Well, that helped, but I am "green" in these things so can anyone put me example code ?

;x
Rangard is offline  
Old 19/01/2010, 06:44 PM   #6
Nakash
Huge Clucker
 
Join Date: Jan 2008
Posts: 241
Reputation: 0
Default Re: Making an restaurant..

pawn Code:
if(strcmp(cmd, "/eat", true) == 0)
    {
       new Float:health;
       GetPlayerHealth(playerid,health);
       string sendername[MAX_PLAYER_NAME];

       GetPlayerName(playerid, sendername, sizeof(sendername));
       format(string, sizeof(string), "* %s eats something",sendername);
       ProxDetector(30.0, playerid, string,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
       
       if(health < 100)
       {
           SetPlayerHealth(playerid,health+15);  
       }
       return 1;
     }
UNTESTED.
Nakash is offline  
Old 19/01/2010, 06:47 PM   #7
LuxurioN™
Gangsta
 
LuxurioN™'s Avatar
 
Join Date: Oct 2007
Posts: 908
Reputation: 137
Default Re: Making an restaurant..

Very basic exemple (IN DCMD) (NOT TESTED):

pawn Code:
dcmd_buy(playerid,params[])
{
new Float:health;
GetPlayerHealth(playerid,health);

if(IsPlayerToPoint...) //verify if player is in point
{
if(!strlen(params))
{
SendClientMessage(playerid, LIGHTBLUE2, "Usage: /buy [opt1/opt2/op3/op4]");
return SendClientMessage(playerid, orange, "Function: Buy a drink!");
}
if(strcmp(params,"opt1",true) == 0){
if(health < 100)
{
SetPlayerHealth(playerid,health+20);
}
}
else if(strcmp(params,"opt2",true) == 0){
//Function
}
else if(strcmp(params,"opt3",true) == 0){
//Function
}
else if(strcmp(params,"opt4",true) == 0){
//Function
} else {
SendClientMessage(playerid, red, "ERROR: Buy Invalid!");
}
return 1;
}
else return SendClientMessage(playerid, red, "ERROR: You are not in Restaurant!!");
}
LuxurioN™ is offline  
Old 19/01/2010, 06:49 PM   #8
Rangard
Little Clucker
 
Join Date: Jan 2008
Posts: 16
Reputation: 0
Default Re: Making an restaurant..

Ok thanks, i'll try this.
Rangard is offline  
Old 19/01/2010, 07:10 PM   #9
Rangard
Little Clucker
 
Join Date: Jan 2008
Posts: 16
Reputation: 0
Default Re: Making an restaurant..

How to verify IsPlayerToPoint? Can you give me example coords?
Rangard is offline  
Old 19/01/2010, 07:17 PM   #10
LuxurioN™
Gangsta
 
LuxurioN™'s Avatar
 
Join Date: Oct 2007
Posts: 908
Reputation: 137
Default Re: Making an restaurant..

pawn Code:
PlayerToPoint(playerid,Float:radi, Float:px, Float:py, Float:pz)

Exemple:
pawn Code:
if(PlayerToPoint(playerid,3,1958.3783,1343.1572,15.3746))
LuxurioN™ is offline  
 

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
[Map] The French Restaurant & Bar kuRT. Maps 12 11/07/2010 09:55 AM
[FS/Map] Grove Restaurant Jay420 Filterscripts 9 14/04/2010 11:16 PM
restaurant with the cashier ? Ace_Steele Help Archive 11 11/07/2009 12:01 AM


All times are GMT. The time now is 11:53 AM.


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