Jump to content

توضيح كود الصوره و حل مشكله مود


aL.Kfo

Recommended Posts

مرحبا شباب

طلبين

الاول

شرح تركيب تايمر ع الكود و تكون الصوره تختفي بعد وقت محدد

function showClientImage() 
   guiCreateStaticImage( 690, 200, 100, 150, "imagename.png", false ) 
end 
addEventHandler( "onClientResourceStart", getResourceRootElement( getThisResource() ), showClientImage ) 
  
  
  

ثاني

تثبيت رسباون لتيم معين ولا مات م يخرج من الفريق ويكون مرتبط مع مود معين

مع توضيح بسييط

~~

Link to comment

function showClientImage() 
   Image = guiCreateStaticImage( 690, 200, 100, 150, "imagename.png", false ) 
end 
addEventHandler( "onClientResourceStart", getResourceRootElement( getThisResource() ), showClientImage ) 
  
  
setTimer ( 
            function ( ) 
             if ( guiGetVisible ( Image ) == true ) then 
               guiSetVisible ( Image, false ) 
         end 
       end 
     ,2000,0 
 ) 

# ملأحظةة : التأيمر مفتوح يعني كل الوقت الموجود ذا لو لقى الصصورةة موجودة يخفيها ...

# الططـلب الثاني :

Event: "onPlayerWasted"

spawnPlayer 
getPlayerTeam 
setPlayerTeam 

# مرتبط مع مود معين ؟ , ما فهمت

Link to comment
function showClientImage() 
   Image = guiCreateStaticImage( 690, 200, 100, 150, "imagename.png", false ) 
end 
addEventHandler( "onClientResourceStart", getResourceRootElement( getThisResource() ), showClientImage ) 
  
  
setTimer ( 
            function ( ) 
             if ( guiGetVisible ( Image ) == true ) then 
               guiSetVisible ( Image, false ) 
         end 
       end 
     ,2000,0 
 ) 

# ملأحظةة : التأيمر مفتوح يعني كل الوقت الموجود ذا لو لقى الصصورةة موجودة يخفيها ...

# الططـلب الثاني :

Event: "onPlayerWasted"

spawnPlayer 
getPlayerTeam 
setPlayerTeam 

# مرتبط مع مود معين ؟ , ما فهمت

كنت حاس م راح تفهمونها معي مود مثلا تروح تتوظف

بس للاسف لا متت تخرج من الوظيفه و ترجع ل الرسباون الاصلي

ابي م يخرج من الوظيفه وانا احدد لهم رسباون جديد

لين كنت بسوي هيكك

    Spawn = { 
    [1] = {902.20544, -1210.40332, 16.97656}, 
    [2] = {1727.4910888672, -1635.1076660156, 20.216451644897}, 
    } 
  

بس م توقت انها بتضبط و هل راح تضبط او لا

و بخصوص الصوره

انا كتبت قبل نفس م سويت انت بس كتبت

function mainFunction() 
        outputChatBox ("Instant text!") 
    setTimer ( function() 
        outputChatBox ( "5 second delay text!" ) 
    end, 5000, 1 ) 
end 

ليه م ضبط وش المشكله

Link to comment
function showClientImage() 
   Image = guiCreateStaticImage( 690, 200, 100, 150, "imagename.png", false ) 
end 
addEventHandler( "onClientResourceStart", getResourceRootElement( getThisResource() ), showClientImage ) 
  
  
setTimer ( 
            function ( ) 
             if ( guiGetVisible ( Image ) == true ) then 
               guiSetVisible ( Image, false ) 
         end 
       end 
     ,2000,0 
 ) 

# ملأحظةة : التأيمر مفتوح يعني كل الوقت الموجود ذا لو لقى الصصورةة موجودة يخفيها ...

# الططـلب الثاني :

Event: "onPlayerWasted"

spawnPlayer 
getPlayerTeam 
setPlayerTeam 

# مرتبط مع مود معين ؟ , ما فهمت

كنت حاس م راح تفهمونها معي مود مثلا تروح تتوظف

بس للاسف لا متت تخرج من الوظيفه و ترجع ل الرسباون الاصلي

ابي م يخرج من الوظيفه وانا احدد لهم رسباون جديد

