SA-MP Forums Archive
Adding buyable cars - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Adding buyable cars (/showthread.php?tid=568195)



Adding buyable cars - XYZero - 20.03.2015

Hi guys, i want to ask how to add buyable cars in my server?, i used SATDM gamemode by MoNeYPiMp :P


Re: Adding buyable cars - Fantje - 20.03.2015

Quote:
Originally Posted by XYZero
Посмотреть сообщение
Hi guys, i want to ask how to add buyable cars in my server?, i used SATDM gamemode by MoNeYPiMp :P
PHP код:
public OnPlayerSpawn(playerid)
{
    
SetPlayerCheckpoint(playerid1956.2844,1342.8551,15.37463.0);
    return 
1;

PHP код:
public OnPlayerEnterCheckpoint(playerid)
{
    
ShowPlayerDialog(playeridDIALOG_CARSDIALOG_STYLE_LIST"Car Shop""Stretch\nInfernus\nBullet\nSuper GT\nHotring Racer\nElegy\nSultan\nBF Injection\nJester\nCheetah""Select""Cancel");
    return 
1;


PHP код:
public OnDialogResponse(playeriddialogidresponselistiteminputtext[])
{
    if(
dialogid == DIALOG_CARS)
    {
        if(
response// 
        
{
            
// 
            
switch(listitem)
            {
                case 
0:{
                if(
GetPlayerMoney(playerid) >= 245000)
            {
                
CreateVehicle(4091956.2844,1342.8551,15.3746,99.81310160); // Car 2
                
GivePlayerMoney(playerid, -1500);
            }
                if(
GetPlayerMoney(playerid) < 245000)
            {
                
SendClientMessage(playerid, -1"You Dont Have Enough Money");
            }
            }
                case 
1:{
                if(
GetPlayerMoney(playerid) >= 160000)
            {
                
CreateVehicle(4111956.2844,1342.8551,15.3746,99.81310160); // Car 2
                
GivePlayerMoney(playerid, -1500);
            }
                if(
GetPlayerMoney(playerid) < 160000)
            {
                
SendClientMessage(playerid, -1"You Dont Have Enough Money");
            }
            }
                case 
2:{
                if(
GetPlayerMoney(playerid) >= 140000)
            {
                
CreateVehicle(5411956.2844,1342.8551,15.3746,99.81310160); // Car 2
                
GivePlayerMoney(playerid, -1500);
            }
                if(
GetPlayerMoney(playerid) < 140000)
            {
                
SendClientMessage(playerid, -1"You Dont Have Enough Money");
            }
            }
            case 
3:{
                if(
GetPlayerMoney(playerid) >= 80000)
            {
                
CreateVehicle(5061956.2844,1342.8551,15.3746,99.81310160); // Car 2
                
GivePlayerMoney(playerid, -1500);
            }
                if(
GetPlayerMoney(playerid) < 80000)
            {
                
SendClientMessage(playerid, -1"You Dont Have Enough Money");
            }
            }
            case 
4:{
                if(
GetPlayerMoney(playerid) >= 120000)
            {
                
CreateVehicle(4941956.2844,1342.8551,15.3746,99.81310160); // Car 2
                
GivePlayerMoney(playerid, -1500);
            }
                if(
GetPlayerMoney(playerid) < 120000)
            {
                
SendClientMessage(playerid, -1"You Dont Have Enough Money");
            }
            }
            case 
5:{
                if(
GetPlayerMoney(playerid) >= 100000)
            {
                
CreateVehicle(5621956.2844,1342.8551,15.3746,99.81310160); // Car 2
                
GivePlayerMoney(playerid, -1500);
            }
                if(
GetPlayerMoney(playerid) < 100000)
            {
                
SendClientMessage(playerid, -1"You Dont Have Enough Money");
            }
            }
            case 
6:{
                if(
GetPlayerMoney(playerid) >= 45000)
            {
                
CreateVehicle(5601956.2844,1342.8551,15.3746,99.81310160); // Car 2
                
GivePlayerMoney(playerid, -1500);
            }
                if(
GetPlayerMoney(playerid) < 45000)
            {
                
SendClientMessage(playerid, -1"You Dont Have Enough Money");
            }
            }
            case 
7:{
                if(
GetPlayerMoney(playerid) >= 65000)
            {
                
CreateVehicle(4241956.2844,1342.8551,15.3746,99.81310160); // Car 2
                
GivePlayerMoney(playerid, -1500);
            }
                if(
GetPlayerMoney(playerid) < 65000)
            {
                
SendClientMessage(playerid, -1"You Dont Have Enough Money");
            }
            }
            case 
8:{
                if(
GetPlayerMoney(playerid) >= 60000)
            {
                
CreateVehicle(5591956.2844,1342.8551,15.3746,99.81310160); // Car 2
                
GivePlayerMoney(playerid, -1500);
            }
                if(
GetPlayerMoney(playerid) < 60000)
            {
                
SendClientMessage(playerid, -1"You Dont Have Enough Money");
            }
            }
            
            case 
9:{
                if(
GetPlayerMoney(playerid) >= 125000)
            {
                
CreateVehicle(4151956.2844,1342.8551,15.3746,99.81310160); // Car 2
                
GivePlayerMoney(playerid, -1500);
            }
                if(
GetPlayerMoney(playerid) < 125000)
            {
                
SendClientMessage(playerid, -1"You Dont Have Enough Money");
            }
            }
            
            }
        }
        return 
1// We handled a dialog, so return 1. Just like OnPlayerCommandText.
    
}
    return 
0// You MUST return 0 here! Just like OnPlayerCommandText.

+REP If I helped you


Re: Adding buyable cars - XYZero - 20.03.2015

Not carshop, That's not what i want, I just want to add new buyable cars, so someone can buy with /vbuy command in the car, because in my server don't have Duneride car, so i want to add it in my server.
And thankyou for your respond. Sorry for my bad english


Re: Adding buyable cars - Fantje - 20.03.2015

Quote:
Originally Posted by XYZero
Посмотреть сообщение
Not carshop, That's not what i want, I just want to add new buyable cars, so someone can buy with /vbuy command in the car, because in my server don't have Duneride car, so i want to add it in my server.
And thankyou for your respond. Sorry for my bad english
You're welcome


Re: Adding buyable cars - SickAttack - 20.03.2015

Quote:
Originally Posted by XYZero
Посмотреть сообщение
Not carshop, That's not what i want, I just want to add new buyable cars, so someone can buy with /vbuy command in the car, because in my server don't have Duneride car, so i want to add it in my server.
And thankyou for your respond. Sorry for my bad english
Then post your code.


Re: Adding buyable cars - XYZero - 20.03.2015

What code you mean?


Re: Adding buyable cars - Bester - 20.03.2015

you need to make cmdtext or
dcmd_vbuy whichever you used in your script i will go witg dcmd

and then put the same shop code as Fantje put above
this will make you a command /vbuy which players can use to buy vehicles you added for buying
i give demo below

Код:
new vehicleshopDialog;
dcmd_vbuy(playerid, params[])
{
#pragma unused playerid,params
ShowPlayerDialog(playerid,vehicleshopDialog,DIALOG_STYLE_LIST, "Vehicle Shop", "Stretch\nInfernus\nBullet\nSuper GT\nHotring Racer\nElegy\nSultan\nBF Injection\nJester\nCheetah", "Select", "Cancel");
    return 1;
}
and then put the "public OnDialogResponse" code as above Fantje given


Re: Adding buyable cars - XYZero - 20.03.2015

Quote:
Originally Posted by Bester
Посмотреть сообщение
you need to make cmdtext or
dcmd_vbuy whichever you used in your script i will go witg dcmd

and then put the same shop code as Fantje put above
this will make you a command /vbuy which players can use to buy vehicles you added for buying
i give demo below

Код:
new vehicleshopDialog;
dcmd_vbuy(playerid, params[])
{
#pragma unused playerid,params
ShowPlayerDialog(playerid,vehicleshopDialog,DIALOG_STYLE_LIST, "Vehicle Shop", "Stretch\nInfernus\nBullet\nSuper GT\nHotring Racer\nElegy\nSultan\nBF Injection\nJester\nCheetah", "Select", "Cancel");
    return 1;
}
and then put the "public OnDialogResponse" code as above Fantje given
Pfftt that's not what i want, not vehicle shop, just get in the car then type /vbuy.
this image when i want to get in the buyable car

and this image when i want to get in the owned car



Re: Adding buyable cars - XYZero - 21.03.2015

No one? :O
Please help, i neeeed it


Re: Adding buyable cars - mirou123 - 21.03.2015

Pos the code under OnPlayerEnterVehicle or OnPlayerStateChange. The code used must be under one of those.