20.12.2013, 13:33
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:
p.s Merry XMAS!
"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();
}