ليت كنت بسوي هيكك

Spawn = {

[1] = {902.20544, -1210.40332, 16.97656},

[2] = {1727.4910888672, -1635.1076660156, 20.216451644897},

}

بس م توقت انها بتضبط و هل راح تضبط او لا

# طيب ما شفت وش عطيتكـ ؟

# حطيتك لك سسسبوان بـلير حط الأحداثيات اللي تبيها

# وبالنسسبة للجدول سهلة

سوي جدول .. واستخدم :

unpack 
math.random 

Link to comment

وش المشكله

حطيت 3 صور صار م يختفي الا وحده و الباقي يفضلون باقين

function showClientImage() 
   Image = guiCreateStaticImage( 690, 200, 100, 150, "R1.png", false ) 
   Image = guiCreateStaticImage( 400, 200, 100, 150, "R2.png", false ) 
   Image = guiCreateStaticImage( 200, 200, 100, 150, "R3.png", false ) 
  
end 
addEventHandler( "onClientResourceStart", getResourceRootElement( getThisResource() ), showClientImage ) 
  
  
setTimer ( 
            function ( ) 
             if ( guiGetVisible ( Image ) == true ) then 
               guiSetVisible ( Image, false ) 
  
         end 
       end 
     ,5000,0 
 ) 
  
  

جربت يمين يسار م ضبط

وش المشكله

Link to comment
  
function showClientImage() 
   Image = guiCreateStaticImage( 690, 200, 100, 150, "R1.png", false ) 
   Image2 = guiCreateStaticImage( 400, 200, 100, 150, "R2.png", false ) 
   Image3 = guiCreateStaticImage( 200, 200, 100, 150, "R3.png", false ) 
  
end 
addEventHandler( "onClientResourceStart", resourceRoot, showClientImage ) 
  
  
setTimer ( 
            function ( ) 
             if ( guiGetVisible ( Image ) == true or guiGetVisible( Image2 ) == true or guiGetVisible ( Image3 ) == true ) then 
               guiSetVisible ( Image, false ) 
               guiSetVisible ( Image2, false ) 
               guiSetVisible ( Image3, false ) 
         end 
       end 
     ,5000,0 
 ) 
  

Link to comment
  
function showClientImage() 
   Image = guiCreateStaticImage( 690, 200, 100, 150, "R1.png", false ) 
   Image2 = guiCreateStaticImage( 400, 200, 100, 150, "R2.png", false ) 
   Image3 = guiCreateStaticImage( 200, 200, 100, 150, "R3.png", false ) 
  
end 
addEventHandler( "onClientResourceStart", resourceRoot, showClientImage ) 
  
  
setTimer ( 
            function ( ) 
             if ( guiGetVisible ( Image ) == true or guiGetVisible( Image2 ) == true or guiGetVisible ( Image3 ) == true ) then 
               guiSetVisible ( Image, false ) 
               guiSetVisible ( Image2, false ) 
               guiSetVisible ( Image3, false ) 
         end 
       end 
     ,5000,0 
 ) 
  

لا هنت ي بعد حيي ضبط

ي ي ي ششتب :D

جعفر بششوف الفنكشات ولي باكك

Link to comment
function joinTime ( ) 
    setElementData ( source, "joinTime", getTickCount() ) -- Store the current tick count in the player's data with the key 'joinTime' 
end 
-- Make our 'joinTime' function be called when a player joins 
addEventHandler ( "onPlayerJoin", getRootElement(), joinTime ) 
  
function showJoinTime ( source, commandName, playerName ) 
    if ( playerName ) then -- see if a player was specified 
        thePlayer = getPlayerFromName ( playerName ) -- get the player element for the specified player 
        if ( thePlayer ) then -- if one was found... 
            local timeOnline = (getTickCount() - getElementData ( thePlayer, "joinTime" )) / 1000 -- calculates the time since join 
            outputChatBox ( getPlayerName ( thePlayer ).." joined "..timeOnline.." seconds ago", source ) -- output the player's join time 
        else 
            outputChatBox ( "Couldn't find '" .. playerName .. "'", source ) -- display an error 
        end 
    else 
        -- display when the player who used the function joined and inform how to see other people's join time 
        local timeOnline = (getTickCount() - getElementData ( source, "joinTime" )) / 1000 -- calculate the time since join 
        outputChatBox ( "You joined " ..timeOnline.." seconds ago", source ) 
        outputChatBox ( "Use 'join_time ' to see other people's join time", source ) 
    end 
