SA-MP Forums

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

 
 
Thread Tools Display Modes
Old 21/06/2010, 06:34 PM   #1
ArTisT
Big Clucker
 
Join Date: Mar 2009
Posts: 99
Reputation: 0
Default /buycar cmd on levels

Quote:
if(strcmp(cmd, "/buycar", true) == 0)
{
if(IsAnOwnableCar(idcar))
{
if(PlayerInfo[playerid][pLevel] < 5)
{
SendClientMessage(playerid, COLOR_GREY, "You need to be level 5 to buy a vehicle!");
return 1;
}
if(PlayerInfo[playerid][pPcarkey] == 999) { }
else if(PlayerInfo[playerid][pPcarkey2] == 999) { }
else if(PlayerInfo[playerid][pPcarkey3] == 999) { }
else { SendClientMessage(playerid, COLOR_GREY, " You already own 3 vehicles"); return 1; }
if(CarInfo[idcar][cOwned]==1)
{
SendClientMessage(playerid, COLOR_GREY, "Someone already owns this car");
return 1;
}
if(GetPlayerMoney(playerid) >= CarInfo[idcar][cValue])
{
if(PlayerInfo[playerid][pPcarkey] == 999) { PlayerInfo[playerid][pPcarkey] = idcar; }
else if(PlayerInfo[playerid][pPcarkey2] == 999) { PlayerInfo[playerid][pPcarkey2] = idcar; }
else if(PlayerInfo[playerid][pPcarkey3] == 999) { PlayerInfo[playerid][pPcarkey3] = idcar; }
else { return 1; }
CarInfo[idcar][cOwned] = 1;
GetPlayerName(playerid, sendername, sizeof(sendername));
strmid(CarInfo[idcar][cOwner], sendername, 0, strlen(sendername), 999);
GivePlayerMoney(playerid,-CarInfo[idcar][cValue]);
PlayerPlayMusic(playerid);
GameTextForPlayer(playerid, "~w~Congratulations~n~Don't forget to /parkcar it!", 5000, 3);
SendClientMessage(playerid, COLOR_GRAD2, "Congratulations on your new purchase!");
SendClientMessage(playerid, COLOR_GRAD2, "Type /carhelp to view the car system help");
SendClientMessage(playerid, COLOR_GRAD2, "You can start the engine up now !");
//gEngine[playerid] = 0;
//engineOn[GetPlayerVehicleID(playerid)] = false;
DateProp(playerid);
OnPropUpdate();
PlayerUpdate(playerid);
return 1;
}
else
{
SendClientMessage(playerid, COLOR_GREY, " You don't have enough cash with you ! ");
return 1;
}
}
return 1;
}
I want that example till level 10 he can buy 1 vehicle after he reaches lvl 15 he should be able to buy his 2nd vehcile etc... how to do it ?

So with lvl 10 = i can only buy 1 vehicle
With lvl 15 = im allowed to buy my 2nd vehcile etc...
ArTisT is offline  
Old 22/06/2010, 10:51 AM   #2
ArTisT
Big Clucker
 
Join Date: Mar 2009
Posts: 99
Reputation: 0
Default Re: /buycar cmd on levels

None can help ?

Now that lvl 5 goes for all.. if they are lvl 5 then can buy 3 cars. but i wan't example with lvl 5 they can buy 1 car lvl 10 2nd car lvl 15 3rd car etc...
ArTisT is offline  
Old 22/06/2010, 11:08 AM   #3
titanak
Huge Clucker
 
titanak's Avatar
 
Join Date: May 2010
Location: Estonia
Posts: 358
Reputation: 16
Default Re: /buycar cmd on levels

try this one

