Bringing a vehicle not working
#1

Hello, so lately i tried to create a command for admins which enables them to bring the players vehicle but it doesnt work, so if you can help me i would be thankful to you

it only say "You teleported the vehicle 0 to your current location." so it dont get the vehicle id, i dont know why




Quote:

if(dialogid == DIALOG_ADMINOPTIONSLIST)
{
if (response)
{
new
DBResult:locatingResult,
locatingQuery[128],
resultCount,
idstring[48],
bool:found,
dialogtitle[60],
playerwho = playerData[playerid][playerGetStats]
;

format(locatingQuery, sizeof(locatingQuery), "SELECT * FROM `vehicles` WHERE `owner` = '%i' LIMIT %i, 1", playerData[playerwho][actualID], listitem);
locatingResult = db_query(DB: VEHICLESDB, locatingQuery);
resultCount = db_num_rows(locatingResult);

if(resultCount > 0)
{
db_get_field_assoc(locatingResult, "id", idstring, 3);
new tvehicleID = strval(idstring);

db_get_field_assoc(locatingResult, "modelid", idstring, 3);
new vehicleModel = strval(idstring);

for(new i; i < MAX_SAVED_VEHICLES; i++)
{
if (tvehicleID != i) continue;

if(i == tvehicleID)
{
found = true;

playerData[playerid][vehicleMenu] = DLParam;

format(dialogtitle, sizeof(dialogtitle), "%s's Vehicle: %s", playerData[playerwho][playerNamee], vehicleNames[vehicleModel - 400]);
ShowPlayerDialog(playerid, DIALOG_ADMINVEHICLEOPTIONS, DIALOG_STYLE_LIST, dialogtitle, "Bring Vehicle", "OK", "Close");

break;
}
}

if(!found)
{
SendClientMessage(playerid, COLOR_WHITE, "{B7B7B7}[SERVER] {FFFFFF}Unable to find information about that vehicle. This is caused by a bad query to the database.");
}
}
}
}











Quote:

if(dialogid == DIALOG_ADMINVEHICLEOPTIONS)
{
if (response)
{
new i = playerData[playerid][vehicleMenu];
switch(listitem)
{
case 0:
{
new Float:fX, Float:fY, Float:fZ, message[128];

GetPlayerPos(playerid, fX, fY, fZ);
SetVehiclePos(VehicleInfo[i][vehicleID], fX, fY, fZ);
SetPlayerPos(playerid, fX, fY, (fZ + 3.0));

new log[250];
format(log, sizeof(log), "%s(%i) has teleported owned vehicle id %i to them", playerData[playerid][tempAdminName], playerid, VehicleInfo[i][vehicleID]);
SendAdminText(playerid, log);

format(message, sizeof(message), "{FE9A2E}[ADMIN] {FFFFFF}You teleported the vehicle %i to your current location.", VehicleInfo[i][vehicleID]);
SendClientMessage(playerid, COLOR_WHITE, message);
}
}
}
}

Reply
#2

Because you are taking something named DLParam instead of vehicle id.

playerData[playerid][vehicleMenu] = DLParam;
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)