Making an restaurant..
#1

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.
Reply
#2

you shuld use ifplayertopoint for /me and give helath use SetPlayerHealth... Use search :P Or go to sampWIKI
Reply
#3

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
Reply
#4

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?
Reply
#5

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

;x
Reply
#6

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.
Reply
#7

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!!");
}
Reply
#8

Ok thanks, i'll try this.
Reply
#9

How to verify IsPlayerToPoint? Can you give me example coords?
Reply
#10

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))
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)