Upgrading the Vehicle Dealership
#1

Hello guys,today i want to improve my gamemode by improving the vehicle dealership.
Let me explain,i have an dynamic dealership in my gamemode,but its the type of dealership which works with /acreatecar[the admin create the cars,the cars spawn and if someone enter on them they can /v buy them].
This is the problem,i want to change this into a special one: if a players goes to the dealership and type a command like /buycar infernus or /buycar turismo or maybe an advanced one with a dialog popping up.So what i want from you to know,i want some tips on how to make this happen,i want to modify this dealer,not to remove/replace it,i want to make it so players can buy cars themselves and after they purchase the car,the car would be on their name[they would be the owner] ,i hope you understood.


I have an idea doing this,i trying to make 1 command from 2 commands[ /acreatecar + /v buy] ,but i dont really know how,i want to merge those 2 commands into 1 command],any other tips or ideas are welcome.


This is the /acreatecar command :


PHP код:
//===============================[/acreatecar]==================================
if(strcmp(cmd"/acreatecar"true) == 0)
    {
        if(
PlayerInfo[playerid][pAdmin] >= 1339 || IsPlayerAdmin(playerid))
         {
            
tmp strtok(cmdtextidx);
            if(!
strlen(tmp))
            {
                
SendClientMessage(playeridCOLOR_WHITE"{00A1FF}USAGE:{C0C0C0} /acreatecar [carid] [color1] [color2] [price]");
                return 
1;
            }
            new 
car;
            
car strval(tmp);
            if(
car 400 || car 611) { SendClientMessage(playeridCOLOR_WHITE"{0950F7}* Vehicle Number can't be below 400 or above 611 !"); return 1; }
            
tmp strtok(cmdtextidx);
            if(!
strlen(tmp)) { SendClientMessage(playeridCOLOR_WHITE"{00A1FF}USAGE:{C0C0C0} /acreatecar [carid] [color1] [color2] [price]"); return 1; }
            new 
color1;
            
color1 strval(tmp);
            if(
color1 || color1 126) { SendClientMessage(playeridCOLOR_WHITE"{0950F7}* Color Number can't be below 0 or above 126 !"); return 1; }
            
tmp strtok(cmdtextidx);
            if(!
strlen(tmp)) { SendClientMessage(playeridCOLOR_WHITE"{00A1FF}USAGE:{C0C0C0} /acreatecar [carid] [color1] [color2] [price]"); return 1; }
            new 
color2;
            
color2 strval(tmp);
            if(
color2 || color2 126) { SendClientMessage(playeridCOLOR_WHITE"{0950F7}* Color Number can't be below 0 or above 126 !"); return 1; }
            
tmp strtok(cmdtextidx);
            if(!
strlen(tmp)) { SendClientMessage(playeridCOLOR_WHITE"{00A1FF}USAGE:{C0C0C0} /acreatecar [carid] [color1] [color2] [price]"); return 1; }
            new 
Float:X,Float:Y,Float:ZGetPlayerPos(playeridX,Y,Z);
            new 
thiscar CreateVehicle(car,X,Y,Z,1,color1,color2,99999999);
            new 
value strval(tmp);
              
CarInfo[thiscar][cOwned] = 0CarInfo[thiscar][cModel] = carCarInfo[thiscar][cColorOne] = color1CarInfo[thiscar][cColorTwo] = color2;
            
CarInfo[thiscar][cLocationx] = XCarInfo[thiscar][cLocationy] = YCarInfo[thiscar][cLocationz] = ZCarInfo[thiscar][cAngle] = 1;
              
CarInfo[thiscar][cValue] = valueCarInfo[thiscar][paintjob] = -1LoadComponents(thiscar); PutPlayerInVehicle(playerid,thiscar,0);
            
strmid(CarInfo[vehid][cOwner], "Dealership"0strlen("Dealership"), 999);
            
format(CarInfo[thiscar][cDescription], 32"%s",vehName[GetVehicleModel(GetPlayerVehicleID(playerid))-400]);
//            format(TextCar, sizeof(TextCar), "{EE1111}ForSale: {80D52B}• $%d •", CarInfo[thiscar][cValue]);
//            TextUpCar[thiscar] = Create3DTextLabel(TextCar, 0x33AAFFFF , 0.0, 0.0, 0.0, 25, 0, 1);
//            Attach3DTextLabelToVehicle(TextUpCar[thiscar], thiscar, 0.0, 0.0, 0.1);
            
format(stringsizeof(string), " Personal Car was created.ID: {FFFFFF}[%d]"thiscar);
            
SendClientMessage(playeridCOLOR_GREENstring);
            
//ShowPlayerDialog(playerid,DIALOGIDSETOWNER,DIALOG_STYLE_INPUT,"{E0941B}Vehicle owner","Scrie ID/Nume player\nca sa il faci proprietar:","Enter","Close");
            
OnCarUpdate();
            return 
1;
        }
        else
        {
            
SendClientMessage(playeridCOLOR_RED" You are not authorized to use that command ");
            return 
1;
        }
    } 
