Jump to content

What I Wil Use ?


Recommended Posts

Hi All

what function I wil use it

for to do this bomb when I press in button open window

and I do the window

and in this window get all player's name

it's in the shop see this picture -_-"

GbQCp.png

and this picture what I wil use function in it

it's put on u bomb and after 5 sec she wil Explode

this is the picture

1Bycy.png

Link to comment

You want to set player's name in gridlist? right?

and you want to create explosion?

if so :

getElementsByType -- getAllPlayer's 
guiGridListClear -- To Clear The Grid From Spam Name's 
guiGridListAddRow -- You should add the row 
guiGridListSetItemText -- To set player's name in the list 
getPlayerName -- GetPlayer name fucntion 
  
and do it like that : 
  
for _,v in ipairs(getElement.........); 

and use to create the explosion :

createExplosion 

I Hope that you understand what i said .

Link to comment
You want to set player's name in gridlist? right?

and you want to create explosion?

if so :

getElementsByType -- getAllPlayer's 
guiGridListClear -- To Clear The Grid From Spam Name's 
guiGridListAddRow -- You should add the row 
guiGridListSetItemText -- To set player's name in the list 
getPlayerName -- GetPlayer name fucntion 
  
and do it like that : 
  
for _,v in ipairs(getElement.........); 

and use to create the explosion :

createExplosion 

I Hope that you understand what i said .

I understand all but the

getPlayerName 

I did't understand

how to put the name player in the Row

and I create

guiGridListSetItemText 
Link to comment
Check this out :

wil be like this ?

ChangeGridListItemToPlayersName

GUIEditor = { 
    gridlist = {}, 
    button = {}, 
} 
wnd = guiCreateWindow(434, 133, 254, 304, "Window Explosion !", false) 
guiWindowSetSizable(wnd, false) 
guiSetAlpha(wnd, 0.90) 
GridList = guiCreateGridList(9, 19, 221, 226, false, wnd) 
guiGridListAddColumn(GridList, "Name", 0.9) 
for i = 1, 30 do 
    guiGridListAddRow(GridList) 
end 
guiGridListSetItemText(GridList, 0, 1, "-", false, false) 
guiGridListSetItemText(GridList, 1, 1, "-", false, false) 
guiGridListSetItemText(GridList, 2, 1, "-", false, false) 
guiGridListSetItemText(GridList, 3, 1, "-", false, false) 
guiGridListSetItemText(GridList, 4, 1, "-", false, false) 
guiGridListSetItemText(GridList, 5, 1, "-", false, false) 
guiGridListSetItemText(GridList, 6, 1, "-", false, false) 
guiGridListSetItemText(GridList, 7, 1, "-", false, false) 
guiGridListSetItemText(GridList, 8, 1, "-", false, false) 
guiGridListSetItemText(GridList, 9, 1, "-", false, false) 
guiGridListSetItemText(GridList, 10, 1, "-", false, false) 
guiGridListSetItemText(GridList, 11, 1, "-", false, false) 
guiGridListSetItemText(GridList, 12, 1, "-", false, false) 
guiGridListSetItemText(GridList, 13, 1, "-", false, false) 
guiGridListSetItemText(GridList, 14, 1, "-", false, false) 
guiGridListSetItemText(GridList, 15, 1, "-", false, false) 
guiGridListSetItemText(GridList, 16, 1, "-", false, false) 
guiGridListSetItemText(GridList, 17, 1, "-", false, false) 
guiGridListSetItemText(GridList, 18, 1, "-", false, false) 
guiGridListSetItemText(GridList, 19, 1, "-", false, false) 
guiGridListSetItemText(GridList, 20, 1, "-", false, false) 
guiGridListSetItemText(GridList, 21, 1, "-", false, false) 
guiGridListSetItemText(GridList, 22, 1, "-", false, false) 
guiGridListSetItemText(GridList, 23, 1, "-", false, false) 
guiGridListSetItemText(GridList, 24, 1, "-", false, false) 
guiGridListSetItemText(GridList, 25, 1, "-", false, false) 
guiGridListSetItemText(GridList, 26, 1, "-", false, false) 
guiGridListSetItemText(GridList, 27, 1, "-", false, false) 
guiGridListSetItemText(GridList, 28, 1, "-", false, false) 
guiGridListSetItemText(GridList, 29, 1, "-", false, false) 
GUIEditor.button[1] = guiCreateButton(14, 253, 221, 36, "Explosion", false, wnd) 
  
