أتوقع حركتك ذي ممكن تسبب مشكلة للحفظ أو أنه اللي مسوي المود مستخدمها بحاجة ثانية عموماً الصح زي كذا وجربتها أول
كلنت
addEventHandler( 'onClientRender', root, function()
for i, v in ipairs( getElementsByType( 'marker', getResourceRootElement(), true ) ) do
if getElementData( v, 'HS_INFO' ) then
local x, y, z = getElementPosition( v );
local cx, cy, cz = getCameraMatrix();
if isLineOfSightClear( cx, cy, cz, x, y, z, false, false, false, false, false, false, false, v ) then
local dist = getDistanceBetweenPoints3D( cx, cy, cz, x, y, z );
if dist >= 5 and dist <= 15 then
local px, py = getScreenFromWorldPosition( x, y, z + 1.8, 0.06 );
if px then
local owner = getElementData( v, 'HS_INFO' )[7];
local price = getElementData( v, 'HS_INFO' )[6];
local ownerName = getElementData( v, 'HS_INFO' )[10];
local r, g, b = getMarkerColor( v );
if r == 0 and g == 153 and b == 255 then
r, g, b = 255, 255, 255;
end;
if owner then
if owner == '' then owner = 'none'; end;
dxDrawText( 'المالك: '..ownerName, px + 1, py + scY/38, px + 1, py + 1, tocolor( 0, 0, 0, 255 ), 1, 'default-bold', 'center', 'center', false, false );
dxDrawText( 'المالك: '..ownerName, px, py + scY/38, px, py, tocolor( 255, 255, 255, 255 ), 1, 'default-bold', 'center', 'center', false, false );
dxDrawText( 'السعر: $ '..tostring( price ), px + 1, py + scY/15, px + 1, py + 1, tocolor( 0, 0, 0, 255 ), 1, 'default-bold', 'center', 'center', false, false );
dxDrawText( 'السعر: $ '..tostring( price ), px, py + scY/15, px, py, tocolor( 255, 255, 255, 255 ), 1, 'default-bold', 'center', 'center', false, false );
dxDrawImage( px-l_w/2, py - scY/17, l_w, l_h, 'images/script/house_.png', 0, 0, 0, tocolor( r, g, b, 255 ) );
end;
end;
end;
end;
end;
end;
end );
function getHouseByID( ID )
for i, v in ipairs( getElementsByType( 'marker', getResourceRootElement() ) ) do
if getElementData( v, 'HS_INFO' ) then
if getElementData( v, 'HS_INFO' )[9] == ID then
return v;
end;
end;
end;
return false;
end;
سيرفر
addEvent( 'HOUSE_Buy', true );
addEventHandler( 'HOUSE_Buy', root, function( cost, key )
local accName = getAccountName( getPlayerAccount( client ) );
local houseCounter = 0;
for i, v in ipairs( getElementsByType( 'marker', getResourceRootElement() ) ) do
if getElementData( v, 'HS_INFO' ) then
local owner = getElementData( v, 'HS_INFO' )[7];
if owner == accName then
houseCounter = houseCounter + 1;
end;
end;
end;
if houseCounter >= tonumber( get( 'playerHouseCounter' ) ) then
outputChatBox( '* You can not buy more than #00FF00'..get( 'playerHouseCounter' )..' house(-s)#FF3324 at the same time!', client, 255, 51, 36, true );
setPedFrozen( client, false );
return false;
end;
if getPlayerMoney( client ) >= tonumber( cost ) then
outputChatBox( '* الرقم السري الرجاء عد نسيانه to #00FF00'..key, client, 255, 51, 36, true );
outputChatBox( '* تهانينا تم شراء البيت بنجاح!', client, 255, 255, 0 );
sql.Query( "UPDATE house_data SET owner = '"..accName.."', key = '"..key.."' WHERE ID = ?", getElementData( client, 'mrk_in' ) );
takePlayerMoney( client, cost );
local mrk = getHouseByID( getElementData( client, 'mrk_in' ) );
local t = {};
for i = 1, 6 do
t[i] = getElementData( mrk, 'HS_INFO' )[i];
end;
t[7] = accName;
t[8] = key;
t[9] = getElementData( client, 'mrk_in' );
t[10] = getPlayerName( client );
setElementData( mrk, 'HS_INFO', { t[1], t[2], t[3], t[4], t[5], t[6], t[7], t[8], t[9], t[10] } );
setMarkerColor( mrk, 255, 51, 36, 150 );
local exitMrkTable = allHousesTable["ID"..tostring(t[9])]
allHousesTable["ID"..tostring(t[9])] = { exitMrkTable[1], exitMrkTable[2], exitMrkTable[3], exitMrkTable[4], accName };
setTimer( onPlayerHouseMarkerHit, 50, 1, client, mrk, true );
else
outputChatBox( '* ليس لديك مال كافي لشراء البيت!', client, 255, 51, 36 );
onPlayerHouseMarkerHit( client, getHouseByID( getElementData( client, 'mrk_in' ) ), true );
end;
end );