Buying help
#4

Quote:

// I must put something here to it will know he bougt the laptop ?

Yes, but I would re-arrange the command to make it a little better!

Basically like this:
Код:
  if(!strcmp(cmdtext,"/buy laptop", true))
  {
    if(PlayerToPoint(20, playerid, -27.5028,-51.9626,1003.5469))
    {
      if(GetPlayerMoney(playerid) >= 450) // Check if the player has enough money
      {
        if(HasLaptop[playerid] == 0) // Check if the player does NOT have a laptop
        {
          SendClientMessage(playerid,COLOR_GREEN,"You have bought a laptop for 450$");
          GivePlayerMoney(playerid, -450);
          HasLaptop[playerid] = 1; // Set the laptop variable to 1
        }
        else // Player already has a laptop
        {
          SendClientMessage(playerid,COLOR_GREEN,"You already have a laptop!");
        }
      } 
      else
      {
        SendClientMessage(playerid,COLOR_GREEN,"You need 450$ to buy a laptop!");
        return 1;
      }
    }
    else
    {
      SendClientMessage(playerid,COLOR_RED,"You're not in a shop");
    }
    return 1;
  }
Again, this is without stat saving. If you want, you can contact me via msn, so that you don't have to post your code. (stephengp(a)hotmail.com) replace the (a) with @, lol

Also, don't say sorry... we all start from somewhere.


Hope this helps.
Reply


Messages In This Thread
Buying help - by XtremeChio - 08.08.2009, 20:21
Re: Buying help - by XPlatform - 08.08.2009, 20:31
Re: Buying help - by XtremeChio - 08.08.2009, 20:47
Re: Buying help - by XPlatform - 08.08.2009, 21:03

Forum Jump:


Users browsing this thread: 3 Guest(s)