/v sell price
#1

How do when selling the car (/ v sell) to give me a lower price than is it new?

PHP код:
if(strcmp(x_nr,"sell",true) == 0)
            {
                  if(
PlayerToPoint(100.0,playerid2808.7317,-1577.1697,10.6103))
                  {
                    if(
GetPlayerVehicleID(playerid) == PlayerInfo[playerid][pPcarkey] || GetPlayerVehicleID(playerid) == PlayerInfo[playerid][pPcarkey2] || GetPlayerVehicleID(playerid) == PlayerInfo[playerid][pPcarkey3])
                    {
                        
GetPlayerName(playeridsendernamesizeof(sendername));
                        new 
ownvehkey;
                        if(
GetPlayerVehicleID(playerid) == PlayerInfo[playerid][pPcarkey]) { ownvehkey PlayerInfo[playerid][pPcarkey]; }
                        else if(
GetPlayerVehicleID(playerid) == PlayerInfo[playerid][pPcarkey2]) { ownvehkey PlayerInfo[playerid][pPcarkey2]; }
                        else if(
GetPlayerVehicleID(playerid) == PlayerInfo[playerid][pPcarkey3]) { ownvehkey PlayerInfo[playerid][pPcarkey3]; }
                        else { return 
1; }
                        if(
strcmp(sendernameCarInfo[ownvehkey][cOwner], true) == 0)
                        {
                            new 
proracun CarInfo[ownvehkey][cValue] / 4;
                            new 
carsellprice proracun 3;
                            
CarInfo[ownvehkey][cOwned] = 0;
                            
strmid(CarInfo[ownvehkey][cOwner], "Dealership"0strlen("Dealership"), 999);
                            
SafeJBC_GivePlayerMoney(playerid,carsellprice); // cena polovnog vozila
                            
PlayerPlaySound(playerid10520.00.00.0);
                            
format(stringsizeof(string), "~w~Ai vandut masina pentru : ~n~~g~$%d"carsellprice);
                            
GameTextForPlayer(playeridstring100003);
                            
CarInfo[ownvehkey][cLocationx] = 2822.3315;//Location1
                             
CarInfo[ownvehkey][cLocationy] = -1557.8339;
                             
CarInfo[ownvehkey][cLocationz] = 10.8365;
                             
CarInfo[ownvehkey][cAngle] = 90.0000;
                             
//
                             
CarInfo[ownvehkey][cLocationx] = 2822.3315;//Location 2
                             
CarInfo[ownvehkey][cLocationy] = -1557.8339;
                             
CarInfo[ownvehkey][cLocationz] = 10.8365;
                             
CarInfo[ownvehkey][cAngle] = 90.0000;
                            
                            
// -------------------  gasi vozilo i otkljucava ga
                            
gEngine[playerid] = 0;
                            
MotorUgasen(playerid);
                            
engineOn[GetPlayerVehicleID(playerid)] = 0;
                            
CarInfo[ownvehkey][cLock] = 0;
// -------------------
                            
if(GetPlayerVehicleID(playerid) == PlayerInfo[playerid][pPcarkey]) { PlayerInfo[playerid][pPcarkey] = 999; }
                            else if(
GetPlayerVehicleID(playerid) == PlayerInfo[playerid][pPcarkey2]) { PlayerInfo[playerid][pPcarkey2] = 999; }
                            else if(
GetPlayerVehicleID(playerid) == PlayerInfo[playerid][pPcarkey3]) { PlayerInfo[playerid][pPcarkey3] = 999; }
                            
RemovePlayerFromVehicle(playerid);
                            
TogglePlayerControllable(playerid1);
                            if(
PlayerInfo[playerid][pLocal] == ownvehkey)
                            {
                                
SetPlayerInterior(playerid,0);
                                
JBC_SetPlayerPos(playerid,CarInfo[ownvehkey][cLocationx],CarInfo[ownvehkey][cLocationy],CarInfo[ownvehkey][cLocationz]);
                                
PlayerInfo[playerid][pInt] = 0;
                            }
                            
OnPropUpdate();
                            
OnPlayerUpdateCustom(playerid);
                            
DestroyVehicle(ownvehkey);
                            
CreateVehicle(CarInfo[ownvehkey][cModel],CarInfo[ownvehkey][cLocationx],CarInfo[ownvehkey][cLocationy],CarInfo[ownvehkey][cLocationz]+1.0,CarInfo[ownvehkey][cAngle],CarInfo[ownvehkey][cColorOne],CarInfo[ownvehkey][cColorTwo],60000);
                            return 
1;
                        }
                    }
                    else
                    {
                        
SendClientMessage(playeridCOLOR_GREY"[Greseala] Trebuie sa stati in masina pentru a o putea vinde! ");
                        return 
1;
                    }
                }
                else
                {
                    
SendClientMessage(playeridCOLOR_GREY"[Greseala] Trebuie sa fi la locul de vanzare al vehiculelor!");
                    return 
1;
                }
            } 
