20.07.2016, 09:07
(
Последний раз редактировалось MauriceTank; 20.07.2016 в 09:49.
)
Hello forum.sa-mp.com i need your help
i have mysql server and when i type command /park my car auto delete from the server please help me
YCMD: park(playerid, params[], help)
{
new string[128], idd, keyid;
if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, COLOR_WHITE, "{FFFFCC}Error: You aren't in any vehicle!");
new car = GetPlayerVehicleID(playerid);
new valid = PlayerData[playerid][CarKey1] + PlayerData[playerid][CarKey2] + PlayerData[playerid][CarKey3] + PlayerData[playerid][CarKey4] + PlayerData[playerid][CarKey5];
if(valid == 0) return SendClientMessage(playerid, COLOR_WHITE, "{FFFFCC}Error: You don't have a vehicle!");
if(sscanf(params, "i", keyid)) return SendUsage(playerid,"/park <1 / 2 / 3 / 4 / 5>");
if(keyid > 5 || keyid < 1) return SendClientMessage(playerid, COLOR_WHITE, "{FFFFCC}Error: Invalid key number.");
if(keyid == 1) idd = PlayerData[playerid][CarKey1];
if(keyid == 2) idd = PlayerData[playerid][CarKey2];
if(keyid == 3) idd = PlayerData[playerid][CarKey3];
if(keyid == 4) idd = PlayerData[playerid][CarKey4];
if(keyid == 5) idd = PlayerData[playerid][CarKey5];
if(idd == 0) return SendClientMessage(playerid, COLOR_WHITE, "{FFFFCC}Error: Your don't won a vehicle on this slot!");
if(CarInfo[idd][Spawned] != car) return SendClientMessage(playerid, COLOR_WHITE, "{FFFFCC}Error: You aren't in that vehicle!");
new Float, Float:y, Float:z, Float:a;
GetVehiclePos(car, x, y, z);
GetVehicleZAngle(car, a);
CarInfo[idd][cLocationx] = x;
CarInfo[idd][cLocationy] = y;
CarInfo[idd][cLocationz] = z;
CarInfo[idd][cAngle] = a;
CarInfo[idd][Spawned] = 0;
ResetKey(car);
mysql_format(SQL, string, sizeof(string), "UPDATE cars SET Locationx='%f' WHERE ID=%d", CarInfo[idd][cLocationx], idd);
mysql_tquery(SQL, string, "", "");
mysql_format(SQL, string, sizeof(string), "UPDATE cars SET Locationy='%f' WHERE ID=%d", CarInfo[idd][cLocationy], idd);
mysql_tquery(SQL, string, "", "");
mysql_format(SQL, string, sizeof(string), "UPDATE cars SET Locationz='%f' WHERE ID=%d", CarInfo[idd][cLocationz], idd);
mysql_tquery(SQL, string, "", "");
mysql_format(SQL, string, sizeof(string), "UPDATE cars SET Angle='%f' WHERE ID=%d", CarInfo[idd][cAngle], idd);
mysql_tquery(SQL, string, "", "");
mysql_format(SQL, string, sizeof(string), "UPDATE cars SET Spawned='%d' WHERE ID=%d", CarInfo[idd][Spawned], idd);
mysql_tquery(SQL, string, "", "");
DestroyVehicle(car);
return 1;
}
what wrong? why my car dont save ?pls help me
i have mysql server and when i type command /park my car auto delete from the server please help me
YCMD: park(playerid, params[], help)
{
new string[128], idd, keyid;
if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, COLOR_WHITE, "{FFFFCC}Error: You aren't in any vehicle!");
new car = GetPlayerVehicleID(playerid);
new valid = PlayerData[playerid][CarKey1] + PlayerData[playerid][CarKey2] + PlayerData[playerid][CarKey3] + PlayerData[playerid][CarKey4] + PlayerData[playerid][CarKey5];
if(valid == 0) return SendClientMessage(playerid, COLOR_WHITE, "{FFFFCC}Error: You don't have a vehicle!");
if(sscanf(params, "i", keyid)) return SendUsage(playerid,"/park <1 / 2 / 3 / 4 / 5>");
if(keyid > 5 || keyid < 1) return SendClientMessage(playerid, COLOR_WHITE, "{FFFFCC}Error: Invalid key number.");
if(keyid == 1) idd = PlayerData[playerid][CarKey1];
if(keyid == 2) idd = PlayerData[playerid][CarKey2];
if(keyid == 3) idd = PlayerData[playerid][CarKey3];
if(keyid == 4) idd = PlayerData[playerid][CarKey4];
if(keyid == 5) idd = PlayerData[playerid][CarKey5];
if(idd == 0) return SendClientMessage(playerid, COLOR_WHITE, "{FFFFCC}Error: Your don't won a vehicle on this slot!");
if(CarInfo[idd][Spawned] != car) return SendClientMessage(playerid, COLOR_WHITE, "{FFFFCC}Error: You aren't in that vehicle!");
new Float, Float:y, Float:z, Float:a;
GetVehiclePos(car, x, y, z);
GetVehicleZAngle(car, a);
CarInfo[idd][cLocationx] = x;
CarInfo[idd][cLocationy] = y;
CarInfo[idd][cLocationz] = z;
CarInfo[idd][cAngle] = a;
CarInfo[idd][Spawned] = 0;
ResetKey(car);
mysql_format(SQL, string, sizeof(string), "UPDATE cars SET Locationx='%f' WHERE ID=%d", CarInfo[idd][cLocationx], idd);
mysql_tquery(SQL, string, "", "");
mysql_format(SQL, string, sizeof(string), "UPDATE cars SET Locationy='%f' WHERE ID=%d", CarInfo[idd][cLocationy], idd);
mysql_tquery(SQL, string, "", "");
mysql_format(SQL, string, sizeof(string), "UPDATE cars SET Locationz='%f' WHERE ID=%d", CarInfo[idd][cLocationz], idd);
mysql_tquery(SQL, string, "", "");
mysql_format(SQL, string, sizeof(string), "UPDATE cars SET Angle='%f' WHERE ID=%d", CarInfo[idd][cAngle], idd);
mysql_tquery(SQL, string, "", "");
mysql_format(SQL, string, sizeof(string), "UPDATE cars SET Spawned='%d' WHERE ID=%d", CarInfo[idd][Spawned], idd);
mysql_tquery(SQL, string, "", "");
DestroyVehicle(car);
return 1;
}
what wrong? why my car dont save ?pls help me