Author Topic: How To Set Enter Place ?  (Read 3862 times)

0 Members and 1 Guest are viewing this topic.

Offline [Akatsuki]Itachi

  • Wiseguy
  • **
  • Posts: 65
  • I am just a normal ???? people.
    • View Profile
    • [Akatsuki]Konoha
How To Set Enter Place ?
« on: July 07, 2013, 04:03:35 am »
Just like when you type !heal, it say you need to be in hospital. How can i set where is the hospital and if player enter the hospital it will send client message, how to type the if player enter location. Who can give me the example ? And also how to use this function on automatic without using commands like it will do it by its own
[pawn]GetPlayerLocation[/pawn]
And then will what ever like send client message
« Last Edit: July 07, 2013, 04:22:20 am by [Akatsuki]Itachi »
Anybody see my server: [Akatsuki]Konoha are pleased to come in. Why I choose that name? Because it just like in Naruto, got jutsu and mission based on Naruto's story. Sadly, only available for Friday, Saturday and Sunday. More sadly is maybe not available for 3 month starting from Jun.

Offline dynavolt71

  • Crime Boss
  • ****
  • Posts: 371
    • View Profile
    • My Blog
Re: How To Set Enter Place ?
« Reply #1 on: July 07, 2013, 05:16:17 am »
use GUPS in script showroom
And
DO NOT ask for giving cmd/func
P.s : change your name (many players using nick "itachi")
[PAWNO]Fix Error " Failed to set data for "" " - http://forum.vicecitymultiplayer.com/index.php?topic=5743.0



:'(

Offline NeskWriter

  • Crime Boss
  • ****
  • Posts: 355
    • View Profile
Re: How To Set Enter Place ?
« Reply #2 on: July 07, 2013, 08:55:08 pm »
Wrong topic, dude.
this must be posted in Scripting showroom, I guess


-Funniest quotes-

Quote from: asad3man
i cant able to understand

Offline [Akatsuki]Itachi

  • Wiseguy
  • **
  • Posts: 65
  • I am just a normal ???? people.
    • View Profile
    • [Akatsuki]Konoha
Re: How To Set Enter Place ?
« Reply #3 on: July 08, 2013, 09:24:37 am »
so how am i able to put this topic to pawn scripting board ? And then we will continue discuss. Anyway, this board have a description tell us that we can talk about anything about VCMP .
Anybody see my server: [Akatsuki]Konoha are pleased to come in. Why I choose that name? Because it just like in Naruto, got jutsu and mission based on Naruto's story. Sadly, only available for Friday, Saturday and Sunday. More sadly is maybe not available for 3 month starting from Jun.

Offline NeskWriter

  • Crime Boss
  • ****
  • Posts: 355
    • View Profile
Re: How To Set Enter Place ?
« Reply #4 on: July 08, 2013, 03:17:11 pm »
I will try to make an example for you:

Put this line in the beginning of ur code, before OnGameModeInit:
[pawn]forward IsPlayerAtZone(playerid, Float:minx, Float:maxx, Float:miny, Float:maxy);[/pawn]
All the public functions must be forwarded, this is the rule of Pawn.

Now let's put our public function anywhere, between another public functions:
[pawn]public IsPlayerAtZone(playerid, Float:minx, Float:maxx, Float:miny, Float:maxy)
{
   new Float:plrx, Float:plry, Float:plrz; //we are declaring new floats - plrx, plr and plrz
   GetPlayerPos(playerid, plrx, plry, plrz); //we are setting their parameters through getting player's position (x, y, z)
   if(plrx >= minx && plrx <= maxx && plry >= miny && plry <= maxy) //if all the conditions (plrx >= minx && plrx <= maxx && plry >= miny && plry <= maxy) are true
   {
      return 1; // then we will be returned a "true" value of the "IsPlayerAtZone"function, like: -Is player at hospital? return 1 says: -Yes he is, because all the conditions are true!
   }
   return 0;
}[/pawn]

Now, let's use my stock function, that substracts player's cash according to the hp number he needs to be healthy :P. Put this after public OnPlayerText:
[pawn]stock SellPlayerHealth(playerid)
{
   new Float:phealth, Float:product1, Float:product2;
   new pmoney = GetPlayerMoney(playerid);
   new money2pay[256];
   GetPlayerHealth(playerid, phealth);
   if(phealth <= 99)
   {
      product1 = floatsub(100, phealth);
      product2 = floatmul(product1, 5);//My price for 1hp is $5, change "5" on your integer if you want
      format(money2pay, sizeof(money2pay), "%0.2f", product2);
      new money2payfinal = strval(money2pay);
      if(money2payfinal <= pmoney)
      {
          SetPlayerHealth(playerid, 100);
          SetPlayerMoney(playerid, pmoney - money2payfinal);
         new string2[256];
         format(string2, sizeof(string2), "You have been healed for $%d", money2payfinal);
         SendClientMessage(playerid, 0xFFFFFFAA, string2);
      }
      else
      {
          new string3[256];
          format(string3, sizeof(string3), "You don't have enough money (you need $%d)", money2payfinal);
          SendClientMessage(playerid, 0xFF0000AA, string3);
      }
   }
   else
   {
       SendClientMessage(playerid, 0xFF0000AA, "You don't need to heal yourself");
   }
}[/pawn]
P.S. If u want to increase ur knowledge about this function PM me

Now let's put this in OnPlayerText:
[pawn]if(strcmp(text, "!healme", true)==0)
   {
      if(IsPlayerAtZone(playerid, -118.94831, -98.60392, -993.66656, -959.46441)) //we check if the player is at hospital, we will be returned true (yes, he is) if he is
      {
         SellPlayerHealth(playerid); //if he is, he will be "healed"
      }
      else //otherwise (if one or more conditions aren't true)
      {
            SendClientMessage(playerid, 0xFF0000AA, "You are not at the hospital!"); //he will be sent a message noticed that he isn't at the hospital coordinates
        }
   }[/pawn]



Good luck, tell me if I admitted any mistake


-Funniest quotes-

Quote from: asad3man
i cant able to understand

Offline aledark24

  • Made Man
  • ***
  • Posts: 206
  • I am a scripter and you have celous of me....so you crashed my servers
    • View Profile
Re: How To Set Enter Place ?
« Reply #5 on: July 08, 2013, 09:40:19 pm »
wtf is this?
better is use playertopoint... of you want heal in all hospital......

and not use innecesary things in one simple command......


you need stay death... nesk...
I am a great scripter and you are celous of my works
.....

Vice City Life Multiplayer By Saint

Offline NeskWriter

  • Crime Boss
  • ****
  • Posts: 355
    • View Profile
Re: How To Set Enter Place ?
« Reply #6 on: July 08, 2013, 10:51:29 pm »
wtf is this?
better is use playertopoint... of you want heal in all hospital......

and not use innecesary things in one simple command......


you need stay death... nesk...

mKay, but I suggest u to make a better one


-Funniest quotes-

Quote from: asad3man
i cant able to understand

Offline [Akatsuki]Itachi

  • Wiseguy
  • **
  • Posts: 65
  • I am just a normal ???? people.
    • View Profile
    • [Akatsuki]Konoha
Re: How To Set Enter Place ?
« Reply #7 on: July 09, 2013, 08:59:58 am »
thank you NeskWritter, I will try it.  ;D
Anybody see my server: [Akatsuki]Konoha are pleased to come in. Why I choose that name? Because it just like in Naruto, got jutsu and mission based on Naruto's story. Sadly, only available for Friday, Saturday and Sunday. More sadly is maybe not available for 3 month starting from Jun.