10.12.2013, 03:58
pawn Код:
CMD:forsale(playerid, params[])
{
new vehicleid = GetPlayerVehicleID(playerid);
if(LoggedIn[playerid] == 0) return SendClientMessage(playerid, COLOUR_GREY, "You must be logged in to use this command.");
if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, COLOUR_GREY, "You must be in a vehicle to use this.");
if(BizOwned[playerid] == 0) return SendClientMessage(playerid, COLOUR_GREY, "You do not own a business.");
if(BizOwned[playerid] != VehBizID[vehicleid]) return SendClientMessage(playerid, COLOUR_GREY, "Your business does not own this vehicle.");
if(VehForSale[vehicleid] == 0)
{
VehForSale[vehicleid] = 1;
new string[128];
new name = VehModel[vehicleid] - 400;
new Float: x, Float: y, Float: z;
MySQL_SetInteger(VehicleSQLID[vehicleid], "VehForSale", 1, "vehicles");
GetVehiclePos(vehicleid, x,y,z);
format(string, sizeof(string), "%s, $%d, %s", VehicleNames[name], VehPrice[vehicleid], VehPlate[vehicleid]);
VehicleLabel[vehicleid] = CreateDynamic3DTextLabel(string, COLOUR_WHITE, x,y, z, 100.0, INVALID_PLAYER_ID, vehicleid, 0, 0, -1, -1, 20.0);
Attach3DTextLabelToVehicle(VehicleLabel[vehicleid] ,vehicleid,0.0,0.0,0.0);
SendClientMessage(playerid, COLOUR_WHITE, "Business vehicle is now for sale.");
}
else if(VehForSale[vehicleid] == 1)
{
VehForSale[vehicleid] = 0;
MySQL_SetInteger(VehicleSQLID[vehicleid], "VehForSale", 0, "vehicles");
SendClientMessage(playerid, COLOUR_WHITE, "Business vehicle is no longer for sale.");
DestroyDynamic3DTextLabel(VehicleLabel[vehicleid]);
}
return 1;
}
I'm using a streamer, yes. It was working, but I've done checks and it does indeed set the vehicle for sale in MySQL it seems the actual problem is the Creating the label..
It used to work, but I've changed things slightly.
I do have the:
pawn Код:
new Text3D: VehicleLabel[MAX_VEHICLES];