09.05.2013, 09:39
Hey there, first of all thank you for reading this.
I have this code. ( I know it's a mess, I've just been working with the 'first written' ( original ) code I've made cuz it didn't work )
I'm really not sure what it does anymore, I've been changing it for about 20 hours now and I can't fix it.
Whenever I use /car sell it returns "USAGE: /car sell [price], as I wanted it to.
But even if I do enter a price, it says the same thing, also if I use /car selll it will return the same, or.. /car selll4654.
What I mean is.. as long as it starts with /car sell it will ask for a price, which I don't want it to do.
But that problem I am sure I can solve on my own.
Anyway, I'd like you not to solve it and send me a fixed code, I'd like you to explain what's wrong, I mean.. I want to fix this alone I just need 'directions'.
Thank you in advance.
- Denying
I have this code. ( I know it's a mess, I've just been working with the 'first written' ( original ) code I've made cuz it didn't work )
pawn Код:
CMD:car(playerid, params[])
{
if(sscanf(params, "s[4]", Option1)) return SendClientMessage("USAGE: /car [ sell ]");
if(strcmp(Option1, "sell") == 0)
{
if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, COLOR_ERROR, "ERROR: You are not in any vehicle.");
format(VehFile, sizeof(VehFile), "Cars/%d.ini", GetPlayerVehicleID(playerid));
GetPlayerName(playerid, name10, sizeof(name10));
if(strcmp(dini_Get(VehFile, "Owner"), name10) != 0) return SendClientMessage(playerid, COLOR_ERROR, "ERROR: You do not own this vehicle.");
if(dini_Int(VehFile, "ForSale") == 1) return SendClientMessage(playerid, COLOR_ERROR, "ERROR: This vehicle is already for sale.");
if(VehPrice == -1) return SendClientMessage(playerid, COLOR_USAGE, "USAGE: /car sell [price]");
dini_IntSet(VehFile, "ForSale", 1);
format(message1, sizeof(message1), "[VEHICLE] You have successfuly set your %s for sale for %d. (VehID: %d)", VehModels[GetVehicleModel(GetPlayerVehicleID(playerid))-400], VehPrice, GetPlayerVehicleID(playerid));
SendClientMessage(playerid, COLOR_USAGE, message1);
dini_IntSet(VehFile, "Price", VehPrice);
GetVehiclePos(GetPlayerVehicleID(playerid), xx, yy, zz);
dini_FloatSet(VehFile, "x", xx);
dini_FloatSet(VehFile, "y", yy);
dini_FloatSet(VehFile, "z", zz);
GetVehicleZAngle(GetPlayerVehicleID(playerid), xx);
dini_FloatSet(VehFile, "Angle", xx);
SetVehicleParamsEx(VehID[playerid], VehInfo[VehID[playerid]][Engine], VehInfo[VehID[playerid]][Lights], VehInfo[VehID[playerid]][Alarm], 0, VehInfo[VehID[playerid]][Bonnet], VehInfo[VehID[playerid]][Boot], VehInfo[VehID[playerid]][Objective]);
VehInfo[GetPlayerVehicleID(playerid)][Doors] == 0;
RemovePlayerFromVehicle(playerid);
VehID[playerid] = -1;
return 1;
}
return 1;
}
I'm really not sure what it does anymore, I've been changing it for about 20 hours now and I can't fix it.
Whenever I use /car sell it returns "USAGE: /car sell [price], as I wanted it to.
But even if I do enter a price, it says the same thing, also if I use /car selll it will return the same, or.. /car selll4654.
What I mean is.. as long as it starts with /car sell it will ask for a price, which I don't want it to do.
But that problem I am sure I can solve on my own.
Anyway, I'd like you not to solve it and send me a fixed code, I'd like you to explain what's wrong, I mean.. I want to fix this alone I just need 'directions'.
Thank you in advance.
- Denying