end 
-- Add a console command joinTime, that takes an optional parameter of a player's name 
addCommandHandler ( "joinTime", showJoinTime ) 

وش اعدل هناا

Link to comment
function joinTime ( ) 
    setElementData ( source, "joinTime", getTickCount() ) -- Store the current tick count in the player's data with the key 'joinTime' 
end 
-- Make our 'joinTime' function be called when a player joins 
addEventHandler ( "onPlayerJoin", getRootElement(), joinTime ) 
  
function showJoinTime ( source, commandName, playerName ) 
    if ( playerName ) then -- see if a player was specified 
        thePlayer = getPlayerFromName ( playerName ) -- get the player element for the specified player 
        if ( thePlayer ) then -- if one was found... 
            local timeOnline = (getTickCount() - getElementData ( thePlayer, "joinTime" )) / 1000 -- calculates the time since join 
            outputChatBox ( getPlayerName ( thePlayer ).." joined "..timeOnline.." seconds ago", source ) -- output the player's join time 
        else 
            outputChatBox ( "Couldn't find '" .. playerName .. "'", source ) -- display an error 
        end 
    else 
        -- display when the player who used the function joined and inform how to see other people's join time 
        local timeOnline = (getTickCount() - getElementData ( source, "joinTime" )) / 1000 -- calculate the time since join 
        outputChatBox ( "You joined " ..timeOnline.." seconds ago", source ) 
        outputChatBox ( "Use 'join_time ' to see other people's join time", source ) 
    end 
end 
-- Add a console command joinTime, that takes an optional parameter of a player's name 
addCommandHandler ( "joinTime", showJoinTime ) 

وش اعدل هناا

# الحين فهمني وش تبي تسوي ؟

Link to comment

ولا واحد فيه سباون -_-

امسك بسويه لك

-- Wasted Police 
-- By Abo[s]hanab~> 
-- Server Side ! 
addEventHandler("onPlayerWasted",root,function() 
if ( getPlayerTeam(source) == getTeamFromName("Police") ) then 
spawnPlayer(source,x,y,z) 
end 
end) 

طبعا الحين وقت يموت الاعب يتاكد اذا كان في تيم Police يسوي له سباون

-- التعديلات

في سطر 6

غير

x,y,z

الى الاحداثيات اللي تبغاها

Link to comment

ولا واحد فيه سباون

-_-

امسك بسويه لك

-- Wasted Police
-- By Abo[s]hanab~>
-- Server Side !
addEventHandler("onPlayerWasted",root,function()
if ( getPlayerTeam(source) == getTeamFromName("Police") ) then
spawnPlayer(source,x,y,z)
end
end)

طبعا الحين وقت يموت الاعب يتاكد اذا كان في تيم Police يسوي له سباون

-- التعديلات

في سطر 6

غير

x,y,z

الى الاحداثيات اللي تبغاها

م ضبط

-- Wasted Police
-- By Abo[s]hanab~>
-- Server Side !
addEventHandler("onPlayerWasted",root,function()
if ( getPlayerTeam(source) == getTeamFromName("Police") ) then
spawnPlayer(source,1480,-1760,33.4296875)
end
end)

حطيت الكود في ملف

police-c.lua

اخر شي 8)

Link to comment

شوفه اخر شي كودك م ضبط سسيرفر

    markerpv = createMarker( 1566.9652099609, -1610.640625, 12.3828125, "cylinder", 2, 0, 0, 255, 255 ) 
  
     
    local vehicles = {} 
      
    function spawnVehp(id) 
        local x, y, z = getElementPosition(source) 
        if isElement(vehicles[source]) then destroyElement(vehicles[source]) end 
        vehicles[source] = createVehicle(id, x + 2, y, z) 
        warpPedIntoVehicle(source, vehicles[source]) 
    end 
    addEvent("CreVehicePv",true) 
    addEventHandler("CreVehicePv", root, spawnVehp) 
      
    addEventHandler("onPlayerQuit", root, 
    function() 
         if isElement(vehicles[source]) then 
              destroyElement(vehicles[source]) 
              vehicles[source] = nil 
         end 
    end) 
  
