Hmm, that's the new command, however the /car sell , /car respray and /car find are bugged.
They don't seem to work and return the syntax. I assume it's because I'm trying to convert the string (tmp2,tmp3) to an int ? I couldn't find a way to fix it without fucking up the rest of the system so I'd love it if someone who could lead me to the solution <:
PHP код:
COMMAND:car(playerid, params[])
{
if(!strlen(params)) return SCP(playerid, "[ buy / sell / unsell / park / lock / help / tow / find / respray / savemod / unmod / dupekey / takekey / factionize / scrap / paintjob / nitro / plate / control ]");
new tmp2[MAX_STRING], tmp3[MAX_STRING];
if(!sscanf(params, "respray", tmp2, tmp3))
{
if(!IsPlayerInAnyVehicle(playerid))
return SendClientError(playerid, "You are not in any vehicle!");
if(strcmp(PlayerName(playerid),Vehicles[GetPlayerVehicleID(playerid)][carowner],false))
return SendClientError(playerid, "You do not own this vehicle!");
if(PlayerTemp[playerid][sm] < dini_Int("Pay_N_Spray.txt", "entrance"))
return SendClientError(playerid, "Not enough money!");
new bizz = IsPlayerOutBiz(playerid);
if(bizz != -1 && biz[bizz][biztype] == 11)
{
if(!strlen(tmp2) || !IsNumeric(tmp2) || !strlen(tmp3) || !IsNumeric(tmp3)) return SCP(playerid, "respray [ colour1 ] [ colour2 ]");
if(strlen(tmp2) > 5 || strlen(tmp3) > 5) return SendClientWarning(playerid, "Invalid colour ID!");
new c1 = strval(tmp2);
new c2 = strval(tmp3);
if(c1 < 0 || c2 < 0) return SendClientWarning(playerid, "Invalid colour ID!");
dini_IntSet(CarFile(GetPlayerVehicleID(playerid)), "color1", c1);
dini_IntSet(CarFile(GetPlayerVehicleID(playerid)), "color2", c2);
ChangeVehicleColor(GetPlayerVehicleID(playerid), c1, c2);
Vehicles[GetPlayerVehicleID(playerid)][color1] = c1;
Vehicles[GetPlayerVehicleID(playerid)][color2] = c2;
GameTextForPlayer(playerid, "~g~resprayed", 3000,1);
GivePlayerMoneyEx(playerid, -dini_Int("Pay_N_Spray.txt", "entrance"));
dini_IntSet("Pay_N_Spray.txt", "bizcash", dini_Int("Pay_N_Spray.txt", "bizcash") + dini_Int("Pay_N_Spray.txt", "entrance"));
dini_IntSet("Pay_N_Spray.txt", "comps", dini_Int("Pay_N_Spray.txt", "comps") - 2);
//GivePlayerMoneyEx(playerid, -dini_Int("Pay_N_Spray.txt", "entrance"));
//dini_IntSet("Pay_N_Spray.txt", "bizcash", dini_Int("Pay_N_Spray.txt", "bizcash") + dini_Int("Pay_N_Spray.txt", "entrance"));
//dini_IntSet("Pay_N_Spray.txt", "comps", dini_Int("Pay_N_Spray.txt", "comps") - 2);
format(iStr, sizeof(iStr), "6[VEHICLE] %s has resprayed their %s to %d and %d for $%d.", PlayerName(playerid), GetVehicleName(GetPlayerVehicleID(playerid)), c1, c2, dini_Int("Pay_N_Spray.txt", "entrance"));
iEcho(iStr);
return 1;
}
}
else if(!strcmp(params,"neon",true, 4))
{
if(!IsPlayerInAnyVehicle(playerid))
return SendClientError(playerid, "You are not in any vehicle!");
if(PlayerTemp[playerid][sm] < dini_Int("Car_Neon.txt", "entrance"))
return SendClientError(playerid, "Not enough money!");
new bizz = IsPlayerOutBiz(playerid);
if(bizz != -1 && biz[bizz][biztype] == 25)
{
GivePlayerMoneyEx(playerid, -dini_Int("Car_Neon.txt", "entrance"));
dini_IntSet("Car_Neon.txt", "bizcash", dini_Int("Car_Neon.txt", "bizcash") + dini_Int("Car_Neon.txt", "entrance"));
dini_IntSet("Car_Neon.txt", "cmps", dini_Int("Car_Neon.txt", "comps") - 2);
format(iStr, sizeof(iStr), "6[VEHICLE] %s has instaled neon on their %s for $%d.", PlayerName(playerid), GetVehicleName(GetPlayerVehicleID(playerid)), dini_Int("Car_Neon.txt", "entrance"));
iEcho(iStr);
ShowPlayerDialog(playerid, 52, DIALOG_STYLE_LIST, "{FFFF00} Car Neon", "DarkBlue\nRed\nGreen\nWhite\nViolet\nYellow\nCyan\nLightBlue\nPink\nOrange\nLightGreen\nLightYellow\nDelete Neon", "Select", "Cancel");
return 1;
}
}
else if(!strcmp(params,"control",true, 7))
{
if(!IsPlayerInAnyVehicle(playerid))
return SendClientError(playerid, "You are not in any vehicle!");
ShowPlayerDialog(playerid, 50, DIALOG_STYLE_LIST, "{FFFF00} Car Control", "Lighting [ On / Off ]\nBonnect [ Open / Close ]\nBoot/Trunk [ Open / Close ]", "Select", "Cancel");
return 1;
}
else if(!strcmp(params, "plate", true, 5))
{
if(PlayerInfo[playerid][premium]) return SendClientError(playerid, CANT_USE_CMD);
if(!IsPlayerInAnyVehicle(playerid)) return 1;
ShowPlayerDialog(playerid, 45, DIALOG_STYLE_INPUT,"{FFFF00} Plate Registration", "{ea150a}What should the {17a005}plate {ffffff}be?", "{ffffff}Set", " ");
return 1;
}
else if(!strcmp(params,"nitro", true, 5))
{
new bizz = IsPlayerOutBiz(playerid);
if(bizz != -1 && biz[bizz][biztype] == 23)
{
if(!IsValidNOSVehicle(GetPlayerVehicleID(playerid))) return SendClientError(playerid, "This vehicle cannot have nitro!");
if(!IsPlayerInAnyVehicle(playerid)) return SendClientError(playerid, "You are not in any vehicle!");
if(HandMoney(playerid) < 250000) return SendClientError(playerid, "You don't have $250.000 to buy infinite nitro!");
dini_IntSet(CarFile(GetPlayerVehicleID(playerid)), "nitro", 1);
Vehicles[GetPlayerVehicleID(playerid)][nitro] = 1;
GameTextForPlayer(playerid, "~g~installed", 3000,1);
GivePlayerMoneyEx(playerid, -250000);
dini_IntSet("Nitro_Garage.txt", "bizcash", dini_Int("Nitro_Garage.txt", "bizcash") + 75000);
dini_IntSet("Nitro_Garage.txt", "comps", dini_Int("Nitro_Garage.txt", "comps") - 5);
format(iStr, sizeof(iStr), "6[VEHICLE] %s has bought infinite nitro for their %s.", PlayerName(playerid), GetVehicleName(GetPlayerVehicleID(playerid)));
iEcho(iStr);
return 1;
}
else
{
SendClientError(playerid, "You are not at the Nitro Garage!");
//SetPlayerCheckpoint(playerid,-1922.470336,285.820037,41.046875, 3.0);
return 1;
}
}
else if(!strcmp(params,"wheels", true, 6))
{
new bizz = IsPlayerOutBiz(playerid);
if(bizz != -1 && biz[bizz][biztype] == 24)
{
if(!IsValidNOSVehicle(GetPlayerVehicleID(playerid))) return SendClientError(playerid, "This vehicle cannot have modified wheels!");
if(!IsPlayerInAnyVehicle(playerid)) return SendClientError(playerid, "You are not in any vehicle!");
if(PlayerTemp[playerid][sm] < dini_Int("Wheel_Mod_Shop.txt", "entrance")) return SendClientError(playerid, "Not enough money!");
dini_IntSet("Wheel_Mod_Shop.txt", "bizcash", dini_Int("Wheel_Mod_Shop.txt", "bizcash") + dini_Int("Wheel_Mod_Shop.txt", "entrance"));
dini_IntSet("Wheel_Mod_Shop.txt", "comps", dini_Int("Wheel_Mod_Shop.txt", "comps") - 1);
format(iStr, sizeof(iStr), "6[VEHICLE] %s is chosing wheels for their %s.", PlayerName(playerid), GetVehicleName(GetPlayerVehicleID(playerid)));
iEcho(iStr);
new iStrr[ 512 ], tmpzz[ 24 ];
for(new i; i < sizeof(CarWheels); i++)
{
format(tmpzz, 24, "%s\n", CarWheels[i][whName]);
strcat(iStrr, tmpzz);
}
ShowPlayerDialog(playerid, 42, DIALOG_STYLE_LIST, "Wheel Mods", iStrr, "Preview", "Cancel");
return 1;
}
else
{
SendClientError(playerid, "You are not at the Wheel Mod Shop!");
//SetPlayerCheckpoint(playerid,-2730.668457,74.234832,4.335937, 3.0);
return 1;
}
}
else if(!sscanf(params, "paintjob", tmp2))
{
if(!IsPlayerInAnyVehicle(playerid))
return SendClientError(playerid, "You are not in any vehicle!");
if(strcmp(PlayerName(playerid),Vehicles[GetPlayerVehicleID(playerid)][carowner],false))
return SendClientError(playerid, "You do not own this vehicle!");
if(PlayerTemp[playerid][sm] < dini_Int("Pay_N_Spray.txt", "entrance"))
return SendClientError(playerid, "Not enough money!");
new bizz = IsPlayerOutBiz(playerid);
if(bizz != -1 && biz[bizz][biztype] == 11)
{
new mid = GetVehicleModel(GetPlayerVehicleID(playerid));
if(mid != 483 && mid != 534 && mid != 535 && mid != 567 && mid != 536 && mid != 558 && mid != 559 && mid != 560 && mid != 558 && mid != 562 && mid != 561 && mid != 565 && mid != 576)
return SendClientError(playerid, "You can't change the paintjob on this model!");
if(!strlen(tmp2) || !IsNumeric(tmp2)) return SCP(playerid, "paintjob [ paintjobID ]");
if(strlen(tmp2) > 5) return SendClientWarning(playerid, "Invalid paintjob ID!");
new c1 = strval(tmp2);
if(c1 < -1 || c1 > 2) return SendClientWarning(playerid, "Invalid paintjob ID!");
dini_IntSet(CarFile(GetPlayerVehicleID(playerid)), "paintjob", c1);
Vehicles[GetPlayerVehicleID(playerid)][paintjob] = c1;
ChangeVehiclePaintjob(GetPlayerVehicleID(playerid), c1);
GivePlayerMoneyEx(playerid, -dini_Int("Pay_N_Spray.txt", "entrance"));
dini_IntSet("Pay_N_Spray.txt", "bizcash", dini_Int("Pay_N_Spray.txt", "bizcash") + dini_Int("Pay_N_Spray.txt", "entrance"));
dini_IntSet("Pay_N_Spray.txt", "comps", dini_Int("Pay_N_Spray.txt", "comps") - 2);
format(iStr, sizeof(iStr), "6[VEHICLE] %s has paintjobbed their %s to %d for $%d.", PlayerName(playerid), GetVehicleName(GetPlayerVehicleID(playerid)), c1, dini_Int("Pay_N_Spray.txt", "entrance"));
iEcho(iStr);
return 1;
}
else
{
SendClientError(playerid, "You are not at the Pay N Spray Shop!");
//SetPlayerCheckpoint(playerid,-2730.668457,74.234832,4.335937, 3.0);
return 1;
}
}
else if(!sscanf(params, "dupekey", tmp2))
{
if(!IsPlayerInAnyVehicle(playerid))
return SendClientError(playerid, "You are not in any vehicle!");
if(strcmp(PlayerName(playerid),Vehicles[GetPlayerVehicleID(playerid)][carowner],false))
return SendClientError(playerid, "You do not own this vehicle!");
if(!strlen(tmp2) || !IsNumeric(tmp2) || strlen(tmp2) > 5) return SCP(playerid, "dupekey [ PLAYERID ]");
new giveplayerid = strval(tmp2);
if(!IsPlayerConnected(giveplayerid)) return SendClientError(playerid, "Player not found!");
if(GetDistanceBetweenPlayers(playerid, giveplayerid) > 10)
return SendClientError(playerid, "He is too far away!");
dini_Set(CarFile(GetPlayerVehicleID(playerid)), "dupekey", PlayerName(giveplayerid));
myStrcpy(Vehicles[GetPlayerVehicleID(playerid)][dupekey], PlayerName(giveplayerid));
format(iStr, sizeof(iStr),"has given the keys of their %s to %s.", GetVehicleName(GetPlayerVehicleID(playerid)), MaskedName(giveplayerid));
Action(playerid, iStr);
format(iStr, sizeof(iStr), "6[VEHICLE] %s has given their %s dupe-key to %s.", PlayerName(playerid), GetVehicleName(GetPlayerVehicleID(playerid)), PlayerName(giveplayerid));
iEcho(iStr);
}
else if(!strcmp(params, "takekey", true, 7))
{
if(!IsPlayerInAnyVehicle(playerid))
return SendClientError(playerid, "You are not in any vehicle!");
if(strcmp(PlayerName(playerid),Vehicles[GetPlayerVehicleID(playerid)][carowner],false))
return SendClientError(playerid, "You do not own this vehicle!");
dini_Set(CarFile(GetPlayerVehicleID(playerid)), "dupekey", "NoBodY");
myStrcpy(Vehicles[GetPlayerVehicleID(playerid)][dupekey], "NoBodY");
SendClientMessage(playerid, COLOR_LIGHTGREY,"Info: The key has been taken away!");
}
else if(!strcmp(params, "factionize", true, 10))
{
if(!IsPlayerInAnyVehicle(playerid))
return SendClientError(playerid, "You are not in any vehicle!");
if(strcmp(PlayerName(playerid),Vehicles[GetPlayerVehicleID(playerid)][carowner],false))
return SendClientError(playerid, "You do not own this vehicle!");
if(PlayerInfo[playerid][playerteam] == CIV)
return SendClientError(playerid, "You are not in a faction!");
if(FactionCarCount(PlayerInfo[playerid][playerteam]) >= FactionCarMax(playerid))
return SendClientError(playerid, "Your faction has reached the limit of factioncars!");
dini_Set(CarFile(GetPlayerVehicleID(playerid)), "dupekey", "NoBodY");
myStrcpy(Vehicles[GetPlayerVehicleID(playerid)][dupekey], "NoBodY");
dini_IntSet(CarFile(GetPlayerVehicleID(playerid)), "carteam", PlayerInfo[playerid][playerteam]);
dini_Set(CarFile(GetPlayerVehicleID(playerid)), "owner", "NoBodY");
SendClientInfo(playerid, "Success: The vehicle is now bound to the faction.");
Vehicles[GetPlayerVehicleID(playerid)][carteam] = PlayerInfo[playerid][playerteam];
myStrcpy(Vehicles[GetPlayerVehicleID(playerid)][carowner], "NoBodY");
UnlockVehicle(GetPlayerVehicleID(playerid));
SendClientInfo(playerid, "Your vehicle has been factionized! You will not ever receive a refund for it.");
format(iStr, sizeof(iStr), "6[VEHICLE] %s has factionized their %s to %s.", PlayerName(playerid), GetVehicleName(GetPlayerVehicleID(playerid)), PlayerInfo[playerid][PTeamName]);
iEcho(iStr);
format(iStr, sizeof(iStr), "## [%s] %s %s has just factionized a %s", PlayerInfo[playerid][PTeamName], PlayerInfo[playerid][rankname], RPName(playerid), GetVehicleName(GetPlayerVehicleID(playerid)));
SendClientMessageToTeam(PlayerInfo[playerid][playerteam], iStr, COLOR_PLAYER_VLIGHTBLUE);
}
else if(!sscanf(params, "sell", tmp2))
{
if(!IsPlayerInAnyVehicle(playerid))
return SendClientError(playerid, "You are not in any vehicle!");
if(strcmp(PlayerName(playerid),Vehicles[GetPlayerVehicleID(playerid)][carowner],false))
return SendClientError(playerid, "You do not own this vehicle!");
if(!strlen(tmp2) || !IsNumeric(tmp2) || strlen(tmp2) > 9) return SCP(playerid, "sell [amount]");
new themodel = strval(tmp2);
if(themodel < 0 || themodel > 50000000) return SendClientWarning(playerid, "Invalid amount!");
dini_IntSet(CarFile(GetPlayerVehicleID(playerid)), "price", themodel);
format(iStr, sizeof(iStr), "~r~sale: ~w~$%d", themodel);
GameTextForPlayer(playerid, iStr, 3000,1);
Vehicles[GetPlayerVehicleID(playerid)][carprice] = themodel;
SendClientMessage(playerid, COLOR_LIGHTGREY,"Info: Your vehicle is now on sale. Other people are able to buy it!");
TogglePlayerControllable(playerid, true);
format(iStr, sizeof(iStr), "6[VEHICLE] %s has put their %s on sale for $%d.", PlayerName(playerid), GetVehicleName(GetPlayerVehicleID(playerid)), themodel);
iEcho(iStr);
}
else if(!strcmp(params, "tow", true, 3))
{
if(!strlen(tmp2) || !IsNumeric(tmp2) || strlen(tmp2) > 5) return SCP(playerid, "tow [vehicleID (/myvehicles)]");
new themodel = strval(tmp2);
if(themodel < 0 || themodel > sizeof(Vehicles)) return SendClientError(playerid, "Invalid vehicle ID!");
if(strcmp(PlayerName(playerid),Vehicles[themodel][carowner],false))
return SendClientError(playerid, "You do not own this vehicle!");
if(IsVehicleOccupied(themodel))
return SendClientError(playerid, "The vehicle is currently occupied!");
new iPrice;
if(PlayerInfo[playerid][playerlvl] < 15) iPrice = 0;
else iPrice = 150;
if(HandMoney(playerid) < iPrice) return SendClientError(playerid, "You don't have enough money!");
ReloadVehicle(themodel);
SendClientMessage(playerid, COLOR_LIGHTGREY,"Info: Your vehicle has been towed!");
if(iPrice) GameTextForPlayer(playerid, "~r~$-150", 3000,1);
GivePlayerMoneyEx(playerid, -iPrice);
dini_IntSet("Gov_Land_Company.txt", "bizcash", dini_Int("Gov_Land_Company.txt", "bizcash") + 150);
format(iStr, sizeof(iStr), "6[VEHICLE] %s has towed their %s.", PlayerName(playerid), GetVehicleName(themodel));
iEcho(iStr);
}/*
else if(!strcmp(tmp, "call", true, 4))
{
if(!strlen(tmp2) || !IsNumeric(tmp2) || strlen(tmp2) > 5) return SCP(playerid, "call [vehicleID (/myvehicles)]");
new themodel = strval(tmp2);
if(themodel < 0 || themodel > sizeof(Vehicles)) return SendClientError(playerid, "Invalid vehicle ID!");
if(strcmp(PlayerName(playerid),Vehicles[themodel][carowner],false))
return SendClientError(playerid, "You do not own this vehicle!");
if(IsVehicleOccupied(themodel))
return SendClientError(playerid, "The vehicle is currently occupied!");
if(GetPlayerInterior(playerid) || GetPlayerVirtualWorld(playerid))
return SendClientError(playerid, "You cannot call your vehicle while in an interior.");
SendClientMessage(playerid, COLOR_LIGHTGREY,"Info: Your vehicle should arrive in 10 to 20 seconds.");
GameTextForPlayer(playerid, "~r~$-100", 3000,1);
GivePlayerMoneyEx(playerid, -100);
new loltime = minrand(10,20);
SetTimerEx("VehicleToPlayer", loltime*1000, false, "ddd", playerid, themodel, 0);
dini_IntSet("Gov_Land_Company.txt", "bizcash", dini_Int("Gov_Land_Company.txt", "bizcash") + 100);
format(iStr, sizeof(iStr), "6[VEHICLE] %s has called their vehicle #%d", PlayerName(playerid), themodel);
iEcho(iStr);
format(iStr, sizeof(iStr), "(( Local: %s[%d] has called their %s to himself. (%d sec) ))", RPName(playerid), playerid, GetVehicleName(themodel), loltime);
NearMessage(playerid,iStr,COLOR_LIGHTGREY);
}*/
else if(!sscanf(params, "find", tmp2))
{
if(!strlen(tmp2) || !IsNumeric(tmp2) || strlen(tmp2) > 5) return SCP(playerid, "find [vehicleID (/myvehicles)]");
new themodel = strval(tmp2);
if(themodel < 0 || themodel > sizeof(Vehicles)) return SendClientError(playerid, "Invalid vehicle ID!");
if(strcmp(PlayerName(playerid),Vehicles[themodel][carowner],false))
return SendClientError(playerid, "You do not own this vehicle!");
if(IsVehicleOccupied(themodel))
return SendClientError(playerid, "The vehicle is currently occupied!");
if(GetVehicleVirtualWorld(themodel) != 0)
return SendClientError(playerid, "The vehicle is in an interior.");
new Float:carpos[3], zone[ 40 ];
GetVehiclePos(themodel, carpos[0], carpos[1], carpos[2]);
GetZone(carpos[0], carpos[1], carpos[2], zone);
SetPlayerCheckpoint(playerid, carpos[0], carpos[1], carpos[2], 5.0);
format(iStr, sizeof(iStr), " Your vehicle is located at %s. Check your radar.", zone);
SendClientMessage(playerid, COLOR_LIGHTGREY, iStr);
format(iStr, sizeof(iStr), "6[VEHICLE] %s has used /car find for his %s.", PlayerName(playerid), GetVehicleName(themodel));
iEcho(iStr);
}
else if(!strcmp(params, "buy", true, 4))
{
if(GetPlayerCars(playerid) >= 4 && PlayerInfo[playerid][premium] == 0) return SendClientError(playerid, "Sorry, you have no slots left! You may donate to get more slots!");
// if(GetPlayerCars(playerid) >= 6 && PlayerInfo[playerid][premium] != 0) return SendClientError(playerid, "Sorry, you have no slots left!");
if(!IsPlayerInAnyVehicle(playerid)) return SendClientError(playerid, "You are not in any vehicle!");
if(GetPlayerState(playerid) != PLAYER_STATE_DRIVER) return SendClientError(playerid, "You must be the driver!");
if(!strcmp(PlayerName(playerid),Vehicles[GetPlayerVehicleID(playerid)][carowner],false)) return SendClientError(playerid, "You cannot buy your own vehicle!");
if(Vehicles[GetPlayerVehicleID(playerid)][carprice] == 0) return SendClientError(playerid, "You cannot buy this vehicle!");
if(PlayerTemp[playerid][sm] < Vehicles[GetPlayerVehicleID(playerid)][carprice]) return SendClientError(playerid, "You don't have enough cash!");
if(PlayerID(Vehicles[GetPlayerVehicleID(playerid)][carowner]) == INVALID_PLAYER_ID && strcmp(Vehicles[GetPlayerVehicleID(playerid)][carowner],"NoBodY")) return SendClientError(playerid, "You cannot buy the vehicle untill he's online.");
format(iStr, sizeof(iStr), "~r~-$%d", Vehicles[GetPlayerVehicleID(playerid)][carprice]);
GameTextForPlayer(playerid, iStr, 3000,1);
SetBank(PlayerName(playerid),Vehicles[GetPlayerVehicleID(playerid)][carowner],Vehicles[GetPlayerVehicleID(playerid)][carprice]); // procedure
format(iStr, sizeof(iStr), "6[VEHICLE] %s has bought a %s of %s for $%d.", PlayerName(playerid), GetVehicleName(GetPlayerVehicleID(playerid)),Vehicles[GetPlayerVehicleID(playerid)][carowner],Vehicles[GetPlayerVehicleID(playerid)][carprice] );
iEcho(iStr);
AppendTo(moneylog, iStr);
dini_IntSet(CarFile(GetPlayerVehicleID(playerid)), "price", 0);
dini_Set(CarFile(GetPlayerVehicleID(playerid)), "owner", PlayerName(playerid));
myStrcpy(Vehicles[GetPlayerVehicleID(playerid)][carowner], PlayerName(playerid));
format(iStr, sizeof(iStr), "Info: You have bought this vehicle for $%d! For help, please use /car help!",Vehicles[GetPlayerVehicleID(playerid)][carprice]);
SendClientMessage(playerid, COLOR_LIGHTGREY,iStr);
SendClientMessage(playerid, COLOR_LIGHTGREY," Note: Please take a screenshot of /myvehicles!");
Vehicles[GetPlayerVehicleID(playerid)][carprice] = 0;
TogglePlayerControllable(playerid, true);
}
else if(!strcmp(params, "unsell", true, 6))
{
if(!IsPlayerInAnyVehicle(playerid)) return SendClientError(playerid, "You are not in any vehicle!");
if(strcmp(PlayerName(playerid),Vehicles[GetPlayerVehicleID(playerid)][carowner],false)) return SendClientError(playerid, "You do not own this vehicle!");
dini_IntSet(CarFile(GetPlayerVehicleID(playerid)), "price", 0);
Vehicles[GetPlayerVehicleID(playerid)][carprice] = 0;
SendClientMessage(playerid, COLOR_LIGHTGREY, "Info: Your vehicle is nolonger on sale. It cannot be bought anymore.");
TogglePlayerControllable(playerid, true);
format(iStr, sizeof(iStr), "6[VEHICLE] %s has put their %s nolonger on sale.", PlayerName(playerid), GetVehicleName(GetPlayerVehicleID(playerid)));
iEcho(iStr);
}
else if(!strcmp(params, "lock", true, 4))
{
new vehicleid = GetPlayerNearestVehicle(playerid);
if(GetDistanceFromPlayerToVehicle(playerid, vehicleid) > 5.0)
return SendClientError(playerid, "There is no vehicle around you!");
if(strcmp(PlayerName(playerid),Vehicles[vehicleid][carowner],false) && strcmp(PlayerName(playerid),Vehicles[vehicleid][dupekey],false))
{
return SendClientError(playerid, "You do not own this vehicle and you don't have the dupe keys!");
}
if(Vehicles[vehicleid][tmplocked] == 1)
{
UnlockVehicle(vehicleid);
format(iStr, sizeof(iStr),"has unlocked the doors of their %s.",GetVehicleName(vehicleid));
Action(playerid, iStr);
return 1;
}
else if(Vehicles[vehicleid][tmplocked] == 0)
{
LockVehicle(-1, vehicleid); // nobody can open it
format(iStr, sizeof(iStr),"has locked the doors of their %s.",GetVehicleName(vehicleid));
Action(playerid, iStr);
return 1;
}
return 1;
}
else if(!strcmp(params, "scrap", true, 5))
{
if(!IsPlayerInAnyVehicle(playerid)) return SendClientError(playerid, "You are not in any vehicle!");
if(strcmp(PlayerName(playerid),Vehicles[GetPlayerVehicleID(playerid)][carowner],false)) return SendClientError(playerid, "You do not own this vehicle!");
new reward = GetVehiclePrice(GetVehicleModel(GetPlayerVehicleID(playerid))) / 110;
format(iStr, sizeof(iStr), "6[VEHICLE] %s has scrapped their %s and received $%s.", PlayerName(playerid), GetVehicleName(GetPlayerVehicleID(playerid)), number_format(reward));
iEcho(iStr);
AppendTo(moneylog,iStr);
GivePlayerMoneyEx(playerid, reward);
format(iStr, sizeof(iStr), "You have scrapped this %s and received $%s, you cannot get it back anymore!", GetVehicleName(GetPlayerVehicleID(playerid)), number_format(reward));
SendClientInfo(playerid, iStr);
new Float:randx = -2932.5 + random(200);
new Float:randy = -2934.5 + random(200);
new Float:randz = 61.3339 + random(200);
new Float:randa = 0 + random(280);
dini_FloatSet(CarFile(GetPlayerVehicleID(playerid)), "x", randx);
dini_FloatSet(CarFile(GetPlayerVehicleID(playerid)), "y", randy);
dini_FloatSet(CarFile(GetPlayerVehicleID(playerid)), "z", randz);
dini_FloatSet(CarFile(GetPlayerVehicleID(playerid)), "a", randa);
dini_IntSet(CarFile(GetPlayerVehicleID(playerid)), "resetted", 1);
dini_IntSet(CarFile(GetPlayerVehicleID(playerid)), "cartype", 0);
dini_IntSet(CarFile(GetPlayerVehicleID(playerid)), "carteam", 0);
dini_IntSet(CarFile(GetPlayerVehicleID(playerid)), "model", 560);
dini_Set(CarFile(GetPlayerVehicleID(playerid)), "owner", "NoBodY");
dini_IntSet(CarFile(GetPlayerVehicleID(playerid)), "vw", 0);
new i = GetPlayerVehicleID(playerid);
Vehicles[i][fx] = randx;
Vehicles[i][fy] = randy;
Vehicles[i][fz] = randz;
Vehicles[i][fa] = randa;
Vehicles[i][reset] = 1;
Vehicles[i][vw] = 0;
Vehicles[i][carmodel] = 560;
myStrcpy(Vehicles[i][carowner], "NoBodY");
UnModCar(i);
ReloadVehicle(GetPlayerVehicleID(playerid));
return 1;
}
else if(!strcmp(params, "park", true, 4))
{
if(!IsPlayerInAnyVehicle(playerid)) return SendClientError(playerid, "You are not in any vehicle!");
if(strcmp(PlayerName(playerid),Vehicles[GetPlayerVehicleID(playerid)][carowner],false)) return SendClientError(playerid, "You do not own this vehicle!");
new Float:a[4], vww = GetPlayerVirtualWorld(playerid);
GetVehiclePos(GetPlayerVehicleID(playerid), a[0], a[1], a[2]);
GetVehicleZAngle(GetPlayerVehicleID(playerid), a[3]);
dini_FloatSet(CarFile(GetPlayerVehicleID(playerid)), "x", a[0]);
dini_FloatSet(CarFile(GetPlayerVehicleID(playerid)), "y", a[1]);
dini_FloatSet(CarFile(GetPlayerVehicleID(playerid)), "z", a[2]);
dini_FloatSet(CarFile(GetPlayerVehicleID(playerid)), "a", a[3]);
dini_IntSet(CarFile(GetPlayerVehicleID(playerid)), "vw", vww);
new i = GetPlayerVehicleID(playerid);
Vehicles[i][fx] = a[0];
Vehicles[i][fy] = a[1];
Vehicles[i][fz] = a[2];
Vehicles[i][fa] = a[3];
Vehicles[i][vw] = vww;
ReloadVehicle(GetPlayerVehicleID(playerid));
Up(playerid);
SetTimerEx("PutPlayerInVehicleEx", 500, false, "dd", playerid, i);
SendClientMessage(playerid, COLOR_LIGHTGREY, "Info: You have parked your vehicle. From now, it will spawn here!");
GameTextForPlayer(playerid, "~r~$-150", 3000,1);
GivePlayerMoneyEx(playerid, -150);
dini_IntSet("Gov_Land_Company.txt", "bizcash", dini_Int("Gov_Land_Company.txt", "bizcash") + 150);
format(iStr, sizeof(iStr), "6[VEHICLE] %s has parked their %s.", PlayerName(playerid), GetVehicleName(GetPlayerVehicleID(playerid)));
iEcho(iStr);
}
else if(!strcmp(params, "help", true, 4))
{
SendClientMessage(playerid, COLOR_LIGHTGREY, "{228B22}[ {FFFFFF}/car buy{afafaf} - Ability to buy a vehicle, if it is on sale. {228B22}]");
SendClientMessage(playerid, COLOR_LIGHTGREY, "{228B22}[ {FFFFFF}/car sell [price]{afafaf} - Set your vehicle on sale. Other people may buy it. {228B22}]");
SendClientMessage(playerid, COLOR_LIGHTGREY, "{228B22}[ {FFFFFF}/car unsell{afafaf} - Stop your vehicle from being sold. {228B22}]");
SendClientMessage(playerid, COLOR_LIGHTGREY, "{228B22}[ {FFFFFF}/car lock{afafaf} - Toggle the lock of your vehicle from in/outside. {228B22}]");
SendClientMessage(playerid, COLOR_LIGHTGREY, "{228B22}[ {FFFFFF}/car find [ID]{afafaf} - Find your vehicle, if it isn't occupied. {228B22}]");
SendClientMessage(playerid, COLOR_LIGHTGREY, "{228B22}[ {FFFFFF}/car respray{afafaf} - Respray your vehicle at the PNS business.. {228B22}]");
SendClientMessage(playerid, COLOR_LIGHTGREY, "{228B22}[ {FFFFFF}/car tow [ID]{afafaf} - Tow your vehicle ($15000), if it isn't occupied. {228B22}]");
// SendClientMessage(playerid, COLOR_LIGHTGREY, "{228B22}[ {FFFFFF}/car call [ID]{afafaf} - Call your vehicle to you ($9000), if it isn't occupied. {228B22}]");
SendClientMessage(playerid, COLOR_LIGHTGREY, "{228B22}[ {FFFFFF}/car savemod{afafaf} - Save the tuning of your vehicle. {228B22}]");
SendClientMessage(playerid, COLOR_LIGHTGREY, "{228B22}[ {FFFFFF}/car unmod{afafaf} - Remove the tuning of your vehicle. {228B22}]");
SendClientMessage(playerid, COLOR_LIGHTGREY, "{228B22}[ {FFFFFF}/car factionize{afafaf} - Make your car belong to your faction. {228B22}]");
SendClientMessage(playerid, COLOR_LIGHTGREY, "{228B22}[ {FFFFFF}/car scrap{afafaf} - Delete your vehicle - no refund! {228B22}]");
}
else if(!strcmp(params, "savemod", true, 7))
{
if(!IsPlayerInAnyVehicle(playerid)) return SendClientError(playerid, "You are not in any vehicle!");
if(strcmp(PlayerName(playerid),Vehicles[GetPlayerVehicleID(playerid)][carowner],false)) return SendClientError(playerid, "You do not own this vehicle!");
SendClientMessage(playerid, COLOR_LIGHTGREY, "Info: Your modifications have been saved!");
new vehicleid = GetPlayerVehicleID(playerid);
Vehicles[ vehicleid ][ Components ] [ 0 ] = GetVehicleComponentInSlot(vehicleid, 0);
Vehicles[ vehicleid ][ Components ] [ 1 ] = GetVehicleComponentInSlot(vehicleid, 1);
Vehicles[ vehicleid ][ Components ] [ 2 ] = GetVehicleComponentInSlot(vehicleid, 2);
Vehicles[ vehicleid ][ Components ] [ 3 ] = GetVehicleComponentInSlot(vehicleid, 3);
Vehicles[ vehicleid ][ Components ] [ 4 ] = GetVehicleComponentInSlot(vehicleid, 4);
Vehicles[ vehicleid ][ Components ] [ 5 ] = GetVehicleComponentInSlot(vehicleid, 5);
Vehicles[ vehicleid ][ Components ] [ 6 ] = GetVehicleComponentInSlot(vehicleid, 6);
Vehicles[ vehicleid ][ Components ] [ 7 ] = GetVehicleComponentInSlot(vehicleid, 7);
Vehicles[ vehicleid ][ Components ] [ 8 ] = GetVehicleComponentInSlot(vehicleid, 8);
Vehicles[ vehicleid ][ Components ] [ 9 ] = GetVehicleComponentInSlot(vehicleid, 9);
Vehicles[ vehicleid ][ Components ] [ 10 ] = GetVehicleComponentInSlot(vehicleid, 10);
Vehicles[ vehicleid ][ Components ] [ 11 ] = GetVehicleComponentInSlot(vehicleid, 11);
Vehicles[ vehicleid ][ Components ] [ 12 ] = GetVehicleComponentInSlot(vehicleid, 12);
Vehicles[ vehicleid ][ Components ] [ 13 ] = GetVehicleComponentInSlot(vehicleid, 13);
new iString[ 50 ], tmp22[ 10 ];
for(new c = 0; c < CAR_COMPONENTS; c++)
{
format(tmp22,sizeof(tmp22),"%d,", Vehicles[GetPlayerVehicleID(playerid)][Components][c]);
strcat(iString,tmp22);
}
strdel(iString,strlen(iString)-1, strlen(iString));
dini_Set(CarFile(GetPlayerVehicleID(playerid)), "components", iString);
format(iStr, sizeof(iStr), "6[VEHICLE] %s has saved the tuning of their %s.", PlayerName(playerid), GetVehicleName(GetPlayerVehicleID(playerid)));
iEcho(iStr);
}
else if(!strcmp(params, "unmod", true, 5))
{
if(!IsPlayerInAnyVehicle(playerid)) return SendClientError(playerid, "You are not in any vehicle!");
if(strcmp(PlayerName(playerid),Vehicles[GetPlayerVehicleID(playerid)][carowner],false)) return SendClientError(playerid, "You do not own this vehicle!");
SendClientMessage(playerid, COLOR_LIGHTGREY, "Info: Your modifications have been removed! (Paintjob upon respawn)");
UnModCar(GetPlayerVehicleID(playerid));
format(iStr, sizeof(iStr), "6[VEHICLE] %s has removed the tuning of their %s.", PlayerName(playerid), GetVehicleName(GetPlayerVehicleID(playerid)));
iEcho(iStr);
}
else if(!strcmp(params, "payfee", true, 7))
{
if(!IsPlayerAtImpound(playerid)) return SendClientError(playerid, "You are not at the car impound!");
new vehicleid = GetPlayerNearestVehicle(playerid);
if(GetDistanceFromPlayerToVehicle(playerid, vehicleid) > 3.0)
return SendClientError(playerid, "There is no vehicle around you! You must stand ON it.");
if(strcmp(PlayerName(playerid),Vehicles[vehicleid][carowner],false) && strcmp("NoBodY",Vehicles[vehicleid][carowner],true))
return SendClientError(playerid, "You do not own this vehicle!");
if(HandMoney(playerid) < dini_Int(CarFile(vehicleid), "impoundfee"))
return SendClientError(playerid, "You don't have enough money on hand!");
new fee = dini_Int(CarFile(vehicleid), "impoundfee");
if(fee == 666)
return SendClientError(playerid, "You cannot unimpound your vehicle at this time!");
GivePlayerMoneyEx(playerid, -fee);
SendClientMSG(playerid, COLOR_HELPEROOC, "[IMPOUND] Paid $%d to unimpound your %s!", fee, GetVehicleName(vehicleid));
if(!dini_Isset(globalstats, "unimpoundslot")) dini_IntSet(globalstats, "unimpoundslot", 0);
new ri = dini_Int(globalstats, "unimpoundslot");
if(ri >= sizeof(unimpoundpos))
{
ri = 0;
dini_IntSet(globalstats, "unimpoundslot", 0);
}
else
{
dini_IntSet(globalstats, "unimpoundslot", ri+1);
}
dini_FloatSet(CarFile(vehicleid), "x", unimpoundpos[ri][spawnx]);
dini_FloatSet(CarFile(vehicleid), "y", unimpoundpos[ri][spawny]);
dini_FloatSet(CarFile(vehicleid), "z", unimpoundpos[ri][spawnz]);
dini_FloatSet(CarFile(vehicleid), "a", unimpoundpos[ri][sangle]);
dini_IntSet(CarFile(vehicleid), "impounded", 0);
dini_IntSet(CarFile(vehicleid), "vw", 0);
ReloadVehicle(vehicleid);
format(iStr, sizeof(iStr), "6[VEHICLE] %s has un-impounded their %s for $%d.", PlayerName(playerid), GetVehicleName(vehicleid), fee);
iEcho(iStr);
return 1;
}
else if(!sscanf(params, "impound", tmp2))
{
if(!IsPlayerFED(playerid)) return SendClientError(playerid, "You may not use this.");
if(!IsPlayerAtImpound(playerid)) return SendClientError(playerid, "You are not at the car impound!");
if(!strlen(tmp2) || !IsNumeric(tmp2) || !strlen(tmp3)) return SCP(playerid, "impound [ fee ] [ reason ]");
if(strval(tmp2) < 0 || strval(tmp2) > 50000) return SendClientError(playerid, "Invalid amount!");
new vehicleid = GetPlayerNearestVehicle(playerid);
if(!Vehicles[vehicleid][carteam] && !strcmp(Vehicles[vehicleid][carowner],"NoBodY",true))
return SendClientError(playerid, "You cannot impound unowned vehicles!");
if(GetDistanceFromPlayerToVehicle(playerid, vehicleid) > 3.0)
return SendClientError(playerid, "There is no vehicle around you! You must stand ON it.");
SendClientMessage(playerid, COLOR_LIGHTGREY, "Info: This car has been impounded!");
new Float:cPos[4];
GetVehiclePos(vehicleid, cPos[0], cPos[1], cPos[2]);
GetVehicleZAngle(vehicleid, cPos[3]);
dini_FloatSet(CarFile(vehicleid), "x", cPos[0]);
dini_FloatSet(CarFile(vehicleid), "y", cPos[1]);
dini_FloatSet(CarFile(vehicleid), "z", cPos[2]);
dini_FloatSet(CarFile(vehicleid), "a", cPos[3]);
dini_IntSet(CarFile(vehicleid), "impounded", 1);
dini_IntSet(CarFile(vehicleid), "impoundfee", strval(tmp2));
dini_Set(CarFile(vehicleid), "impoundreason", tmp3);
ReloadVehicle(vehicleid);
format(iStr, sizeof(iStr), "6[VEHICLE] %s has impounded a %s of %s.", PlayerName(playerid), GetVehicleName(vehicleid), dini_Get(CarFile(vehicleid), "owner"));
iEcho(iStr);
return 1;
}
else if(!strcmp(params, "unimpound", true, 9))
{
if(!IsPlayerFED(playerid) && PlayerInfo[playerid][power] < 10)
return SendClientError(playerid, "You may not use this.");
if(!IsPlayerAtImpound(playerid)) return SendClientError(playerid, "You are not at the car impound!");
new vehicleid = GetPlayerNearestVehicle(playerid);
if(GetDistanceFromPlayerToVehicle(playerid, vehicleid) > 3.0)
return SendClientError(playerid, "There is no vehicle around you! You must stand ON it.");
if(dini_Int(CarFile(vehicleid), "impounded") == 0)
return SendClientError(playerid, "This car is not impounded!");
SendClientMessage(playerid, COLOR_LIGHTGREY, "Info: This car has been un-impounded!");
if(!dini_Isset(globalstats, "unimpoundslot")) dini_IntSet(globalstats, "unimpoundslot", 0);
new ri = dini_Int(globalstats, "unimpoundslot");
if(ri >= sizeof(unimpoundpos))
{
ri = 0;
dini_IntSet(globalstats, "unimpoundslot", 0);
}
else
{
dini_IntSet(globalstats, "unimpoundslot", ri+1);
}
dini_FloatSet(CarFile(vehicleid), "x", unimpoundpos[ri][spawnx]);
dini_FloatSet(CarFile(vehicleid), "y", unimpoundpos[ri][spawny]);
dini_FloatSet(CarFile(vehicleid), "z", unimpoundpos[ri][spawnz]);
dini_FloatSet(CarFile(vehicleid), "a", unimpoundpos[ri][sangle]);
dini_IntSet(CarFile(vehicleid), "impounded", 0);
dini_IntSet(CarFile(vehicleid), "vw", 0);
ReloadVehicle(vehicleid);
format(iStr, sizeof(iStr), "6[VEHICLE] %s has un-impounded a %s of %s.", PlayerName(playerid), GetVehicleName(vehicleid), dini_Get(CarFile(vehicleid), "owner"));
iEcho(iStr);
}
else return SCP(playerid,"[ buy / sell / unsell / park / lock / help / tow / find / respray / savemod / unmod / dupekey / takekey / factionize / scrap / paintjob / nitro / plate / control ]");
return 1;
}