/lastdriver help
#1

I've been trying to make a /lastdriver command though all it says is this:

"The last driver of this FBI Rancher was "

Here's my codes:

pawn Код:
command(lastdriver, playerid, params[])
    {
        new vehicleid;
        if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
        {
            new query[500], data_value[50], name[24], string[500];
            format(query, sizeof(query), "SELECT * FROM `vehicles` WHERE `LastDriver` = '%s' AND `VehicleID` = sha1('%s')", vehicleid);
            mysql_query(query);
            mysql_store_result();
           
            while(mysql_retrieve_row())
            {
                mysql_fetch_field_row(data_value, "LastDriver"); format(name, sizeof(name), "%s", data_value);
            }
            format(string, sizeof(string), "The last driver of this %s was {FF0000}%s{FFFFFF}", GetVehicleName(GetPlayerVehicleID(playerid)), name);
            SendClientMessage(playerid, WHITE, string);
            mysql_free_result();
        }
        else return SCM(playerid, WHITE, "You are not in a vehicle.");
        return 1;
    }
pawn Код:
if(newstate == PLAYER_STATE_ONFOOT && oldstate == PLAYER_STATE_DRIVER)
        {
            new query[512], vehicleid2;
            format(query, sizeof(query), "UPDATE `vehicles` SET `LastDriver`=%s WHERE `VehicleID`=%d", pName(playerid), vehicleid2);
            mysql_query(query);
            mysql_free_result();
        }
p.s Merry XMAS!
Reply


Messages In This Thread
/lastdriver help - by Mitchy - 20.12.2013, 13:33
Re: /lastdriver help - by ikey07 - 20.12.2013, 13:39
Re: /lastdriver help - by Mitchy - 20.12.2013, 13:47
Re: /lastdriver help - by Mitchy - 20.12.2013, 13:52
Re: /lastdriver help - by ikey07 - 20.12.2013, 14:08
Re: /lastdriver help - by cessil - 20.12.2013, 14:09
Re: /lastdriver help - by Mitchy - 20.12.2013, 14:18
Re: /lastdriver help - by tyler12 - 20.12.2013, 14:57
Re: /lastdriver help - by tyler12 - 20.12.2013, 15:20
Re: /lastdriver help - by DemME - 20.12.2013, 20:03

Forum Jump:


Users browsing this thread: 3 Guest(s)