PHP код:
else if(strcmp(x_nr,"buy",true) == 0)
            {
                if(
IsAnOwnableCar(idcar))
                {
                    if(
PlayerInfo[playerid][pLevel] < 2)
                    {
                        
SendClientMessage(playeridCOLOR_GREY"[Greseala] Trebuie sa aveti minim level 2 pentru a cumpara o masina!");
                        return 
1;
                    }
                    if(
PlayerInfo[playerid][pPcarkey] == 999) { }
                    else if(
PlayerInfo[playerid][pPcarkey2] == 999) { }
                    else if(
PlayerInfo[playerid][pPcarkey3] == 999) { }
                    else { 
SendClientMessage(playeridCOLOR_GREY"[Greseala] Deja deti 3 masinii !"); return 1; }
                    if(
CarInfo[idcar][cOwned]==1)
                    {
                        
SendClientMessage(playeridCOLOR_GREY"[Greseala] Cineva detine  acest vehicul !");
                        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(playeridsendernamesizeof(sendername));
                        
strmid(CarInfo[idcar][cOwner], sendername0strlen(sendername), 999);
                        
SafeJBC_GivePlayerMoney(playerid,-CarInfo[idcar][cValue]);
                        
GameTextForPlayer(playerid"~w~Felicitari~n~Nu uitati /v park pentru a parca masina!"50003);
                        
SendClientMessage(playeridCOLOR_GRAD2"{0F629F}Foloseste /v pentru a vedea comenzile masinii!");
                        
SendClientMessage(playeridCOLOR_WHITE"Acum puteti porni motorul (/engine)!");
                        
gEngine[playerid] = 0;
                        
MotorUgasen(playerid);
                        
engineOn[GetPlayerVehicleID(playerid)] = false;
// --------     ako je u auto salonu plaza      --------------------------------
            
if(IsPlayerInRangeOfPoint(playerid,1002476.5576, -2106.371613.8837))
            {
            new 
carid GetPlayerVehicleID(playerid);
            
JBC_SetVehiclePos(carid,2436.3328, -2114.584213.1851);
            
SetVehicleZAngle(carid,0.0000);
            
TogglePlayerControllable(playerid1);
            
PutPlayerInVehicle(playeridcarid0);
            }
// -----------------------------------------------------------------------------
                        
DateProp(playerid);
                        
OnPropUpdate();
                        
OnPlayerUpdateCustom(playerid);
                        return 
1;
                    }
                    else
                    {
                        
SendClientMessage(playeridCOLOR_GREY"[Greseala] Nu aveti suficienti bani ! ");
                        return 
1;
                    }
                }
            }
            else
            {
                
ShowPlayerDialog(playerid,213,DIALOG_STYLE_MSGBOX"{0F629F}Comenenzi Vehicul","{0F629F}/v park - {FFFFFF}Pentru a parca masina\n{0F629F}/v lock (1-3) - {FFFFFF}Pentru a incuia/descuia masina\n{0F629F}/v sell - {FFFFFF}Pentru a vinde masina\n{0F629F}/v sellto - {FFFFFF}Pentru a vinde masina unui player\n{0F629F}/v color - {FFFFFF}Pentru a vopsi masina\n{0F629F}/v list - {FFFFFF}Pentru a vedea propriile vehicule\n{0F629F}/v find(1-3) - {FFFFFF}Pentru a va gasi masina","Ok","");
                return 
1;
            }
        }
        return 
1;
    } 
Reply
#2

Helppppp
Reply
#3

Quote:
Originally Posted by Andrei04072
Посмотреть сообщение
Helppppp
On your code with strcmp "sell" do the following:
Replace it SafeJBC_GivePlayerMoney(playerid,carsellprice);
with that
SafeJBC_GivePlayerMoney(playerid,carsellprice\2);
As you see i added \2 and that will give you 50% of the car price you choose.
Hope it will work
Untested*
Reply
#4

Not that I give when (/ v sell) player gives half the money from the car dealer price, but after da (/ v sell) when I get on it to show that the dealer price not lower.
Reply
#5

Quote:
Originally Posted by Andrei04072
Посмотреть сообщение
Not that I give when (/ v sell) player gives half the money from the car dealer price, but after da (/ v sell) when I get on it to show that the dealer price not lower.
I dont understand what you want to do /:
The guy who is selling the car and the guy who buy it, what you want to do with them?
Reply
#6

let it do when given as (/ v sell) to give me my money on it and it will spawn where?
Reply
#7

Quote:
Originally Posted by Andrei04072
Посмотреть сообщение
let it do when given as (/ v sell) to give me my money on it and it will spawn where?
The money amount you recieved after you sold your car respawns in thebplayer money by the function GivePlayerMoney
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)