changeGridListItemToPlayersName = function ( GridList, Column ) 
    if GridList and Column then  
        if getElementType ( GridList ) == "gui-gridlist" then 
            if guiGridListClear ( GridList ) then 
                for i, v in next, getElementsByType ( "player" ) do   
                    guiGridListSetItemText ( GridList, guiGridListAddRow ( GridList ), Column, getPlayerName ( v ), false, false ); 
                end; 
            end; 
        end; 
    end; 
end; 
  
Link to comment

changeGridListItemToPlayersName = function ( GridList, Column ) 
    if GridList and Column then  
        if getElementType ( GridList ) == "gui-gridlist" then 
            if guiGridListClear ( GridList ) then 
                for i, v in next, getElementsByType ( "player" ) do   
                    guiGridListSetItemText ( GridList, guiGridListAddRow ( GridList ), Column, getPlayerName ( v ), false, false ); 
                end; 
            end; 
        end; 
    end; 
end; 
  
  
  
GUIEditor = { 
    gridlist = {}, 
    button = {}, 
} 
wnd = guiCreateWindow(434, 133, 254, 304, "Window Explosion !", false) 
guiWindowSetSizable(wnd, false) 
guiSetAlpha(wnd, 0.90) 
GridList = guiCreateGridList(9, 19, 221, 226, false, wnd) 
guiGridListAddColumn(GridList, "Name", 0.9) 
changeGridListItemToPlayersName(GridList,1) 
GUIEditor.button[1] = guiCreateButton(14, 253, 221, 36, "Explosion", false, wnd) 
  
  
  

Now you can see player's name in the list but u can't add "-" why? because the add player name need the column ._. .

Link to comment
changeGridListItemToPlayersName = function ( GridList, Column ) 
    if GridList and Column then  
        if getElementType ( GridList ) == "gui-gridlist" then 
            if guiGridListClear ( GridList ) then 
                for i, v in next, getElementsByType ( "player" ) do   
                    guiGridListSetItemText ( GridList, guiGridListAddRow ( GridList ), Column, getPlayerName ( v ), false, false ); 
                end; 
            end; 
        end; 
    end; 
end; 
  
  
  
GUIEditor = { 
    gridlist = {}, 
    button = {}, 
} 
wnd = guiCreateWindow(434, 133, 254, 304, "Window Explosion !", false) 
guiWindowSetSizable(wnd, false) 
guiSetAlpha(wnd, 0.90) 
GridList = guiCreateGridList(9, 19, 221, 226, false, wnd) 
guiGridListAddColumn(GridList, "Name", 0.9) 
changeGridListItemToPlayersName(GridList,1) 
GUIEditor.button[1] = guiCreateButton(14, 253, 221, 36, "Explosion", false, wnd) 
  
  
  

Now you can see player's name in the list but u can't add "-" why? because the add player name need the column ._. .

so now I don't need the

guiGridListSetItemText 

Link to comment

is my code now server is true?

Client Side!

changeGridListItemToPlayersName = function ( GridList, Column ) 
  
    if GridList and Column then  
  
        if getElementType ( GridList ) == "gui-gridlist" then 
  
            if guiGridListClear ( GridList ) then 
  
                for i, v in next, getElementsByType ( "player" ) do   
  
                    guiGridListSetItemText ( GridList, guiGridListAddRow ( GridList ), Column, getPlayerName ( v ), false, false ); 
  
                end; 
  
            end; 
  
        end; 
  
    end; 
  
end; 
  
  
  
  
  
  
  
GUIEditor = { 
  
    gridlist = {}, 
  
    button = {}, 
  
} 
  
wnd = guiCreateWindow(434, 133, 254, 304, "Window Explosion !", false) 
  
guiWindowSetSizable(wnd, false) 
  
guiSetAlpha(wnd, 0.90) 
  
GridList = guiCreateGridList(9, 19, 221, 226, false, wnd) 
  
guiGridListAddColumn(GridList, "Name", 0.9) 
  
changeGridListItemToPlayersName(GridList,1) 
  
Explosion = guiCreateButton(14, 253, 221, 36, "Explosion", false, wnd) 
  
  
     addEventHandler("onClientGUIClick", root, 
     function() 
         if (source == NameButtonShop) then 
        guiSetVisible ( wnd, true ) 
        showCursor(true) 
        guiSetInputEnabled(true) 
    end 
end) 
      
addEventHandler("onClientGUIClick", root, 
    function() 
        if (source == Explosion) then 
        triggerServerEvent("Explosion",localPlayer()) 
         guiSetVisible ( wnd, false ) 
         showCursor(false) 
         guiSetInputEnabled(false) 
     end 
 end) 
         
  

