17.01.2014, 02:02
(
Последний раз редактировалось horsemeat; 18.01.2014 в 05:01.
)
The code runs but stops it also telling you unknown command an suggestions?
pawn Код:
CMD:removecar(playerid, params[])
{
new vehicleid,string[256];
if(IsPlayerInAnyVehicle(playerid))
{
new playerstate = GetPlayerState(playerid);
if(playerstate != PLAYER_STATE_DRIVER) return SendClientMessage(playerid, RED, "You have to be in the driver seat inorder to remove this vehicle");
vehicleid = GetPlayerVehicleID(playerid);
}
else
{
if(sscanf(params,"i",vehicleid)) return SendClientMessage(playerid, RED, "SYNTAX /removecar [vehicleid]");
}
new carid = jbcarid[vehicleid];
if((carstate[carid])==1)
{
if((cartype[carid])==2)//mark
{
new halfprice = VehicleManufactureingPrice(carmodelid[carid]) / 2;
dealershipcash[cardealershipid[carid]] = dealershipcash[cardealershipid[carid]] + halfprice;
format(string,sizeof(string),"You have remove the cars for $%i",halfprice);
SendClientMessage(playerid, LIGHTBLUE,string);
print("this print works here");//remove
if((requeststockstate[carmodelid[carid]][cardealershipid[carid]])==1||(requeststockstate[carmodelid[carid]][cardealershipid[carid]])==2)
{
print("this does not work");
new totalcarscash = (VehicleManufactureingPrice(carmodelid[carid]) * requeststock[carmodelid[carid]][cardealershipid[carid]]) / 2;
format(string,sizeof(string),"You also canceled your request for %i car(s) for $%i",requeststock[carmodelid[carid]][cardealershipid[carid]],totalcarscash);
SendClientMessage(playerid,RED,string);
dealershipordercash[choicedealershipid[playerid]] = dealershipordercash[choicedealershipid[playerid]] - totalcarscash;
dealershipcash[choicedealershipid[playerid]] = dealershipcash[choicedealershipid[playerid]] + totalcarscash;
}
else if((requeststockstate[carmodelid[carid]][cardealershipid[carid]])==3)
{
for(new factoryid;factoryid < MAX_FACTORIES;factoryid++)
{
if((factorystate[factoryid])==1)
{
for(new count;count < FACTORYMAXORDERSATONCE;count++)
{
if((factorystockstate[count][factoryid])==1)
{
if((factorydealershipid[count][factoryid])==cardealershipid[carid])
{
if((factorydealerstockmodelid[count][factoryid])==carmodelid[carid])
{
factorycash[factoryid] = factorycash[factoryid] + ((factorystockcurrent[count][factoryid] * VehicleManufactureingPrice(carmodelid[carid]))/2);
carstock[carid] = carstock[carid] + factorystockcurrent[count][factoryid];
factorystockcurrent[count][factoryid] = 0;
factorydealershipid[count][factoryid] = 0;
factorystock[count][factoryid] = 0;
factorystockstate[count][factoryid] = 0;
factorydealerstockmodelid[count][factoryid] = 0;
factorystock[count][factoryid] = 0;
factoryordercost[count][factoryid] = 0;
}
}
}
}
}
}
new totalcarscash = (VehicleManufactureingPrice(carmodelid[carid]) * requeststock[carmodelid[carid]][cardealershipid[carid]]) / 2;
format(string,sizeof(string),"You also canceled your request for %i car(s) for $%i",requeststock[carmodelid[carid]][cardealershipid[carid]],totalcarscash);
dealershipordercash[choicedealershipid[playerid]] = dealershipordercash[choicedealershipid[playerid]] - totalcarscash;
dealershipcash[choicedealershipid[playerid]] = dealershipcash[choicedealershipid[playerid]] + totalcarscash;
}
requeststock[carmodelid[carid] - 400][cardealershipid[carid]] = 0;
requeststockstate[carmodelid[carid] - 400][cardealershipid[carid]] = 0;
SaveDealershipData(cardealershipid[carid]);
DestroyVehicle(car[carid]);
Delete3DTextLabel(carlabel[carid]);
DeleteCarData(carid);
}
else
{
SendClientMessage(playerid,RED,"You car only remove dealership vehicles");
}
}
else
{
if(IsPlayerAdmince(playerid,2))
{
DestroyVehicle(vehicleid);
SendClientMessage(playerid, RED, "You have destroyed the car");
}
else
{
SendClientMessage(playerid, RED, "You have to be admin inorder to remove a car that is not a jbcar");
}
}
return 1;
}