pawn Код:
if(strcmp(cmd, "/v", true) == 0 || strcmp(cmd, "/vehicle", true) == 0) // By LordMan
{
if(IsPlayerConnected(playerid))
{
if(gPlayerLogged[playerid] == 0)
{
SendClientMessage(playerid, COLOR_GREY, " You need to login first ! ");
return 1;
}
new x_nr[64];
x_nr = strtok(cmdtext, idx);
if(!strlen(x_nr))
{
SendClientMessage(playerid, COLOR_WHITE, "HINT: (/v)ehicle [name]");
SendClientMessage(playerid, COLOR_WHITE, "Available names: park, lock, sell, sellto, color,paintjob,setcode,Plate");
return 1;
}
if(strcmp(x_nr,"sell",true) == 0)
{
if(IsAtDealership(playerid))
{
if(GetPlayerVehicleID(playerid) == PlayerInfo[playerid][pPcarkey] || GetPlayerVehicleID(playerid) == PlayerInfo[playerid][pPcarkey2] || GetPlayerVehicleID(playerid) == PlayerInfo[playerid][pPcarkey3])
{
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(sendername, CarInfo[ownvehkey][cOwner], true) == 0)
{
new carsellprice = GetVehiclePrice(ownvehkey) / 4 * 3;
SafeGivePlayerMoney(playerid,carsellprice);
PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
format(string, sizeof(string), "~w~You have sold your car for: ~n~~g~$%d", carsellprice);
GameTextForPlayer(playerid, string, 10000, 3);
if(GetPlayerVehicleID(playerid) == PlayerInfo[playerid][pPcarkey])
PlayerInfo[playerid][pPcarkey] = 9999;
else if(GetPlayerVehicleID(playerid) == PlayerInfo[playerid][pPcarkey2])
PlayerInfo[playerid][pPcarkey2] = 9999;
else if(GetPlayerVehicleID(playerid) == PlayerInfo[playerid][pPcarkey3])
PlayerInfo[playerid][pPcarkey3] = 9999;
SafeRemovePlayerFromVehicle(playerid);
CarInfo[ownvehkey][cOwned] = 0;
DestroyVehicle(ownvehkey);
TogglePlayerControllable(playerid, 1);
format(string, sizeof(string),"LARP/Vehicles/%d.ini",ownvehkey);
fremove(string);
OnPlayerUpdateEx(playerid);
return 1;
}
}
else
{
SendClientMessage(playerid, COLOR_GREY, " You have to sit at your own car to sell it! ");
return 1;
}
}
else
{
SendClientMessage(playerid, COLOR_GREY, "You are not at a dealership");
return 1;
}
}
else if(strcmp(x_nr,"sellto",true) == 0)
{
if(GetPlayerVehicleID(playerid) == PlayerInfo[playerid][pPcarkey] || GetPlayerVehicleID(playerid) == PlayerInfo[playerid][pPcarkey2] || GetPlayerVehicleID(playerid) == PlayerInfo[playerid][pPcarkey3])
{
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(sendername, CarInfo[ownvehkey][cOwner], true) == 0)
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_WHITE, "HINT: /v sellto [playerid/PartOfName] [price]");
return 1;
}
giveplayerid = ReturnUser(tmp);
if(IsPlayerConnected(giveplayerid))
{
if(giveplayerid != INVALID_PLAYER_ID)
{
if(ProxDetectorS(8.0, playerid, giveplayerid))
{
if(PlayerInfo[giveplayerid][pPcarkey] == 9999)
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_WHITE, "HINT: /v sellto [playerid/PartOfName] [price]");
return 1;
}
new price;
price = strval(tmp);
if(price < 1 || price > 1500000)
{
SendClientMessage(playerid, COLOR_GREY, " Price not lower then 1 and not higher then 1500000. ");
return 1;
}
GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
format(string, sizeof(string), "* You offerd %s to buy your car for $%d .", giveplayer, price);
SendClientMessage(playerid, COLOR_WHITE, string);
format(string, sizeof(string), "* Car Owner %s offered you to buy his/her car for $%d (type /accept ownablecar) to buy.", playername, price);
SendClientMessage(giveplayerid, COLOR_WHITE, string);
OwnableCarOffer[giveplayerid] = playerid;
OwnableCarID[giveplayerid] = ownvehkey;
OwnableCarPrice[giveplayerid] = price;
return 1;
}
}
else if(PlayerInfo[giveplayerid][pPcarkey2] == 9999)
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_WHITE, "HINT: /v sellto [playerid/PartOfName] [price]");
return 1;
}
new price;
price = strval(tmp);
if(price < 1 || price > 1500000)
{
SendClientMessage(playerid, COLOR_GREY, " Price not lower then 1 and not higher then 1500000. ");
return 1;
}
GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
format(string, sizeof(string), "* You offerd %s to buy your car for $%d .", giveplayer, price);
SendClientMessage(playerid, COLOR_WHITE, string);
format(string, sizeof(string), "* Car Owner %s offered you to buy his/her car for $%d (type /accept ownablecar) to buy.", playername, price);
SendClientMessage(giveplayerid, COLOR_WHITE, string);
OwnableCarOffer[giveplayerid] = playerid;
OwnableCarID[giveplayerid] = ownvehkey;
OwnableCarPrice[giveplayerid] = price;
return 1;
}
else if(PlayerInfo[giveplayerid][pPcarkey3] == 9999)
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_WHITE, "HINT: /v sellto [playerid/PartOfName] [price]");
return 1;
}
new price;
price = strval(tmp);
if(price < 1 || price > 1500000)
{
SendClientMessage(playerid, COLOR_GREY, " Price not lower then 1 and not higher then 1500000. ");
return 1;
}
GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
format(string, sizeof(string), "* You offerd %s to buy your car for $%d .", giveplayer, price);
SendClientMessage(playerid, COLOR_WHITE, string);
format(string, sizeof(string), "* Car Owner %s offered you to buy his/her car for $%d (type /accept ownablecar) to buy.", playername, price);
SendClientMessage(giveplayerid, COLOR_WHITE, string);
OwnableCarOffer[giveplayerid] = playerid;
OwnableCarID[giveplayerid] = ownvehkey;
OwnableCarPrice[giveplayerid] = price;
return 1;
}
else
{
SendClientMessage(playerid, COLOR_GREY, " Player is not near you ! ");
return 1;
}
}
}
}
else
{
SendClientMessage(playerid, COLOR_GREY, " This is not your car");
return 1;
}
}
else
{
SendClientMessage(playerid, COLOR_GREY, " You have to sit at your own car to sell it");
return 1;
}
}
if(strcmp(x_nr,"plate",true) == 0)
{
new length = strlen(cmdtext);
while ((idx < length) && (cmdtext[idx] <= ' '))
{
idx++;
}
new offset = idx;
new result[128];
while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
{
result[idx - offset] = cmdtext[idx];
idx++;
}
result[idx - offset] = EOS;
if(!strlen(result))
{
SendClientMessage(playerid, COLOR_GRAD2, "USAGE: (/v)ehicle plate [text]");
return 1;
}
if(GetPlayerVehicleID(playerid) == PlayerInfo[playerid][pPcarkey] || GetPlayerVehicleID(playerid) == PlayerInfo[playerid][pPcarkey2] || GetPlayerVehicleID(playerid) == PlayerInfo[playerid][pPcarkey3])
{
new ownvehkey;
new car = GetPlayerVehicleID(playerid);
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(sendername, CarInfo[ownvehkey][cOwner], true) == 0)
{
if(GetPlayerMoney(playerid) < 5000)
{
SendClientMessage(playerid,COLOR_WHITE,"You need 5000$ for the Plate Change!");
return 1;
}
strmid(CarInfo[car][cPlate], result, 0, strlen(result), 999);
new vid = GetPlayerVehicleID(playerid);
GivePlayerMoney(playerid,-5000);
SetVehicleNumberPlate(vid, CarInfo[vid][cPlate]);
RemovePlayerFromVehicle(playerid);
PlayerInfo[playerid][pPChanges] -= 1;
SetVehicleToRespawn(GetPlayerVehicleID(playerid));
OnPropUpdate(4,car);
return 1;
}
}
else
{
SendClientMessage(playerid, COLOR_GREY, " Please sit in your car before selling! ");
return 1;
}
}
else if(strcmp(x_nr,"park",true) == 0)
{
new Float:x,Float:y,Float:z;
new Float:a;
new carid;
new getcarid;
new pname[MAX_PLAYER_NAME];
GetPlayerName(playerid,pname,sizeof(pname));
getcarid = GetPlayerVehicleID(playerid);
carid = GetPlayerVehicleID(playerid);
GetPlayerName(playerid, playername, sizeof(playername));
GetVehiclePos(carid, x, y, z);
GetVehicleZAngle(carid, a);
if(!strcmp(CarInfo[getcarid][cOwner], pname, false) && IsPlayerInVehicle(playerid,carid) && CarInfo[carid][cOwned] == 1)
{
if(PlayerInfo[playerid][pPcarkey] == 9999 && PlayerInfo[playerid][pPcarkey2] == 9999 && PlayerInfo[playerid][pPcarkey3] == 9999)
{
SendClientMessage(playerid, COLOR_GREY, "You don't own a vehicle.");
return 1;
}
if(getcarid == carid)
{
CarInfo[carid][cLocationx] = x;
CarInfo[carid][cLocationy] = y;
CarInfo[carid][cLocationz] = z;
CarInfo[carid][cAngle] = a;
new area[35];
GetPlayer2DZone(playerid, area, sizeof(area));
format(string, sizeof(string), "~w~Parked ~n~~b~(%s).",area);
GameTextForPlayer(playerid, string, 10000, 3);
format(string, sizeof(string), "Vehicle Parked: %f.01, %f.01, %f.01 Location: %s",x,y,z,area);
SendClientMessage(playerid, COLOR_YELLOW2, string);
OnPropUpdate(4,carid);
OnPlayerUpdateEx(playerid);
DestroyVehicle(carid);
ownedcar[carid] = AddStaticVehicleEx(CarInfo[carid][cModel],CarInfo[carid][cLocationx],CarInfo[carid][cLocationy],CarInfo[carid][cLocationz]+1.0,CarInfo[carid][cAngle],CarInfo[carid][cColorOne],CarInfo[carid][cColorTwo],-1);
if(CarInfo[carid][cPaintjob] != 9999)
{
ChangeVehiclePaintjob(carid, CarInfo[carid][cPaintjob]);
}
SetVehicleVirtualWorld(carid, CarInfo[carid][cVirWorld]);
SetVehicleModifications(carid);
TogglePlayerControllable(playerid, 1);
PutPlayerInVehicle(playerid, carid, 0);
return 1;
}
}
}
else if(strcmp(x_nr,"setcode",true) == 0)
{
new carid;
if(GetPlayerVehicleID(playerid) == PlayerInfo[playerid][pPcarkey]) { carid = PlayerInfo[playerid][pPcarkey]; }
else if(GetPlayerVehicleID(playerid) == PlayerInfo[playerid][pPcarkey2]) { carid = PlayerInfo[playerid][pPcarkey2]; }
else if(GetPlayerVehicleID(playerid) == PlayerInfo[playerid][pPcarkey3]) { carid = PlayerInfo[playerid][pPcarkey3]; }
else { return 1; }
if(IsPlayerInVehicle(playerid,carid) && CarInfo[carid][cOwned] == 1)
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_WHITE, "HINT: /v setcode [code]");
SendClientMessage(playerid, COLOR_WHITE, "Between one and Two digits, Every Digit will cost you 3000");
SendClientMessage(playerid, COLOR_WHITE, "Between three and four digits, Every Digit will cost you 6000");
SendClientMessage(playerid, COLOR_WHITE, "Between five and seven digits, Every Digit will cost you 8000");
SendClientMessage(playerid, COLOR_WHITE, "Between four and seven digits, Every Digit will cost you 6000");
SendClientMessage(playerid, COLOR_WHITE, "And a code with 8 characters will cost you 80000$");
return 1;
}
new price;
price = strval(tmp);
Digits = GetDigits(strval(tmp));
if(Digits <= 0 && Digits >= 11) return SendClientMessage(playerid,COLOR_GREY,"* Security code must contain between 1 and 12 characters");
new FinalPrice;
if(Digits >= 1 && Digits <= 2)
{
FinalPrice = 3000*Digits;
}
else if(Digits >= 3 && Digits <= 4)
{
FinalPrice = 6000*Digits;
}
else if(Digits >= 5 && Digits <= 7)
{
FinalPrice = 8000*Digits;
}
else if(Digits == 8)
{
FinalPrice = 10000*Digits;
}
if(GetPlayerMoney(playerid) < FinalPrice)
{
format(string, sizeof(string),"You cannot afford that much ($%d)!",FinalPrice);
SendClientMessage(playerid, COLOR_GREY,string);
return 1;
}
SafeGivePlayerMoney(playerid, -FinalPrice);
CarInfo[carid][cCode] = price;
OnPropUpdate(4,carid);
format(string, sizeof(string),"* New car security code is %d, and it costed you $%d!!", price, FinalPrice);
SendClientMessage(playerid, COLOR_GREY, string);
}
}
else if(strcmp(x_nr,"lock",true) == 0)
{
new keycar = PlayerInfo[playerid][pPcarkey];
if(keycar != 9999)
{
new locked[128];
locked = strtok(cmdtext, idx);
if(CarInfo[keycar][cLock] == 1)
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
if (IsPlayerConnected(i))
{
SetVehicleParamsForPlayer(keycar,i,0,0);
}
}
format(string, sizeof(string), "~w~Vehicle~n~~g~Unlocked");
GameTextForPlayer(playerid, string, 4000, 3);
CarInfo[keycar][cLock] = 0;
OnPropUpdate(4,keycar);
return 1;
}
else if(CarInfo[keycar][cLock] == 0)
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
if (IsPlayerConnected(i))
{
SetVehicleParamsForPlayer(keycar,i,0,1);
}
}
format(string, sizeof(string), "~w~Vehicle~n~~r~Locked");
GameTextForPlayer(playerid, string, 4000, 3);
CarInfo[keycar][cLock] = 1;
OnPropUpdate(4,keycar);
return 1;
}
}
else
{
SendClientMessage(playerid, COLOR_LIGHTNEUTRALBLUE, " You don't have car at slot 1");
return 1;
}
}
else if(strcmp(x_nr,"lock2",true) == 0)
{
new keycar = PlayerInfo[playerid][pPcarkey2];
if(keycar != 9999)
{
new locked[128];
locked = strtok(cmdtext, idx);
if(CarInfo[keycar][cLock] == 1)
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
if (IsPlayerConnected(i))
{
SetVehicleParamsForPlayer(keycar,i,0,0);
}
}
format(string, sizeof(string), "~w~Vehicle~n~~g~Unlocked");
GameTextForPlayer(playerid, string, 4000, 3);
CarInfo[keycar][cLock] = 0;
OnPropUpdate(4,keycar);
return 1;
}
else if(CarInfo[keycar][cLock] == 0)
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
if (IsPlayerConnected(i))
{
SetVehicleParamsForPlayer(keycar,i,0,1);
}
}
format(string, sizeof(string), "~w~Vehicle~n~~r~Locked");
GameTextForPlayer(playerid, string, 4000, 3);
CarInfo[keycar][cLock] = 1;
OnPropUpdate(4,keycar);
return 1;
}
}
else
{
SendClientMessage(playerid, COLOR_LIGHTNEUTRALBLUE, " You dont have car at slot 2");
return 1;
}
}
else if(strcmp(x_nr,"lock3",true) == 0)
{
new keycar = PlayerInfo[playerid][pPcarkey3];
if(keycar != 9999)
{
new locked[128];
locked = strtok(cmdtext, idx);
if(CarInfo[keycar][cLock] == 1)
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
if (IsPlayerConnected(i))
{
SetVehicleParamsForPlayer(keycar,i,0,0);
}
}
format(string, sizeof(string), "~w~Vehicle~n~~g~Unlocked");
GameTextForPlayer(playerid, string, 4000, 3);
CarInfo[keycar][cLock] = 0;
OnPropUpdate(4,keycar);
return 1;
}
else if(CarInfo[keycar][cLock] == 0)
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
if (IsPlayerConnected(i))
{
SetVehicleParamsForPlayer(keycar,i,0,1);
}
}
format(string, sizeof(string), "~w~Vehicle~n~~r~Locked");
GameTextForPlayer(playerid, string, 4000, 3);
CarInfo[keycar][cLock] = 1;
OnPropUpdate(4,keycar);
return 1;
}
}
else
{
SendClientMessage(playerid, COLOR_LIGHTNEUTRALBLUE, " You dont have car at slot 3");
return 1;
}
}
else if(strcmp(x_nr,"color",true) == 0)
{
if(PlayerInfo[playerid][pPcarkey] == 9999 && PlayerInfo[playerid][pPcarkey2] == 9999 && PlayerInfo[playerid][pPcarkey3] == 9999)
{
SendClientMessage(playerid, COLOR_GREY,"* You don't have a vehicle to respray.");
return 1;
}
if(!IsAtDealership(playerid))
{
SendClientMessage(playerid, COLOR_GREY,"* You must be at a Dealership to do this!");
return 1;
}
if(GetPlayerMoney(playerid) < 1000)
{
SendClientMessage(playerid, COLOR_GREY,"* You don't have enough money for vehicle respray.");
return 1;
}
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_WHITE, "USAGE: /v color [ColorOneID] [ColorTwoID]");
return 1;
}
new color1;
color1 = strval(tmp);
if(color1 < 0 && color1 > 126)
{
SendClientMessage(playerid, COLOR_GREY, " Wrong color id!");
return 1;
}
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_WHITE, "USAGE: /v color [ColorOneID] [ColorTwoID]");
return 1;
}
new color2;
color2 = strval(tmp);
if(color2 < 0 && color2 > 126)
{
SendClientMessage(playerid, COLOR_GREY, " Wrong color id!");
return 1;
}
new vehid;
if(GetPlayerVehicleID(playerid) == PlayerInfo[playerid][pPcarkey]) { vehid = PlayerInfo[playerid][pPcarkey]; }
else if(GetPlayerVehicleID(playerid) == PlayerInfo[playerid][pPcarkey2]) { vehid = PlayerInfo[playerid][pPcarkey2]; }
else if(GetPlayerVehicleID(playerid) == PlayerInfo[playerid][pPcarkey3]) { vehid = PlayerInfo[playerid][pPcarkey3]; }
else { return 1; }
if(IsPlayerInVehicle(playerid, vehid))
{
CarInfo[vehid][cColorOne] = color1;
CarInfo[vehid][cColorTwo] = color2;
new Float:x,Float:y,Float:z;
GetPlayerPos(playerid, x,y,z);
ChangeVehicleColor(vehid, color1, color2);
SafeGivePlayerMoney(playerid, -1000);
GameTextForPlayer(playerid, "~w~Bill for a Paint Respray~n~~r~-$1000", 5000, 1);
ChangeVehicleColor(vehid, color1, color2);
OnPropUpdate(4,vehid);
OnPlayerUpdateEx(playerid);
return 1;
}
else
{
SendClientMessage(playerid, COLOR_GREY," You are not in your vehicle.");
return 1;
}
}
else if(strcmp(x_nr,"buy",true) == 0)
{
new car = 396;
new model = GetVehicleModel(idcar);
if(IsASalesVehicle(idcar))
{
if(PlayerInfo[playerid][pLevel] < 3)
{
SendClientMessage(playerid, COLOR_GREY, "You need to be level 3 to buy a vehicle!");
return 1;
}
if(PlayerInfo[playerid][pPcarkey] == 9999 || PlayerInfo[playerid][pPcarkey2] == 9999 || PlayerInfo[playerid][pPcarkey3] == 9999) { }
else return SendClientMessage(playerid, COLOR_GREY,"* You already own three cars!");
if(GetPlayerMoney(playerid) >= GetVehiclePrice(idcar))
{
if(PlayerInfo[playerid][pCarLic] == 1)
{
for(new h = 396; h < sizeof(CarInfo); h++)
{
if(CarInfo[h][cOwned] == 0)
{
car = h;
h = 9999;
}
}
format(string, sizeof(string),"LARP/Vehicles/%d.ini",car)
dini_Create(string);
if(PlayerInfo[playerid][pPcarkey] == 9999) { PlayerInfo[playerid][pPcarkey] = car; }
else if(PlayerInfo[playerid][pPcarkey2] == 9999) { PlayerInfo[playerid][pPcarkey2] = car; }
else if(PlayerInfo[playerid][pPcarkey3] == 9999) { PlayerInfo[playerid][pPcarkey3] = car; }
else { return 1; }
CarInfo[car][cOwned] = 1;
strmid(CarInfo[car][cOwner], sendername, 0, strlen(sendername), 999);
SafeGivePlayerMoney(playerid,-GetVehiclePrice(idcar));
if(IsModelAPlane(idcar) || IsModelAHeli(idcar))
{
CarInfo[car][cLocationx] = 1432.6451;
CarInfo[car][cLocationy] = 1378.7216;
CarInfo[car][cLocationz] = 11.5507;
CarInfo[car][cAngle] = 359.2072;
SendClientMessage(playerid, COLOR_YELLOW2, "Your Aircraft has been deliveried to Las Venturas Airport, you can get it there!");
SendClientMessage(playerid, COLOR_YELLOW2, "Your vehicle is unlocked so you can pay someone to deliver it to your new spawn point!");
SendClientMessage(playerid, COLOR_NICERED, "REMEMBER: Leaving your car in the deliver point can get your car SOLD by an administration without refund!");
GameTextForPlayer(playerid, "~p~Congratulations~n~~w~Don't forget to pickup your car at the ~b~Las Venturas Airport!", 5000, 3);
}
else if(IsModelABoat(idcar))
{
CarInfo[car][cLocationx] = -1568.9614;
CarInfo[car][cLocationy] = 169.0118;
CarInfo[car][cLocationz] = -0.6016;
CarInfo[car][cAngle] = 208.7506;
SendClientMessage(playerid, COLOR_YELLOW2, "Your Boat has been deliveried to San Fierro Docks, you can get it there!");
SendClientMessage(playerid, COLOR_YELLOW2, "Your vehicle is unlocked so you can pay someone to deliver it to your new spawn point!");
SendClientMessage(playerid, COLOR_NICERED, "REMEMBER: Leaving your car in the deliver point can get your car SOLD by an administration without refund!");
GameTextForPlayer(playerid, "~p~Congratulations~n~~w~Don't forget to pickup your car at the ~b~San Fierro Docks!", 5000, 3);
}
else
{
CarInfo[car][cLocationx] = -1589.2644;
CarInfo[car][cLocationy] = 106.9119;
CarInfo[car][cLocationz] = 3.5495;
CarInfo[car][cAngle] = 317.1649;
SendClientMessage(playerid, COLOR_YELLOW2, "Your vehicle has been deliveried to San Fierro Docks, you can get it there!");
SendClientMessage(playerid, COLOR_YELLOW2, "Your vehicle is unlocked so you can pay someone to deliver it to your new spawn point!");
SendClientMessage(playerid, COLOR_NICERED, "REMEMBER: Leaving your car in the deliver point can get your car SOLD by an administration without refund!");
GameTextForPlayer(playerid, "~p~Congratulations~n~~w~Don't forget to pickup your car at the ~b~San Fierro Docks!", 5000, 3);
}
CarInfo[car][cModel] = model;
CarInfo[car][cVirWorld] = 0;
CarInfo[car][cPaintjob] = 999;
CarInfo[car][cColorOne] = 1;
CarInfo[car][cColorTwo] = 1;
CarInfo[car][cComponent0] = 0;
CarInfo[car][cComponent1] = 0;
CarInfo[car][cComponent2] = 0;
CarInfo[car][cComponent3] = 0;
CarInfo[car][cComponent4] = 0;
CarInfo[car][cComponent5] = 0;
CarInfo[car][cComponent6] = 0;
CarInfo[car][cComponent7] = 0;
CarInfo[car][cComponent8] = 0;
CarInfo[car][cComponent9] = 0;
CarInfo[car][cComponent10] = 0;
CarInfo[car][cComponent11] = 0;
CarInfo[car][cComponent12] = 0;
CarInfo[car][cComponent13] = 0;
//DestroyVehicle(car);
ownedcar[car] = AddStaticVehicleEx(CarInfo[car][cModel],CarInfo[car][cLocationx],CarInfo[car][cLocationy],CarInfo[car][cLocationz],90.0,1,1,-1);
PlayerPlayMusic(playerid);
SendClientMessage(playerid, COLOR_GRAD2, "Congratulations on your new purchase!");
SendClientMessage(playerid, COLOR_GRAD2, "Type /vehiclehelp to view the vehicle manual!");
gEngine[playerid] = 0;
engineOn[GetPlayerVehicleID(playerid)] = false;
SendClientMessage(playerid, COLOR_GREY, "Remember to set the new Security Code of the Car (/v setcode)!");
new pass[24];
format(pass, sizeof(pass),"%d%d%d",random(9),random(9),random(9));
CarInfo[car][cCode] = strval(pass);
OnPropUpdate(4,car);
OnPlayerUpdateEx(playerid);
}
else
{
SendClientMessage(playerid, COLOR_WHITE, "* For security reasons, a Driving License is needed to buy a car!");
return 1;
}
}
else
{
SendClientMessage(playerid, COLOR_GREY, " You don't have enough cash with you ! ");
return 1;
}
}
}
else if(strcmp(x_nr,"paintjob",true) == 0)
{
if(PlayerInfo[playerid][pPcarkey] == 9999 && PlayerInfo[playerid][pPcarkey2] == 9999 && PlayerInfo[playerid][pPcarkey3] == 9999)
{
SendClientMessage(playerid, COLOR_GREY," You don't have a vehicle to respray.");
return 1;
}
if(!IsAtDealership(playerid))
{
SendClientMessage(playerid, COLOR_GREY,"* You must be at a Dealership to do this!");
return 1;
}
if(GetPlayerMoney(playerid) < 5000)
{
SendClientMessage(playerid, COLOR_GREY," You don't have enough money for vehicle respray.");
return 1;
}
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_WHITE, "USAGE: /v paintjob [paintjob(0-3)]");
return 1;
}
new color1;
color1 = strval(tmp);
if(color1 < 0 && color1 > 3)
{
SendClientMessage(playerid, COLOR_GREY, " Wrong color id!");
return 1;
}
new vehid;
if(GetPlayerVehicleID(playerid) == PlayerInfo[playerid][pPcarkey]) { vehid = PlayerInfo[playerid][pPcarkey]; }
else if(GetPlayerVehicleID(playerid) == PlayerInfo[playerid][pPcarkey2]) { vehid = PlayerInfo[playerid][pPcarkey2]; }
else if(GetPlayerVehicleID(playerid) == PlayerInfo[playerid][pPcarkey3]) { vehid = PlayerInfo[playerid][pPcarkey3]; }
else { return 1; }
if(IsPlayerInVehicle(playerid, vehid))
{
CarInfo[vehid][cPaintjob] = color1;
SafeGivePlayerMoney(playerid, -5000);
GameTextForPlayer(playerid, "~w~Bill for a Paint Respray~n~~r~-$5000", 5000, 1);
ChangeVehiclePaintjob(vehid, color1);
OnPropUpdate(4,vehid);
OnPlayerUpdateEx(playerid);
return 1;
}
else
{
SendClientMessage(playerid, COLOR_GREY," You are not in your vehicle.");
return 1;
}
}
else
{
SendClientMessage(playerid, COLOR_WHITE, "HINT: (/v)ehicle [name]");
SendClientMessage(playerid, COLOR_WHITE, "Available names: park, lock(1-2), sell, sellto, color, paintjob");
return 1;
}
}
return 1;
}