function showGUIpv(hitPlayer) 
    if hitPlayer and getElementType(hitPlayer) == "player" then 
        if ( getPlayerTeam ( hitPlayer ) == getTeamFromName ( "police" ) ) then 
            triggerClientEvent (hitPlayer,"showGUIpv",getRootElement(),hitPlayer) 
        else 
            warnText("vehicles for police only!",hitPlayer) 
        end 
    end 
end  
addEventHandler("onMarkerHit",markerpv,showGUIpv) 
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
function addPlayerCustomTag ( thePlayer, command, newTag ) 
    --Let's make sure the newTag param has been entered... 
    if ( newTag ) then 
        --Grab their current playername for saving. 
        local sPlayerNickname = getPlayerName ( thePlayer ) 
        --Create their new nickname with their tag 
        local sNewPlayerNickname = newTag .. " " .. sPlayerNickname 
  
        --Let's first load the element data, see if it's there already 
        --The reason for this is that if a player were to do /addtag twice, 
        --the tag would be prepended a second time 
        local sOldNick = getElementData( thePlayer, "tempdata.originalnick" ) 
        if ( sOldNick == false ) then 
            --Save their orignal nickname in their element data 
            setElementData ( thePlayer, "tempdata.originalnick", sPlayerNickname ) 
        end 
  
        --Set their new nickname globally 
        setPlayerName ( thePlayer, sNewPlayerNickname ) 
  
        --Tell them it's done 
        outputChatBox ( "Your new nickname has been set, to put it back to its original state you can use /deltag", thePlayer ) 
    else 
        --The newTag param was not entered, give an error message 
        outputChatBox ( "/addtag - Incorrect syntax, Correct: /addtag ", thePlayer ) 
    end 
end 
addCommandHandler ( "addtag", addPlayerCustomTag ) 
  
function removePlayerCustomTag ( thePlayer, command ) 
    --We first need to check that they have already used /addtag, let's do that now 
    local sOldNick = getElementData( thePlayer, "tempdata.originalnick" ) 
    if ( sOldNick ) then 
        --Great, they have a tag added, let's reset them 
  
        --First we will want to reset the element data back to its default (that being false) 
        setElementData ( thePlayer, "tempdata.originalnick", false ) 
  
        --Now set the client name back 
        setPlayerName( thePlayer, sOldNick ) 
  
        --Notify them 
        outputChatBox ( "Your old nickname has been set", thePlayer ) 
    end 
end 
addCommandHandler ( "deltag", removePlayerCustomTag ) 
  
  
  
  
  
  
  
-- Wasted Police 
-- By Abo[s]hanab~> 
-- Server Side ! 
addEventHandler("onPlayerWasted",root,function() 
if ( getPlayerTeam(source) == getTeamFromName("Police") ) then 
spawnPlayer(source,1480,-1760,33.4296875) 
end 
end) 

Link to comment
شوفه اخر شي كودك م ضبط سسيرفر
    markerpv = createMarker( 1566.9652099609, -1610.640625, 12.3828125, "cylinder", 2, 0, 0, 255, 255 ) 
  
     
    local vehicles = {} 
      
    function spawnVehp(id) 
        local x, y, z = getElementPosition(source) 
        if isElement(vehicles[source]) then destroyElement(vehicles[source]) end 
        vehicles[source] = createVehicle(id, x + 2, y, z) 
        warpPedIntoVehicle(source, vehicles[source]) 
    end 
    addEvent("CreVehicePv",true) 
    addEventHandler("CreVehicePv", root, spawnVehp) 
      
    addEventHandler("onPlayerQuit", root, 
    function() 
         if isElement(vehicles[source]) then 
              destroyElement(vehicles[source]) 
              vehicles[source] = nil 
         end 
    end) 
  
function showGUIpv(hitPlayer) 
    if hitPlayer and getElementType(hitPlayer) == "player" then 
        if ( getPlayerTeam ( hitPlayer ) == getTeamFromName ( "police" ) ) then 
            triggerClientEvent (hitPlayer,"showGUIpv",getRootElement(),hitPlayer) 
        else 
            warnText("vehicles for police only!",hitPlayer) 
        end 
    end 
