This isn't working correctly. Why?
#1

I use a gamemode with SQL.. And, I'm trying create a command, but he doesn't want to work..
Can your help me?

The error is, the car owner name, doesn't show....

The command:
PHP код:
CMD:checkplate(playeridparams[])
{
    new
        
id 0,
        
string[128];
    if (
GetFactionType(playerid) != FACTION_POLICE)
        return 
SendErrorMessage(playerid"You needs be a cop.");
    if (
sscanf(params"d"id))
        return 
SendSyntaxMessage(playerid"/checkplate [vehicleid]");
    if (!
IsValidVehicle(id) || Car_GetID(id) == -1)
        return 
SendErrorMessage(playerid"You specified an invalid ID.");
    
format(string,sizeof(string),"The owner of this car it's %s."cache_get_field_content(id"carOwner"CarData[id][carOwner], g_iHandleMAX_PLAYER_NAME+1));
    
SendClientMessage(playeridCOLOR_GREENstring);
    return 
1;

CarData Enum:
PHP код:
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
}; 
+REP
Reply
#2

You're using cache_get_* when there's no active cache. You can recreate the cache yourself or let the library do it for you via a threaded query.
Reply
#3

Quote:
Originally Posted by AndySedeyn
Посмотреть сообщение
You're using cache_get_* when there's no active cache. You can recreate the cache yourself or let the library do it for you via a threaded query.
I don't know how to do this...
Can you create the command for me, please? ;-;
Reply
#4

new getipQuery[200];
mysql_format(1, getipQuery, sizeof(getipQuery), "Select carOwner FROM YOUR_TABLE WHERE vehicle_id = %d, id);
new Cache:cacheid = mysql_query(1, getipQuery);

cacheid is the cache <
Reply
#5

You could just include the enum in there.
Reply
#6

The function cache_get_field_content() itself doesn't return anything, except perhaps 1 or 0 to denote success or failure. The actual string value is being stored in "CarData[id][carOwner]". It is this value that you need to format.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)