Server Side !

addEvent("Explosion", true) 
 addEventHandler("Explosion", root, 
 function () 
     for k,v in ipairs(getElementsByType("player"))do 
     local x, y, z = getElementPosition ( source ) 
     createExplosion ( x , y , z , 0 ,nil , source ) 
 end 
 end) 
  
  
Link to comment

-- Client Side --

changeGridListItemToPlayersName = function ( GridList, Column ) 
    if GridList and Column then  
        if getElementType ( GridList ) == "gui-gridlist" then 
            if guiGridListClear ( GridList ) then 
                for i, v in next, getElementsByType ( "player" ) do   
                    guiGridListSetItemText ( GridList, guiGridListAddRow ( GridList ), Column, getPlayerName ( v ), false, false ); 
                end; 
            end; 
        end; 
    end; 
end; 
  
  
  
  
wnd = guiCreateWindow(434, 133, 254, 304, "Window Explosion !", false); 
guiWindowSetSizable(wnd, false); 
guiSetAlpha(wnd, 0.90); 
GridList = guiCreateGridList(9, 19, 221, 226, false, wnd); 
guiGridListAddColumn(GridList, "Name", 0.9); 
changeGridListItemToPlayersName(GridList,1); 
Explosion = guiCreateButton(14, 253, 221, 36, "Explosion", false, wnd); 
  
  
addEventHandler("onClientGUIClick",Explosion, 
    function ( ) 
local Name = guiGridListGetItemText(GridList, guiGridListGetSelectedItem(GridList), 1); 
local Who = getPlayerFromName ( Name ); 
     if guiGridListGetSelectedItem(GridList) == -1 then return outputChatBox("* Please Select Player!!",255,0,0,true); end 
        triggerServerEvent("Explosion",localPlayer,Who); 
         guiSetVisible ( wnd, false ); 
         showCursor(false); 
    end,false); 

-- Server Side --

addEvent("Explosion",true); 
addEventHandler("Explosion",getRootElement(), 
function ( Who ) 
    local x,y,z = getElementPosition ( Who ); 
            createExplosion ( x,y,z,10,Who ); 
        outputChatBox("* You have been blown up by [#0000FF"..getPlayerName(source).."#FFFF00] ",Who,255,255,0,true); 
        outputChatBox("* The Player ["..getPlayerName(Who).."] been successfully blow up!",source,0,255,0,true); 
    end 
); 

Try it .

Link to comment
-- Client Side --

changeGridListItemToPlayersName = function ( GridList, Column ) 
    if GridList and Column then  
        if getElementType ( GridList ) == "gui-gridlist" then 
            if guiGridListClear ( GridList ) then 
                for i, v in next, getElementsByType ( "player" ) do   
                    guiGridListSetItemText ( GridList, guiGridListAddRow ( GridList ), Column, getPlayerName ( v ), false, false ); 
                end; 
            end; 
        end; 
    end; 
end; 
  
  
  
  
wnd = guiCreateWindow(434, 133, 254, 304, "Window Explosion !", false); 
guiWindowSetSizable(wnd, false); 
guiSetAlpha(wnd, 0.90); 
GridList = guiCreateGridList(9, 19, 221, 226, false, wnd); 
guiGridListAddColumn(GridList, "Name", 0.9); 
changeGridListItemToPlayersName(GridList,1); 
Explosion = guiCreateButton(14, 253, 221, 36, "Explosion", false, wnd); 
  
  
addEventHandler("onClientGUIClick",Explosion, 
    function ( ) 
local Name = guiGridListGetItemText(GridList, guiGridListGetSelectedItem(GridList), 1); 
local Who = getPlayerFromName ( Name ); 
     if guiGridListGetSelectedItem(GridList) == -1 then return outputChatBox("* Please Select Player!!",255,0,0,true); end 
        triggerServerEvent("Explosion",localPlayer,Who); 
         guiSetVisible ( wnd, false ); 
         showCursor(false); 
    end,false); 

-- Server Side --

addEvent("Explosion",true); 
addEventHandler("Explosion",getRootElement(), 
function ( Who ) 
    local x,y,z = getElementPosition ( Who ); 
            createExplosion ( x,y,z,10,Who ); 
        outputChatBox("* You have been blown up by [#0000FF"..getPlayerName(source).."#FFFF00] ",Who,255,255,0,true); 
        outputChatBox("* The Player ["..getPlayerName(Who).."] been successfully blow up!",source,0,255,0,true); 
    end 
); 

Try it .

thanx I wil try it now

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...