pawn Code:
if(strcmp(cmd, "/buycar", true) == 0)
  {
        if(IsAnOwnableCar(idcar))
        {
          if(PlayerInfo[playerid][pLevel] > 10)
        {
            SendClientMessage(playerid, COLOR_GREY, "You need to be level 10 to buy a vehicle!");
            return 1;
        }
        if(PlayerInfo[playerid][pPcarkey] == 999) { }
        else if(PlayerInfo[playerid][pPcarkey2] == 999) { }
        else if(PlayerInfo[playerid][pPcarkey3] == 999) { }
        else { SendClientMessage(playerid, COLOR_GREY, "You already own 3 vehicles"); return 1; }
        if(CarInfo[idcar][cOwned]==1)
        {
          SendClientMessage(playerid, COLOR_GREY, "Someone already owns this car");
          return 1;
        }
        if(GetPlayerMoney(playerid) >= CarInfo[idcar][cValue])
        {
          if(PlayerInfo[playerid][pPcarkey] == 999) { PlayerInfo[playerid][pPcarkey] = idcar; }
          else if(PlayerInfo[playerid][pPcarkey2] == 999) { PlayerInfo[playerid][pPcarkey2] = idcar; }
          else if(PlayerInfo[playerid][pPcarkey3] == 999) { PlayerInfo[playerid][pPcarkey3] = idcar; }
          else { return 1; }
         CarInfo[idcar][cOwned] = 1;
         GetPlayerName(playerid, sendername, sizeof(sendername));
         strmid(CarInfo[idcar][cOwner], sendername, 0, strlen(sendername), 999);
         GivePlayerMoney(playerid,-CarInfo[idcar][cValue]);
         PlayerPlayMusic(playerid);
         GameTextForPlayer(playerid, "~w~Congratulations~n~Don't forget to /parkcar it!", 5000, 3);
         SendClientMessage(playerid, COLOR_GRAD2, "Congratulations on your new purchase!");
         SendClientMessage(playerid, COLOR_GRAD2, "Type /carhelp to view the car system help");
         SendClientMessage(playerid, COLOR_GRAD2, "You can start the engine up now !");
         //gEngine[playerid] = 0;
         //engineOn[GetPlayerVehicleID(playerid)] = false;
         DateProp(playerid);
         OnPropUpdate();
         PlayerUpdate(playerid);
         return 1;
        }
        else
        {
          SendClientMessage(playerid, COLOR_GREY, "You don't have enough cash with you ! ");
          return 1;
        }
        }
       return 1;
      }

_________________________________________________
all you have to do is change
pawn Code:
if(PlayerInfo[playerid][pLevel] > 5)
to
pawn Code:
if(PlayerInfo[playerid][pLevel] > 10)
titanak is offline  
Old 22/06/2010, 11:29 AM   #4
ArTisT
Big Clucker
 
Join Date: Mar 2009
Posts: 99
Reputation: 0
Default Re: /buycar cmd on levels

yo i dont mean this.. Now you can buy 3 vehicles if your level 5.. but i want if you level 5 u can only buy 1 vehicle if ur lvl 10 u can buy ur 2nd vehicle etc..
ArTisT is offline  
Old 22/06/2010, 11:33 AM   #5
titanak
Huge Clucker
 
titanak's Avatar
 
Join Date: May 2010
Location: Estonia
Posts: 358
Reputation: 16
Default Re: /buycar cmd on levels

these are car keys ?

pawn Code:
if(PlayerInfo[playerid][pPcarkey] == 999) { PlayerInfo[playerid][pPcarkey] = idcar; }
          else if(PlayerInfo[playerid][pPcarkey2] == 999) { PlayerInfo[playerid][pPcarkey2] = idcar; }
          else if(PlayerInfo[playerid][pPcarkey3] == 999) { PlayerInfo[playerid][pPcarkey3] = idcar; }
titanak is offline  
Old 22/06/2010, 11:35 AM   #6
ArTisT
Big Clucker
 
Join Date: Mar 2009
Posts: 99
Reputation: 0
Default Re: /buycar cmd on levels

ye

999 = u dont own any car
ArTisT is offline  
Old 22/06/2010, 11:37 AM   #7
titanak
Huge Clucker
 
titanak's Avatar
 
Join Date: May 2010
Location: Estonia
Posts: 358
Reputation: 16
Default Re: /buycar cmd on levels

cant help you with this sorry.
titanak 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
[HELP] buycar Jimbo01 Help Archive 3 06/07/2010 03:07 PM
Buycar Help plz plz Heroeskung55 Help Archive 2 19/01/2010 02:48 PM
/buycar help Im_BanK Help Archive 0 20/12/2009 05:43 PM
[help] /buycar final08 Help Archive 1 13/10/2009 12:57 PM
[LARP] buycar problem killar456 Help Archive 1 31/03/2009 03:44 PM


All times are GMT. The time now is 03:19 PM.


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