/park bug help
#1

PHP код:
YCMDpark(playeridparams[], help)
{
    new 
string[128], iddkeyid;
    if(!
IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playeridCOLOR_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(playeridCOLOR_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 || keyid 1) return SendClientMessage(playeridCOLOR_WHITE"{FFFFCC}Error: Invalid key number.");
    if(
keyid == 1idd PlayerData[playerid][CarKey1];
    if(
keyid == 2idd PlayerData[playerid][CarKey2];
    if(
keyid == 3idd PlayerData[playerid][CarKey3];
    if(
keyid == 4idd PlayerData[playerid][CarKey4];
    if(
keyid == 5idd PlayerData[playerid][CarKey5];
    if(
idd == 0) return SendClientMessage(playeridCOLOR_WHITE"{FFFFCC}Error: Your don't won a vehicle on this slot!");
    if(
CarInfo[idd][Spawned] != car) return SendClientMessage(playeridCOLOR_WHITE"{FFFFCC}Error: You aren't in that vehicle!");
    new 
FloatxFloat:yFloat:zFloat:a;
    
GetVehiclePos(carxyz);
    
GetVehicleZAngle(cara);
    
CarInfo[idd][cLocationx] = x;
    
CarInfo[idd][cLocationy] = y;
    
CarInfo[idd][cLocationz] = z;
    
CarInfo[idd][cAngle] = a;
    
CarInfo[idd][Spawned] = 0;
    
ResetKey(car);
    
mysql_format(SQLstringsizeof(string), "UPDATE cars SET Locationx='%f' WHERE ID=%d"CarInfo[idd][cLocationx], idd);
    
mysql_tquery(SQLstring"""");
    
mysql_format(SQLstringsizeof(string), "UPDATE cars SET Locationy='%f' WHERE ID=%d"CarInfo[idd][cLocationy], idd);
    
mysql_tquery(SQLstring"""");
    
mysql_format(SQLstringsizeof(string), "UPDATE cars SET Locationz='%f' WHERE ID=%d"CarInfo[idd][cLocationz], idd);
    
mysql_tquery(SQLstring"""");
    
mysql_format(SQLstringsizeof(string), "UPDATE cars SET Angle='%f' WHERE ID=%d"CarInfo[idd][cAngle], idd);
    
mysql_tquery(SQLstring"""");
    
mysql_format(SQLstringsizeof(string), "UPDATE cars SET Spawned='%d' WHERE ID=%d"CarInfo[idd][Spawned], idd);
    
mysql_tquery(SQLstring"""");
    
DestroyVehicle(car);
    return 
1
}
if i park my vehicle got destroy forever what wrong i have database ?
problem it is in?
DestroyVehicle(car);
Reply
#2

First of all use [php] [ /php] tag when writing codes. Second of all use ZCMD or IZCMD it is faster. And third of all DestroyCar(car); is destroying it. Try changing that
Reply
#3

delete ? destroycar?
Reply
#4

Код:
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: x, 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, "", "");
return 1;
}
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)