end  
addEventHandler("onMarkerHit",markerpv,showGUIpv) 
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
function addPlayerCustomTag ( thePlayer, command, newTag ) 
    --Let's make sure the newTag param has been entered... 
    if ( newTag ) then 
        --Grab their current playername for saving. 
        local sPlayerNickname = getPlayerName ( thePlayer ) 
        --Create their new nickname with their tag 
        local sNewPlayerNickname = newTag .. " " .. sPlayerNickname 
  
        --Let's first load the element data, see if it's there already 
        --The reason for this is that if a player were to do /addtag twice, 
        --the tag would be prepended a second time 
        local sOldNick = getElementData( thePlayer, "tempdata.originalnick" ) 
        if ( sOldNick == false ) then 
            --Save their orignal nickname in their element data 
            setElementData ( thePlayer, "tempdata.originalnick", sPlayerNickname ) 
        end 
  
        --Set their new nickname globally 
        setPlayerName ( thePlayer, sNewPlayerNickname ) 
  
        --Tell them it's done 
        outputChatBox ( "Your new nickname has been set, to put it back to its original state you can use /deltag", thePlayer ) 
    else 
        --The newTag param was not entered, give an error message 
        outputChatBox ( "/addtag - Incorrect syntax, Correct: /addtag ", thePlayer ) 
    end 
end 
addCommandHandler ( "addtag", addPlayerCustomTag ) 
  
function removePlayerCustomTag ( thePlayer, command ) 
    --We first need to check that they have already used /addtag, let's do that now 
    local sOldNick = getElementData( thePlayer, "tempdata.originalnick" ) 
    if ( sOldNick ) then 
        --Great, they have a tag added, let's reset them 
  
        --First we will want to reset the element data back to its default (that being false) 
        setElementData ( thePlayer, "tempdata.originalnick", false ) 
  
        --Now set the client name back 
        setPlayerName( thePlayer, sOldNick ) 
  
        --Notify them 
        outputChatBox ( "Your old nickname has been set", thePlayer ) 
    end 
end 
addCommandHandler ( "deltag", removePlayerCustomTag ) 
  
  
  
  
  
  
  
-- Wasted Police 
-- By Abo[s]hanab~> 
-- Server Side ! 
addEventHandler("onPlayerWasted",root,function() 
if ( getPlayerTeam(source) == getTeamFromName("Police") ) then 
spawnPlayer(source,1480,-1760,33.4296875) 
end 
end) 

    markerpv = createMarker( 1566.9652099609, -1610.640625, 12.3828125, "cylinder", 2, 0, 0, 255, 255 ) 
  
     
    local vehicles = {} 
      
    function spawnVehp(id) 
        local x, y, z = getElementPosition(source) 
        if isElement(vehicles[source]) then destroyElement(vehicles[source]) end 
        vehicles[source] = createVehicle(id, x + 2, y, z) 
        warpPedIntoVehicle(source, vehicles[source]) 
    end 
    addEvent("CreVehicePv",true) 
    addEventHandler("CreVehicePv", root, spawnVehp) 
      
    addEventHandler("onPlayerQuit", root, 
    function() 
         if isElement(vehicles[source]) then 
              destroyElement(vehicles[source]) 
              vehicles[source] = nil 
         end 
    end) 
  
function showGUIpv(hitPlayer) 
    if hitPlayer and getElementType(hitPlayer) == "player" then 
        if ( getPlayerTeam ( hitPlayer ) == getTeamFromName ( "police" ) ) then 
            triggerClientEvent (hitPlayer,"showGUIpv",getRootElement(),hitPlayer) 
        else 
            warnText("vehicles for police only!",hitPlayer) 
        end 
    end 
