/mycars not working... -
Dokins - 26.03.2012
I cannot figure this one out, at all, would someone help me with this. It just doesn't work, at all.
pawn Код:
CMD:mycars(playerid, params[])
{
new string[64];
if(LoggedIn[playerid] == 0) return SendClientMessage(playerid, COLOUR_GREY, "You must be logged in to use this command.");
PlayerSQLID[playerid] = MySQL_GetValue(PlayerSQLID[playerid], "id", "accounts");
VehicleSlot1[playerid] = MySQL_GetValue(PlayerSQLID[playerid], "VehSlot1", "accounts");
VehicleSlot2[playerid] = MySQL_GetValue(PlayerSQLID[playerid], "VehSlot2", "accounts");
VehicleSlot3[playerid] = MySQL_GetValue(PlayerSQLID[playerid], "VehSlot3", "accounts");
if(VehicleSlot1[playerid] == 0 && VehicleSlot2[playerid] == 0 && VehicleSlot3[playerid] == 0) return SendClientMessage(playerid, COLOUR_GREY, "You do not have any vehicles.");
for(new v = 1; v < MAX_VEHICLES; v++)
{
printf("Vehicle ID: %d", VehicleSQLID[v]);
VehicleSQLID[v] = MySQL_GetValue(VehicleSQLID[v], "id", "vehicles");
if(VehicleSlot1[playerid] == VehicleSQLID[v] || VehicleSlot2[playerid] == VehicleSQLID[v] || VehicleSlot3[playerid] == VehicleSQLID[v])
{
SendClientMessage(playerid, COLOUR_WHITE, "Your Vehicles:");
format(string, sizeof(string), "(%d)",v);
SendClientMessage(playerid, COLOUR_GREEN, string);
}
}
return 1;
}
Re: /mycars not working... -
[ABK]Antonio - 26.03.2012
Does that extra bracket have anything to do with it?
EDIT: Oh my bad...Was just bad indentation
EDIT2: Does 1 ID show up? If so...Try this out
pawn Код:
CMD:mycars(playerid, params[])
{
new string[64];
if(LoggedIn[playerid] == 0) return SendClientMessage(playerid, COLOUR_GREY, "You must be logged in to use this command.");
PlayerSQLID[playerid] = MySQL_GetValue(PlayerSQLID[playerid], "id", "accounts");
VehicleSlot1[playerid] = MySQL_GetValue(PlayerSQLID[playerid], "VehSlot1", "accounts");
VehicleSlot2[playerid] = MySQL_GetValue(PlayerSQLID[playerid], "VehSlot2", "accounts");
VehicleSlot3[playerid] = MySQL_GetValue(PlayerSQLID[playerid], "VehSlot3", "accounts");
if(VehicleSlot1[playerid] == 0 && VehicleSlot2[playerid] == 0 && VehicleSlot3[playerid] == 0) return SendClientMessage(playerid, COLOUR_GREY, "You do not have any vehicles.");
for(new v = 1; v < MAX_VEHICLES; v++)
{
printf("Vehicle ID: %d", VehicleSQLID[v]);
VehicleSQLID[v] = MySQL_GetValue(VehicleSQLID[v], "id", "vehicles");
format(string, sizeof(string), "Your Vehicles: ");
new second[6];
if(VehicleSlot1[playerid] == VehicleSQLID[v])
{
format(second, sizeof(second), "(%d) ", v);
strcat(string, second);
}
if(VehicleSlot2[playerid] == VehicleSQLID[v])
{
format(second, sizeof(second), "(%d) ", v);
strcat(string, second);
}
if(VehicleSlot3[playerid] == VehicleSQLID[v])
{
format(second, sizeof(second), "(%d)", v);
strcat(string, second);
}
SendClientMessage(playerid, COLOUR_GREEN, string);
}
return 1;
}
EDIT3: wait a minute...What are you using a loop for?
pawn Код:
CMD:mycars(playerid, params[])
{
if(LoggedIn[playerid] == 0) return SendClientMessage(playerid, COLOUR_GREY, "You must be logged in to use this command.");
VehicleSlot1[playerid] = MySQL_GetValue(PlayerSQLID[playerid], "VehSlot1", "accounts");
VehicleSlot2[playerid] = MySQL_GetValue(PlayerSQLID[playerid], "VehSlot2", "accounts");
VehicleSlot3[playerid] = MySQL_GetValue(PlayerSQLID[playerid], "VehSlot3", "accounts");
if(VehicleSlot1[playerid] == 0 && VehicleSlot2[playerid] == 0 && VehicleSlot3[playerid] == 0) return SendClientMessage(playerid, COLOUR_GREY, "You do not have any vehicles.");
new string[64], second[6];
format(string, sizeof(string), "Your vehicles: ");
if(VehicleSlot1[playerid] != 0)
{
format(second, sizeof(second), "(%d) ", VehicleSlot1[playerid]);
strcat(string, second);
}
if(VehicleSlot2[playerid] != 0)
{
format(second, sizeof(second), "(%d) ", VehicleSlot2[playerid]);
strcat(string, second);
}
if(VehicleSlot3[playerid] != 0)
{
format(second, sizeof(second), "(%d)", VehicleSlot3[playerid]);
strcat(string, second);
}
SendClientMessage(playerid, string);
return 1;
}
We already know their vehicle ID's...
Re: /mycars not working... -
Dokins - 28.03.2012
No, you don't understand, the vehicle doesn't save the vehicle id in the slot, it saves it's MySQL table ID in the slot. How can I get the In-game Vehicle ID?
Edit: I am so very stupid. I just realised that, they are relative to the table.....so dumb.