06.01.2015, 09:40
as PowerPC603 said
corrected code
corrected code
pawn Код:
CMD:v(playerid, params[])
{
new bizid, string[256], input, name[62];
if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
if(PlayerInfo[playerid][pAdmin] < 3) return SendClientMessage(playerid, COLOR_GREY, "You are not an authorized to use this command.");
if(!aDuty[playerid] && PlayerInfo[playerid][pAdmin] < 7) return SendClientMessage(playerid, COLOR_GREY, "You are not on Admin Duty.");
if(sscanf(params, "s[32]", params))
{
SendClientMessage(playerid, USAGE, "[Usage]: /v [option] [bizid]");
SendClientMessage(playerid, COLOR_GREY, "OPTIONS: buy | park | scrap | sell | find | bizname");
return 1;
}
if(!strcmp(params, "buy", true, 5))
{
if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
if(!IsPlayerInRangeOfPoint(playerid, 2, 2132.0168,-1150.0376,24.2036) && !IsPlayerInRangeOfPoint(playerid, 2, 1702.5165,-1471.6949,13.5469)) return SendClientMessage(playerid, COLOR_GREY, "You are not near the vehicles dealership.");
if(PlayerInfo[playerid][vModel] && PlayerInfo[playerid][vVModel])
{
format(string, sizeof(string), "You already own vehicles ID %d and %d.", PlayerInfo[playerid][pVeh], PlayerInfo[playerid][pVVeh]);
SendClientMessage(playerid, COLOR_GREY, string);
return 1;
}
else SSSShowDialog(playerid, 10);
}
else if(!strcmp(params, "park", true, 8))
{
if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You are not in a vehicle.");
// Family Vehicles
if(IsFamVehicle(GetPlayerVehicleID(playerid)) && Fam[GetPlayerVehicleID(playerid)] == PlayerInfo[playerid][pFam])
{
new idx = PlayerInfo[playerid][pFam], veh = GFVS(GetPlayerVehicleID(playerid));
GetVehiclePos(GetPlayerVehicleID(playerid), FamInfo[idx][fVehCoX][veh], FamInfo[idx][fVehCoY][veh], FamInfo[idx][fVehCoZ][veh]);
GetVehicleZAngle(GetPlayerVehicleID(playerid), FamInfo[idx][fVehRot][veh]);
if(FamInfo[idx][fVehType][veh])
{
DestroyVehicle(FamInfo[idx][fVeh][veh]);
}
}
FamInfo[idx][fVeh][veh] = CreateVehicle(FamInfo[idx][fVehType][veh], FamInfo[idx][fVehCoX][veh], FamInfo[idx][fVehCoY][veh], FamInfo[idx][fVehCoZ][veh], FamInfo[idx][fVehRot][veh], FamInfo[idx][fVehCol1][veh], FamInfo[idx][fVehCol2][veh], 1200);
ChangeVehicleColor(FamInfo[idx][fVeh][veh], FamInfo[idx][fVehCol1][veh], FamInfo[idx][fVehCol2][veh]);
SendClientMessage(playerid, COLOR_GREY, " You have parked your family vehicle, it will always spawn here until you park it somewhere else.");
}
// Owned Vehicles
if(GetPlayerVehicleID(playerid) != PlayerInfo[playerid][pVeh] && GetPlayerVehicleID(playerid) != PlayerInfo[playerid][pVVeh]) return SendClientMessage(playerid, COLOR_GREY, "You are not in a vehicle you can park.");
SendClientMessage(playerid, COLOR_GREY, " You have parked your vehicle, it will always spawn here until you park it somewhere else.");
GiveDodMoney(playerid, -5000);
if(PlayerInfo[playerid][pMoney] < 5000) return SendClientMessage(playerid, COLOR_GREY, "You don't have enough money to park your car.($5000)");
if(GetPlayerVehicleID(playerid) == PlayerInfo[playerid][pVeh])
{
for(new i=0; i<14; i++)
{
PlayerInfo[playerid][pVehMod][i] = GetVehicleComponentInSlot(PlayerInfo[playerid][pVeh], i);
}
GetVehiclePos(PlayerInfo[playerid][pVeh],PlayerInfo[playerid][vX], PlayerInfo[playerid][vY], PlayerInfo[playerid][vZ]);
GetVehicleZAngle(PlayerInfo[playerid][pVeh],PlayerInfo[playerid][vA]);
DestroyVehicle(PlayerInfo[playerid][pVeh]);
DestroyObject(GetPVarInt(playerid, "neon"));
DestroyObject(GetPVarInt(playerid, "neon1"));
DestroyObject(GetPVarInt(playerid, "neon2"));
DestroyObject(GetPVarInt(playerid, "neon3"));
DestroyObject(GetPVarInt(playerid, "neon4"));
DestroyObject(GetPVarInt(playerid, "neon5"));
DestroyObject(GetPVarInt(playerid, "neon6"));
DestroyObject(GetPVarInt(playerid, "neon7"));
DestroyObject(GetPVarInt(playerid, "neon8"));
DestroyObject(GetPVarInt(playerid, "neon9"));
DestroyObject(GetPVarInt(playerid, "neon10"));
DestroyObject(GetPVarInt(playerid, "neon11"));
DestroyObject(GetPVarInt(playerid, "nb1"));
DestroyObject(GetPVarInt(playerid, "nb2"));
DestroyObject(GetPVarInt(playerid, "nb3"));
DestroyObject(GetPVarInt(playerid, "nb4"));
DestroyObject(GetPVarInt(playerid, "nb5"));
DestroyObject(GetPVarInt(playerid, "nb6"));
topened[playerid] = 0;
neon[playerid] = 1;
PlayerInfo[playerid][pVeh] = CreateVehicle(PlayerInfo[playerid][vModel], PlayerInfo[playerid][vX], PlayerInfo[playerid][vY], PlayerInfo[playerid][vZ],PlayerInfo[playerid][vA],PlayerInfo[playerid][vC1],PlayerInfo[playerid][vC2], 1200);
PlayerInfo[playerid][pVehVW] = GetPlayerVirtualWorld(playerid);
SetVehicleVirtualWorld(PlayerInfo[playerid][pVeh], PlayerInfo[playerid][pVehVW]);
LinkVehicleToInterior(PlayerInfo[playerid][pVeh], GetPlayerInterior(playerid));
ChangeVehiclePaintjob(PlayerInfo[playerid][pVeh], PlayerInfo[playerid][vPJ]);
for(new i=0; i<14; i++)
{
AddVehicleComponent(PlayerInfo[playerid][pVeh], PlayerInfo[playerid][pVehMod][i]);
}
}
return 1;
}