And the /v buy command:

PHP код:
  else if(strcmp(x_nr,"buy",true) == 0)
            {
                if(
IsAnOwnableCar(idcar))
                {
                    if(
PlayerInfo[playerid][pPcarkey] == -1) { }
                    else if(
PlayerInfo[playerid][pPcarkey2] == -1) { }
                    else if(
PlayerInfo[playerid][pPcarkey3] == -1) { }
                    else { 
SendClientMessage(playeridCOLOR_GREY"* Detii 3 masini!"); return 1; }
                    if(
CarInfo[idcar][cOwned]==1)
                    {
                        
SendClientMessage(playeridCOLOR_GREY"Someone already owns this car.");
                        return 
1;
                    }
                    if(
GetPlayerMoney(playerid) >= CarInfo[idcar][cValue])
                    {
                        if(
PlayerInfo[playerid][pPcarkey] == -1) { PlayerInfo[playerid][pPcarkey] = idcar; }
                        else if(
PlayerInfo[playerid][pPcarkey2] == -1) { PlayerInfo[playerid][pPcarkey2] = idcar; }
                        else if(
PlayerInfo[playerid][pPcarkey3] == -1) { PlayerInfo[playerid][pPcarkey3] = idcar; }
                        else { return 
1; }
                        
CarInfo[idcar][cOwned] = 1;
                        
GetPlayerName(playeridsendernamesizeof(sendername));
                        
strmid(CarInfo[idcar][cOwner], sendername0strlen(sendername), 999);
                        
GivePlayerMoney(playerid,-CarInfo[idcar][cValue]);
                        
Delete3DTextLabel(TextUpCar[idcar]);
                        
//format(TextCar, sizeof(TextCar), "{EE1111}Owner: {0099FF}• %s •", CarInfo[idcar][cOwner]);
                        //TextUpCar[idcar] = Create3DTextLabel(TextCar, 0x33AAFFFF, 0.0, 0.0, 0.0, 25, 0, 1);
                        //Attach3DTextLabelToVehicle(TextUpCar[idcar], idcar, 0.0, 0.0, 0.1);
                        
OnCarUpdate(); SavePlayerData(playerid);
                        
PlayerPlaySound(playerid10520.00.00.0);
                        
GameTextForPlayer(playerid"~w~Felicitari~n~Nu uita sa o parchezi cu /v park !"50003);
                        
TogglePlayerControllable(playerid1);
                        return 
1;
                    } 
I dont want you to give me a script,i just want tips on how to do it,or maybe something to improve my knowledge of this type of dealership.
If you don`t understand what i`m trying to do,please reply.Thanks in advance [sorry for any english grammar mistake,i am not a native speaker]
Reply
#2

Up,please i need suggestions
Reply
#3

UP please guys some tips
Reply
#4

You can't expect anyone to check your whole code, check out some dealership TUT or FS and do the same for yourself
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)