23.08.2017, 10:55
I'm using BlueG's Mysql R7, I'm looking forward to convert to the new one but It will take time and all of that, So I just want to fix the bugs in the script, Then upgrade the MySQL to the newest
EDIT: By the way, That crash also happens when performing the cmd "/createplayercar"
CMD:
CreatePlayerCar stock.
EDIT: By the way, That crash also happens when performing the cmd "/createplayercar"
CMD:
PHP Code:
YCMD:createplayercar(playerid, params[], help) {
new model,c1,c2,lock;
new playa;
if(help) {
SendClientMessage(playerid, X11_WHITE, "Creates a car for a player");
return 1;
}
if (!sscanf(params, "k<playerLookup_acc>dddd", playa,model, c1, c2, lock))
{
if(!IsPlayerConnectEx(playa)) {
SendClientMessage(playerid, X11_WHITE, "Error: player not connected");
return 1;
}
new EAdminFlags:aflags = EAdminFlags:GetPVarInt(playerid, "AdminFlags");
if(playerid == playa) {
if(~aflags & EAdminFlags_CanRefundSelf) {
SendClientMessage(playerid, X11_TOMATO_2, "You cannot refund yourself!");
return 1;
}
}
new Float:X,Float:Y,Float:Z,Float:A;
GetPlayerPos(playerid, X, Y, Z);
GetPlayerFacingAngle(playerid, A);
if(c1 < 0 || c1 > 255 || c2 < 0 || c2 > 255)
{
SendClientMessage(playerid, X11_RED2, " Color ID can't be below 0 or above 255!");
return 1;
}
if(lock < 0 || lock > 7)
{
SendClientMessage(playerid, X11_RED2, " The lock ID can't be below 0 or above 7!");
return 1;
}
if(!isValidModel(model)) {
SendClientMessage(playerid, X11_RED2, " Invalid Vehicle Model");
return 1;
}
CreatePlayerCar(playa, model, c1, c2, X, Y, Z, A, ELockType:lock);
new string[128];
format(string, sizeof(string), "* Vehicle successfully created.");
SendClientMessage(playerid, COLOR_LIGHTGREEN, string);
format(string, sizeof(string), "An admin added a %s to your cars.", VehiclesName[model-400]);
SendClientMessage(playa, X11_ORANGE, string);
if(GetPVarInt(playerid, "AdminHidden") != 2) {
format(string, sizeof(string), "* %s has given %s a %s",GetPlayerNameEx(playerid, ENameType_AccountName), GetPlayerNameEx(playa, ENameType_CharName), VehiclesName[model-400]);
ABroadcast(X11_YELLOW, string, EAdminFlags_AdminManage);
}
} else {
SendClientMessage(playerid, X11_WHITE, "USAGE: /createplayercar [playerid/name] [model] [colour1] [colour2] [locktype]");
SendClientMessage(playerid, X11_WHITE, "Lock types: 0 = Default, 1 = Simple, 2 = remote, 3 = remote, 4 = advanced, 5 = satelitte, 6 = titanium laser, 7 = bio");
}
return 1;
}
PHP Code:
CreatePlayerCar(playerid, model, c1, c2, Float:X, Float:Y, Float:Z, Float:Angle, ELockType:locktype, putincar = 0) {
query[0] = 0;//[256];
format(query,sizeof(query),"INSERT INTO `playercars` (`owner`,`model`,`X`,`Y`,`Z`,`Angle`,`colour1`,`colour2`,`locktype`) VALUES (%d,%d,%f,%f,%f,%f,%d,%d,%d)",GetPVarInt(playerid, "CharID"),model,X,Y,Z,Angle,c1,c2,_:locktype);
mysql_function_query(g_mysql_handle, query, true, "onPlayerVehicleCreate", "ddddffffdd",playerid,model,c1,c2,X,Y,Z,Angle,_:locktype,putincar);
return 0;
}