CMD:searchplate(playerid, params[])
{
static
id = 0;
if (GetFactionType(playerid) != FACTION_POLICE)
return SendErrorMessage(playerid, "You needs be a cop.");
if (sscanf(params, "d", id))
return SendSyntaxMessage(playerid, "/serachplate [vehicleid]");
if (!IsValidVehicle(id) || Car_GetID(id) == -1)
return SendErrorMessage(playerid, "You specified an invalid ID.");
Dialog_Show(playerid, InfoCarro, DIALOG_STYLE_MSGBOX, "LOS SANTOS POLICE DEPARTMENT", "This vehicle is owned by %s. Thank you for making the query.\n\nLOS SANTOS POLICE DEPARTMENT", "Ok", "", CarData[id][carOwner]);
return 1;
}
enum carData {
carID,
carExists,
carModel,
carOwner,
Float:carPos[4],
carColor1,
carColor2,
carPaintjob,
carLocked,
carMods[14],
carImpounded,
carImpoundPrice,
carFaction,
carWeapons[5],
carAmmo[5],
carVehicle
};
CMD:searchplate(playerid, params[]) { static id = 0; if (GetFactionType(playerid) != FACTION_POLICE) return SendErrorMessage(playerid, "You needs be a cop."); if (sscanf(params, "d", id)) return SendSyntaxMessage(playerid, "/serachplate [vehicleid]"); if (!IsValidVehicle(id) || Car_GetID(id) == -1) return SendErrorMessage(playerid, "You specified an invalid ID."); new szString[128]; format(szString, sizeof(szString), "This vehicle is owned by %s. Thank you for making the query.\n\nLOS SANTOS POLICE DEPARTMENT", CarData[id][carOwner]); Dialog_Show(playerid, InfoCarro, DIALOG_STYLE_MSGBOX, "LOS SANTOS POLICE DEPARTMENT", szString, "Ok", ""); return 1; }
new szString[128]; // To store our string for later user in the dialog. format(szString, sizeof(szString), "This vehicle is owned by %s. Thank you for making the query.\n\nLOS SANTOS POLICE DEPARTMENT", CarData[id][carOwner]); // Format the string here inserting our carOwner variable. Dialog_Show(playerid, InfoCarro, DIALOG_STYLE_MSGBOX, "LOS SANTOS POLICE DEPARTMENT", szString, "Ok", ""); // Show the dialog using our string created above.
enum carData {
carID,
carExists,
carModel,
carOwner[MAX_PLAYER_NAME],
Float:carPos[4],
carColor1,
carColor2,
carPaintjob,
carLocked,
carMods[14],
carImpounded,
carImpoundPrice,
carFaction,
carWeapons[5],
carAmmo[5],
carVehicle
};
public OnGameModeInit()
{
for(new i; i < MAX_VEHICLES; i++) CarData[i][carOwner] = "Null";
}
try it this way, new carOwner - replace it at your enum or whatever is it. remve max_player_name
put this anywhere on script stock myStrcpy(dest[], src[]) { new i = 0; while ((dest[i] = src[i])) i++; } and use it as myStrcpy(carOwner, PlayerName(playerid) // players name howerver u define);
Код:
try it this way, new carOwner - replace it at your enum or whatever is it. remve max_player_name Код:
put this anywhere on script stock myStrcpy(dest[], src[]) { new i = 0; while ((dest[i] = src[i])) i++; } and use it as myStrcpy(carOwner, PlayerName(playerid) // players name howerver u define); carOwner when u get the owner from that thing |
forward Car_Load(); public Car_Load() { static rows, fields, str[128]; cache_get_data(rows, fields, g_iHandle); for (new i = 0; i < rows; i ++) if (i < MAX_DYNAMIC_CARS) { CarData[i][carExists] = true; CarData[i][carID] = cache_get_field_int(i, "carID"); CarData[i][carModel] = cache_get_field_int(i, "carModel"); CarData[i][carOwner] = cache_get_field_int(i, "carOwner"); CarData[i][carPos][0] = cache_get_field_float(i, "carPosX"); CarData[i][carPos][1] = cache_get_field_float(i, "carPosY"); CarData[i][carPos][2] = cache_get_field_float(i, "carPosZ"); CarData[i][carPos][3] = cache_get_field_float(i, "carPosR"); CarData[i][carColor1] = cache_get_field_int(i, "carColor1"); CarData[i][carColor2] = cache_get_field_int(i, "carColor2"); CarData[i][carPaintjob] = cache_get_field_int(i, "carPaintjob"); CarData[i][carLocked] = cache_get_field_int(i, "carLocked"); CarData[i][carImpounded] = cache_get_field_int(i, "carImpounded"); CarData[i][carImpoundPrice] = cache_get_field_int(i, "carImpoundPrice"); CarData[i][carFaction] = cache_get_field_int(i, "carFaction"); for (new j = 0; j < 14; j ++) { if (j < 5) { format(str, sizeof(str), "carWeapon%d", j + 1); CarData[i][carWeapons][j] = cache_get_field_int(i, str); format(str, sizeof(str), "carAmmo%d", j + 1); CarData[i][carAmmo][j] = cache_get_field_int(i, str); } format(str, sizeof(str), "carMod%d", j + 1); CarData[i][carMods][j] = cache_get_field_int(i, str); } Car_Spawn(i); } for (new i = 0; i < MAX_DYNAMIC_CARS; i ++) if (CarData[i][carExists]) { format(str, sizeof(str), "SELECT * FROM `carstorage` WHERE `ID` = '%d'", CarData[i][carID]); mysql_tquery(g_iHandle, str, "OnLoadCarStorage", "d", i); } return 1; } |