[HELP] /park command
#1

Hi all, first of all, sorry for my bad english , but my problem is vehicle parking and save it to SQL instantly, but if i do a server restart then it parks correctly.

/park command is:

Код:
	f(strcmp(cmd, "/park", true) == 0)
    	{
		if(IsPlayerConnected(playerid))
 		{
			new Float:x,Float:y,Float:z;
			new Float:a;
			new getcarid;
			getcarid = GetPlayerVehicleID(playerid);
			GetPlayerName(playerid, playername, sizeof(playername));
			GetVehiclePos(getcarid, x, y, z);
			GetVehicleZAngle(getcarid, a);
			if (!IsPlayerInAnyVehicle(playerid))
			{
			SendClientMessage(playerid, COLOR_GREY, "You are not in the car");
			return 1;
			}
			if (CarInfo[getcarid][cOwned] !=1 || strcmp(CarInfo[getcarid][cOwner], playername, true) != 0)
			{
			SendClientMessage(playerid, COLOR_GREY, "You don't own this car");
			return 1;
			}
			CarInfo[getcarid][cLocationx] = x;
			CarInfo[getcarid][cLocationy] = y;
			CarInfo[getcarid][cLocationz] = z;
			CarInfo[getcarid][cAngle] = a;
			format(sql, 256, "UPDATE cars SET park_x=%f, park_y=%f, park_z=%f, park_angle=%f WHERE id=%d", x, y, z, a, getcarid);
			samp_mysql_query(sql);
			//if (DEBUG) SQLLog(sql);
			format(string, sizeof(string), "~n~ You have parked your car in this location. ~n~");
			SendClientMessage(playerid, COLOR_WHITE, "You have parked your car in this position; it will respawn here.");
			//OnPropUpdate();
			OnPlayerUpdateZZ(playerid);
			return 1;
		}
		return 1;
	}
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)