end  
addEventHandler("onMarkerHit",markerpv,showGUIpv) 
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
function addPlayerCustomTag ( thePlayer, command, newTag ) 
    --Let's make sure the newTag param has been entered... 
    if ( newTag ) then 
        --Grab their current playername for saving. 
        local sPlayerNickname = getPlayerName ( thePlayer ) 
        --Create their new nickname with their tag 
        local sNewPlayerNickname = newTag .. " " .. sPlayerNickname 
  
        --Let's first load the element data, see if it's there already 
        --The reason for this is that if a player were to do /addtag twice, 
        --the tag would be prepended a second time 
        local sOldNick = getElementData( thePlayer, "tempdata.originalnick" ) 
        if ( sOldNick == false ) then 
            --Save their orignal nickname in their element data 
            setElementData ( thePlayer, "tempdata.originalnick", sPlayerNickname ) 
        end 
  
        --Set their new nickname globally 
        setPlayerName ( thePlayer, sNewPlayerNickname ) 
  
        --Tell them it's done 
        outputChatBox ( "Your new nickname has been set, to put it back to its original state you can use /deltag", thePlayer ) 
    else 
        --The newTag param was not entered, give an error message 
        outputChatBox ( "/addtag - Incorrect syntax, Correct: /addtag ", thePlayer ) 
    end 
end 
addCommandHandler ( "addtag", addPlayerCustomTag ) 
  
function removePlayerCustomTag ( thePlayer, command ) 
    --We first need to check that they have already used /addtag, let's do that now 
    local sOldNick = getElementData( thePlayer, "tempdata.originalnick" ) 
    if ( sOldNick ) then 
        --Great, they have a tag added, let's reset them 
  
        --First we will want to reset the element data back to its default (that being false) 
        setElementData ( thePlayer, "tempdata.originalnick", false ) 
  
        --Now set the client name back 
        setPlayerName( thePlayer, sOldNick ) 
  
        --Notify them 
        outputChatBox ( "Your old nickname has been set", thePlayer ) 
    end 
end 
addCommandHandler ( "deltag", removePlayerCustomTag ) 
  
  
  
  
  
  
  
  
addEventHandler("onPlayerWasted",root,function() 
if ( getPlayerTeam(source) == getTeamFromName("Police") ) then 
setTimer(spawnPlayer,1000,0,source,1480,-1760,33.4296875) 
end 
end) 

Link to comment

يوم ياخذ الوظيفة يكون بتيم Police ?

اي لا اخذت بوليس يطلع في تاب لكن اذا م كان احد ماخذ الوظيفه م يطلع لا في الوحه ولا تاب

صوره ل تاب

http://im38.gulfup.com/Ih6Fd.bmp

ع العموم م قصصرت ي ششنب كفيت وووفيت و زي كم قلت لك فوق اسم ع مسمى

وقسم لو فيه مثلكم 2 كان الكل مبرمج ذا بست زحف مانستر جعفر احمد 1234 ابو ششنب :shock:

وطبعا فيه ناس كفو بس معد صارو يخشون مثل اوسامه مستر سعد و ناسي من بعد

والاي كفو و نسيت اسمه يعذرني :D

وسسلام عليكم تمت الافاده

Edited by Guest
Link to comment

جرب

  
Timer = { }; 
  
addEventHandler ( "onPlayerWasted", root, function ( ) 
if ( getPlayerTeam ( source ) == getTeamFromName ( "Police" ) ) then 
  if isTimer ( Timer [ source ] ) then killTimer ( Timer [ source ] ) Timer [ source ] = nil end 
       Timer [ source ] = setTimer ( spawnPlayer, 1000, 1, source, x, y, z, 0, getElementModel ( source ), 0, 0, getTeamFromName ( "Police" )  ) 
    end 
end 
) 

Link to comment
جرب
  
Timer = { }; 
  
addEventHandler ( "onPlayerWasted", root, function ( ) 
if ( getPlayerTeam ( source ) == getTeamFromName ( "Police" ) ) then 
  if isTimer ( Timer [ source ] ) then killTimer ( Timer [ source ] ) Timer [ source ] = nil end 
       Timer [ source ] = setTimer ( spawnPlayer, 1000, 1, source, x, y, z, 0, getElementModel ( source ), 0, 0, getTeamFromName ( "Police" )  ) 
    end 
end 
) 

ضبط تمام بس اول شي يودي لرسباون الااي ابي ثم فيه شي يجبره و ينقله ل الرسباون الاصلي تبع العبه

قفلت الفري ونفس الششي

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...