Evil-Cod3r Posted February 10, 2012 Share Posted February 10, 2012 Hi all iam try Making a window with Players Name if Player Select a Player He see his Level and Exp GUIEditor_Window = {} GUIEditor_Label = {} GUIEditor_Grid = {} GUIEditor_Image = {} GUIEditor_Window[1] = guiCreateWindow(423,220,477,311,"Level_System v3.0 ",false) guiWindowSetMovable(GUIEditor_Window[1],false) guiWindowSetSizable(GUIEditor_Window[1],false) GUIEditor_Grid[1] = guiCreateGridList(9,21,264,281,false,GUIEditor_Window[1]) guiGridListSetSelectionMode(GUIEditor_Grid[1],2) for id, playeritem in ipairs(getElementsByType("player")) do local row = guiGridListAddRow ( playerList ) guiGridListSetItemText ( playerList, row, column, getPlayerName ( playeritem ), false, false ) guiGridListAddColumn(GUIEditor_Grid[1],"Players",0.2) for i = 1, 1 do guiGridListAddRow(GUIEditor_Grid[1]) end GUIEditor_Label[1] = guiCreateLabel(286,43,144,23,"Level :",false,GUIEditor_Window[1]) guiLabelSetColor(GUIEditor_Label[1],0,255,0) guiSetFont(GUIEditor_Label[1],"clear-normal") GUIEditor_Label[2] = guiCreateLabel(284,95,102,21,"EXP:",false,GUIEditor_Window[1]) guiLabelSetColor(GUIEditor_Label[2],0,0,255) guiSetFont(GUIEditor_Label[2],"clear-normal") GUIEditor_Image[1] = guiCreateStaticImage(266,152,182,146,"images/mtalogo.png",false,GUIEditor_Window[1]) and this small script wont work local x,y = guiGetScreenSize() function headshot ( killer, killerweapon, bodypart ) if ( killer ) and ( killer ~= source ) then local image = guiCreateStaticImage ( x/4, y/5.8, 399,169, "SAMP"..math.random(1,4)..".png", false ) guiSetVisible ( image, false ) guiSetVisible ( image, true ) guiStaticImageLoadImage(image, "SAMP"..math.random(1,4)..".png") setTimer (guiSetVisible, 4000, 1, image, false ) end addEventHandler ( "onClientPlayerWasted", getRootElement(), headshot ) addEventHandler("onPlayerWasted", root, function ( ammo, killer, killerweapon, bodypart ) if ( killer ) and ( killer ~= source ) then if (bodypart == 9) then outputChatBox("**OWned->HeadShot !!!+$50**",killer,255,255,0) owned = guiCreateStaticImage(0.45,0.6722,0.0917,0.0533,"images/owned.png",true) guiSetVisible(blood, false) guiSetVisible(blood, true) setTimer (guiSetVisible, 4000, 1, blood, false ) triggerClientEvent(killer,"playWastedSound",killer,"sounds/2.ogg") givePlayerMoney ( killer, 50 ) end else outputChatBox("**Woops Your Dead Try Next Time Noob ! - $5**",source,255,255,0) triggerClientEvent(source,"playWastedSound",source,"sounds/3.ogg") takePlayerMoney( source, 5 ) end end) just these tow and i well uplode my gamemode and crdits to who help me Link to comment
drk Posted February 10, 2012 Share Posted February 10, 2012 Window with player names: GUIEditor_Window[1] = guiCreateWindow(423,220,477,311,"Level_System v3.0 ",false) guiWindowSetMovable(GUIEditor_Window[1],false) guiWindowSetSizable(GUIEditor_Window[1],false) GUIEditor_Grid[1] = guiCreateGridList(9,21,264,281,false,GUIEditor_Window[1]) guiGridListSetSelectionMode(GUIEditor_Grid[1],2) local row = guiGridListAddRow ( playerList ) local col = guiGridListAddColumn(GUIEditor_Grid[1],"Players",0.2) GUIEditor_Label[1] = guiCreateLabel(286,43,144,23,"Level :",false,GUIEditor_Window[1]) guiLabelSetColor(GUIEditor_Label[1],0,255,0) guiSetFont(GUIEditor_Label[1],"clear-normal") GUIEditor_Label[2] = guiCreateLabel(284,95,102,21,"EXP:",false,GUIEditor_Window[1]) guiLabelSetColor(GUIEditor_Label[2],0,0,255) guiSetFont(GUIEditor_Label[2],"clear-normal") GUIEditor_Image[1] = guiCreateStaticImage(266,152,182,146,"images/mtalogo.png",false,GUIEditor_Window[1]) for i, players in ipairs(getElementsByType('player')) do guiGridListSetItemText(GUIEditor_Grid[1],row,col,getPlayerName(players),false,false) end addEventHandler('onClientGUIClick',root, function() if source == GUIEditor_Grid[1] then local theRow, theCol = guiGridListGetSelectedItem(source) if theRow and theCol and theRow ~= -1 and theCol ~= -1 then local name = guiGridListGetItemText(source,theRow, theCol) --now use your head and script all, because we don't have the level and exp system then we can't make all for you end end) Headshot system: Client side: local x,y = guiGetScreenSize() function headshot ( killer, killerweapon, bodypart ) if ( killer ) and ( killer ~= source ) then local image = guiCreateStaticImage ( x/4, y/5.8, 399,169, "SAMP"..math.random(1,4)..".png", false ) setTimer (guiSetVisible, 4000, 1, image, false ) end end addEventHandler ( "onClientPlayerWasted", getRootElement(), headshot ) Server side: addEventHandler("onPlayerWasted", root, function ( ammo, killer, killerweapon, bodypart ) if ( killer ) and ( killer ~= source ) then if (bodypart == 9) then outputChatBox("**OWned->HeadShot !!!+$50**",killer,255,255,0) local owned = guiCreateStaticImage(0.45,0.6722,0.0917,0.0533,"images/owned.png",true) setTimer (guiSetVisible, 4000, 1, owned, false ) triggerClientEvent(killer,"playWastedSound",killer,"sounds/2.ogg") givePlayerMoney ( killer, 50 ) end else outputChatBox("**Woops Your Dead Try Next Time Noob ! - $5**",killer,255,255,0) triggerClientEvent(source,"playWastedSound",killer,"sounds/3.ogg") takePlayerMoney( killer, 5 ) end end) Link to comment
Evil-Cod3r Posted February 10, 2012 Author Share Posted February 10, 2012 function me2 () GUIEditor_Window[1] = guiCreateWindow(423,220,477,311,"Level_System v3.0 ",false) guiWindowSetMovable(GUIEditor_Window[1],false) guiWindowSetSizable(GUIEditor_Window[1],false) GUIEditor_Grid[1] = guiCreateGridList(9,21,264,281,false,GUIEditor_Window[1]) guiGridListSetSelectionMode(GUIEditor_Grid[1],2) local row = guiGridListAddRow ( playerList ) local col = guiGridListAddColumn(GUIEditor_Grid[1],"Players",0.2) GUIEditor_Label[1] = guiCreateLabel(286,43,144,23,"Level :",false,GUIEditor_Window[1]) guiLabelSetColor(GUIEditor_Label[1],0,255,0) guiSetFont(GUIEditor_Label[1],"clear-normal") GUIEditor_Label[2] = guiCreateLabel(284,95,102,21,"EXP:",false,GUIEditor_Window[1]) guiLabelSetColor(GUIEditor_Label[2],0,0,255) guiSetFont(GUIEditor_Label[2],"clear-normal") GUIEditor_Image[1] = guiCreateStaticImage(266,152,182,146,"images/mtalogo.png",false,GUIEditor_Window[1]) for i, players in ipairs(getElementsByType('player')) do guiGridListSetItemText(GUIEditor_Grid[1],row,col,getPlayerName(players),false,false) end addEventHandler('onClientGUIClick',root, function() if source == GUIEditor_Grid[1] then local theRow, theCol = guiGridListGetSelectedItem(source) if theRow and theCol and theRow ~= -1 and theCol ~= -1 then local name = guiGridListGetItemText(source,theRow, theCol) end) dont work its say unexpected symbol near ')' Link to comment
drk Posted February 10, 2012 Share Posted February 10, 2012 lol? Only copy mine and test, you created a function and dont closed it. GUIEditor_Window[1] = guiCreateWindow(423,220,477,311,"Level_System v3.0 ",false) guiWindowSetMovable(GUIEditor_Window[1],false) guiWindowSetSizable(GUIEditor_Window[1],false) GUIEditor_Grid[1] = guiCreateGridList(9,21,264,281,false,GUIEditor_Window[1]) guiGridListSetSelectionMode(GUIEditor_Grid[1],2) local row = guiGridListAddRow ( playerList ) local col = guiGridListAddColumn(GUIEditor_Grid[1],"Players",0.2) GUIEditor_Label[1] = guiCreateLabel(286,43,144,23,"Level :",false,GUIEditor_Window[1]) guiLabelSetColor(GUIEditor_Label[1],0,255,0) guiSetFont(GUIEditor_Label[1],"clear-normal") GUIEditor_Label[2] = guiCreateLabel(284,95,102,21,"EXP:",false,GUIEditor_Window[1]) guiLabelSetColor(GUIEditor_Label[2],0,0,255) guiSetFont(GUIEditor_Label[2],"clear-normal") GUIEditor_Image[1] = guiCreateStaticImage(266,152,182,146,"images/mtalogo.png",false,GUIEditor_Window[1]) for i, players in ipairs(getElementsByType('player')) do guiGridListSetItemText(GUIEditor_Grid[1],row,col,getPlayerName(players),false,false) end addEventHandler('onClientGUIClick',root, function() if source == GUIEditor_Grid[1] then local theRow, theCol = guiGridListGetSelectedItem(source) if theRow and theCol and theRow ~= -1 and theCol ~= -1 then local name = guiGridListGetItemText(source,theRow, theCol) --now use your head and script all, because we don't have the level and exp system then we can't make all for you end end) Link to comment
Evil-Cod3r Posted February 10, 2012 Author Share Posted February 10, 2012 i dont get you what i do ? Link to comment
drk Posted February 10, 2012 Share Posted February 10, 2012 You created a function ( "function me()" ) and you don't closed it ( with end ). I said to copy mine code and test. Link to comment
Evil-Cod3r Posted February 10, 2012 Author Share Posted February 10, 2012 i copyed your last code and the same error Link to comment
drk Posted February 10, 2012 Share Posted February 10, 2012 Aw, my bad, I forgot a end. addEventHandler('onClientGUIClick',root, function() if source == GUIEditor_Grid[1] then local theRow, theCol = guiGridListGetSelectedItem(source) if theRow and theCol and theRow ~= -1 and theCol ~= -1 then local name = guiGridListGetItemText(source,theRow, theCol) --now use your head and script all, because we don't have the level and exp system then we can't make all for you end end end) Link to comment
Evil-Cod3r Posted February 10, 2012 Author Share Posted February 10, 2012 its say attempt to index global'GuiEdtor_window'(a nill value) Link to comment
drk Posted February 10, 2012 Share Posted February 10, 2012 Change GUI variables or add GUIEditor_Window = {} GUIEditor_Grid = {} GUIEditor_Label = {} GUIEditor_Image = {} on top of script Link to comment
Evil-Cod3r Posted February 10, 2012 Author Share Posted February 10, 2012 its work but dont get the Players Name function sa () GUIEditor_Window = {} GUIEditor_Grid = {} GUIEditor_Label = {} GUIEditor_Image = {} GUIEditor_Window[1] = guiCreateWindow(423,220,477,311,"Level_System v3.0 ",false) guiWindowSetMovable(GUIEditor_Window[1],false) guiWindowSetSizable(GUIEditor_Window[1],false) GUIEditor_Grid[1] = guiCreateGridList(9,21,264,281,false,GUIEditor_Window[1]) guiGridListSetSelectionMode(GUIEditor_Grid[1],2) local row = guiGridListAddRow ( playerList ) local col = guiGridListAddColumn(GUIEditor_Grid[1],"Players",0.2) GUIEditor_Label[1] = guiCreateLabel(286,43,144,23,"Level :",false,GUIEditor_Window[1]) guiLabelSetColor(GUIEditor_Label[1],0,255,0) guiSetFont(GUIEditor_Label[1],"clear-normal") GUIEditor_Label[2] = guiCreateLabel(284,95,102,21,"EXP:",false,GUIEditor_Window[1]) guiLabelSetColor(GUIEditor_Label[2],0,0,255) guiSetFont(GUIEditor_Label[2],"clear-normal") GUIEditor_Image[1] = guiCreateStaticImage(266,152,182,146,"images/mtalogo.png",false,GUIEditor_Window[1]) for i, players in ipairs(getElementsByType('player')) do guiGridListSetItemText(GUIEditor_Grid[1],row,col,getPlayerName(players),false,false) end addEventHandler ( "onClientResourceStart", getRootElement(), sa ) addEventHandler('onClientGUIClick',root, function() if source == GUIEditor_Grid[1] then local theRow, theCol = guiGridListGetSelectedItem(source) if theRow and theCol and theRow ~= -1 and theCol ~= -1 then local name = guiGridListGetItemText(source,theRow, theCol) end end end) function ToggleShop() if guiGetVisible(GUIEditor_Window[1]) == true then guiSetVisible(GUIEditor_Window[1],false) showCursor(false) else guiSetVisible(GUIEditor_Window[1],true) showCursor(true) end end end bindKey("F7","down",ToggleShop) Link to comment
drk Posted February 10, 2012 Share Posted February 10, 2012 GUIEditor_Window = {} GUIEditor_Grid = {} GUIEditor_Label = {} GUIEditor_Image = {} GUIEditor_Window[1] = guiCreateWindow(423,220,477,311,"Level_System v3.0 ",false) guiWindowSetMovable(GUIEditor_Window[1],false) guiWindowSetSizable(GUIEditor_Window[1],false) GUIEditor_Grid[1] = guiCreateGridList(9,21,264,281,false,GUIEditor_Window[1]) guiGridListSetSelectionMode(GUIEditor_Grid[1],2) local row = guiGridListAddRow ( playerList ) local col = guiGridListAddColumn(GUIEditor_Grid[1],"Players",0.2) GUIEditor_Label[1] = guiCreateLabel(286,43,144,23,"Level :",false,GUIEditor_Window[1]) guiLabelSetColor(GUIEditor_Label[1],0,255,0) guiSetFont(GUIEditor_Label[1],"clear-normal") GUIEditor_Label[2] = guiCreateLabel(284,95,102,21,"EXP:",false,GUIEditor_Window[1]) guiLabelSetColor(GUIEditor_Label[2],0,0,255) guiSetFont(GUIEditor_Label[2],"clear-normal") GUIEditor_Image[1] = guiCreateStaticImage(266,152,182,146,"images/mtalogo.png",false,GUIEditor_Window[1]) if col then for id, players in ipairs(getElementsByType('player')) do guiGridListSetItemText(GUIEditor_Grid[1],row,col,getPlayerName(players),false,false) end end addEventHandler('onClientGUIClick',root, function() if source == GUIEditor_Grid[1] then local theRow, theCol = guiGridListGetSelectedItem(source) if theRow and theCol and theRow ~= -1 and theCol ~= -1 then local name = guiGridListGetItemText(source,theRow, theCol) end end end) bindKey('F7','down', function() guiSetVisible(GUIEditor_Window[1[, not guiGetVisible(GUIEditor_Window[1])) showCursor(not isCursorShowing()) end) I simplified your bind key function too. Link to comment
Evil-Cod3r Posted February 10, 2012 Author Share Posted February 10, 2012 Bad agument guiGridListAddRow'[Expected gui-element at argumnet 1, got nill] Bad argument@ 'guiGridListSetitemText'[Expected number at argument 2, got boolean] Link to comment
drk Posted February 10, 2012 Share Posted February 10, 2012 (edited) GUIEditor_Window = {} GUIEditor_Grid = {} GUIEditor_Label = {} GUIEditor_Image = {} GUIEditor_Window[1] = guiCreateWindow(423,220,477,311,"Level_System v3.0 ",false) guiWindowSetMovable(GUIEditor_Window[1],false) guiWindowSetSizable(GUIEditor_Window[1],false) GUIEditor_Grid[1] = guiCreateGridList(9,21,264,281,false,GUIEditor_Window[1]) guiGridListSetSelectionMode(GUIEditor_Grid[1],2) row = guiGridListAddRow ( GUIEditor_Grid[1] ) col = guiGridListAddColumn(GUIEditor_Grid[1],"Players",0.2) GUIEditor_Label[1] = guiCreateLabel(286,43,144,23,"Level :",false,GUIEditor_Window[1]) guiLabelSetColor(GUIEditor_Label[1],0,255,0) guiSetFont(GUIEditor_Label[1],"clear-normal") GUIEditor_Label[2] = guiCreateLabel(284,95,102,21,"EXP:",false,GUIEditor_Window[1]) guiLabelSetColor(GUIEditor_Label[2],0,0,255) guiSetFont(GUIEditor_Label[2],"clear-normal") GUIEditor_Image[1] = guiCreateStaticImage(266,152,182,146,"images/mtalogo.png",false,GUIEditor_Window[1]) if col then for id, players in ipairs(getElementsByType('player')) do guiGridListSetItemText(GUIEditor_Grid[1],row,col,getPlayerName(players),false,false) end end addEventHandler('onClientGUIClick',root, function() if source == GUIEditor_Grid[1] then local theRow, theCol = guiGridListGetSelectedItem(source) if theRow and theCol and theRow ~= -1 and theCol ~= -1 then local name = guiGridListGetItemText(source,theRow, theCol) end end end) bindKey('F7','down', function() guiSetVisible(GUIEditor_Window[1[, not guiGetVisible(GUIEditor_Window[1])) showCursor(not isCursorShowing()) end) Updated. Edited February 10, 2012 by Guest Link to comment
Evil-Cod3r Posted February 10, 2012 Author Share Posted February 10, 2012 the same error i well wait for another scripter to Help Me Thx For Help me untel now Darken i owe You Man ! Link to comment
drk Posted February 10, 2012 Share Posted February 10, 2012 Copy my last code again, updated. And what you mean by "owe" ? Link to comment
Kenix Posted February 10, 2012 Share Posted February 10, 2012 GUIEditor_Window = {} GUIEditor_Grid = {} GUIEditor_Label = {} GUIEditor_Image = {} GUIEditor_Window[1] = guiCreateWindow( 423,220,477,311,"Level_System v3.0 ",false ) guiWindowSetMovable( GUIEditor_Window[1],false ) guiWindowSetSizable( GUIEditor_Window[1],false ) GUIEditor_Grid[1] = guiCreateGridList( 9,21,264,281,false,GUIEditor_Window[1] ) guiGridListSetSelectionMode( GUIEditor_Grid[1],2 ) row = guiGridListAddRow ( GUIEditor_Grid[1] ) col = guiGridListAddColumn( GUIEditor_Grid[1],"Players",0.2 ) GUIEditor_Label[1] = guiCreateLabel( 286,43,144,23,"Level :",false,GUIEditor_Window[1] ) guiLabelSetColor( GUIEditor_Label[1],0,255,0 ) guiSetFont( GUIEditor_Label[1],"clear-normal" ) GUIEditor_Label[2] = guiCreateLabel( 284,95,102,21,"EXP:",false,GUIEditor_Window[1] ) guiLabelSetColor( GUIEditor_Label[2],0,0,255 ) guiSetFont( GUIEditor_Label[2],"clear-normal" ) GUIEditor_Image[1] = guiCreateStaticImage( 266,152,182,146,"images/mtalogo.png",false,GUIEditor_Window[1] ) if col then for _, players in pairs( getElementsByType 'player' ) do guiGridListSetItemText( GUIEditor_Grid[1],row,col,getPlayerName( players ),false,false ) end end addEventHandler( 'onClientGUIClick',root, function( ) if source == GUIEditor_Grid[1] then local theRow, theCol = guiGridListGetSelectedItem( source ) if theRow and theCol and theRow ~= -1 and theCol ~= -1 then guiGridListGetItemText( source,theRow, theCol ) end end end ) bindKey( 'F7','down', function( ) guiSetVisible( GUIEditor_Window[1], not guiGetVisible( GUIEditor_Window[1] ) ) showCursor( not isCursorShowing( ) ) end ) Your code have syntax error Link to comment
Kenix Posted February 10, 2012 Share Posted February 10, 2012 (edited) What is wrong? guiSetVisible(GUIEditor_Window[1[, not guiGetVisible(GUIEditor_Window[1])) GUIEditor_Window[1[ Syntax error in your code, Edited February 10, 2012 by Guest Link to comment
Evil-Cod3r Posted February 10, 2012 Author Share Posted February 10, 2012 What is wrong? guiSetVisible(GUIEditor_Window[1[, not guiGetVisible(GUIEditor_Window[1])) GUIEditor_Window[1[ Syntax error in your code, lol i alredy tryed that befoure you bost it and the Same Error Never Minde just forget this Topic Thx For all who tryed Help Me i relay owe you guys Link to comment
Castillo Posted February 10, 2012 Share Posted February 10, 2012 GUIEditor_Window = {} GUIEditor_Grid = {} GUIEditor_Label = {} GUIEditor_Image = {} GUIEditor_Window[1] = guiCreateWindow( 423,220,477,311,"Level_System v3.0 ",false ) guiWindowSetMovable( GUIEditor_Window[1],false ) guiWindowSetSizable( GUIEditor_Window[1],false ) guiSetVisible( GUIEditor_Window[1],false ) GUIEditor_Grid[1] = guiCreateGridList( 9,21,264,281,false,GUIEditor_Window[1] ) guiGridListSetSelectionMode( GUIEditor_Grid[1],2 ) col = guiGridListAddColumn( GUIEditor_Grid[1],"Players",0.90 ) GUIEditor_Label[1] = guiCreateLabel( 286,43,144,23,"Level:",false,GUIEditor_Window[1] ) guiLabelSetColor( GUIEditor_Label[1],0,255,0 ) guiSetFont( GUIEditor_Label[1],"clear-normal" ) GUIEditor_Label[2] = guiCreateLabel( 284,95,102,21,"EXP:",false,GUIEditor_Window[1] ) guiLabelSetColor( GUIEditor_Label[2],0,0,255 ) guiSetFont( GUIEditor_Label[2],"clear-normal" ) GUIEditor_Image[1] = guiCreateStaticImage( 266,152,182,146,"images/mtalogo.png",false,GUIEditor_Window[1] ) if (col) then for _, player in pairs( getElementsByType 'player' ) do row = guiGridListAddRow ( GUIEditor_Grid[1] ) guiGridListSetItemText( GUIEditor_Grid[1],row,col,getPlayerName( player ),false,false ) end end addEventHandler( 'onClientGUIClick',root, function( ) if (source == GUIEditor_Grid[1]) then local theRow, theCol = guiGridListGetSelectedItem( source ) if (theRow and theCol and theRow ~= -1 and theCol ~= -1) then local playerName = guiGridListGetItemText( source,theRow, theCol ) local player = getPlayerFromName(playerName) if (player and isElement(player)) then local theEXP = getElementData(player, "ExP") or 0 local theLevel = getElementData(player, "Level") or 0 guiSetText(GUIEditor_Label[1], "Level: ".. tostring(theLevel)) guiSetText(GUIEditor_Label[2], "EXP: ".. tostring(theEXP)) else guiSetText(GUIEditor_Label[1], "Level:") guiSetText(GUIEditor_Label[2], "EXP:") end else guiSetText(GUIEditor_Label[1], "Level:") guiSetText(GUIEditor_Label[2], "EXP:") end end end ) bindKey( 'F7','down', function( ) guiSetVisible( GUIEditor_Window[1], not guiGetVisible( GUIEditor_Window[1] ) ) showCursor( guiGetVisible( GUIEditor_Window[1] ) ) end ) Link to comment
Evil-Cod3r Posted February 10, 2012 Author Share Posted February 10, 2012 God i love You Castillo For Helpin Me i wish i be like you Greate Scripter You always Helping Us Thx i own You Many Time Work Fine My Bro <3 Link to comment
Castillo Posted February 10, 2012 Share Posted February 10, 2012 You're welcome . P.S: No thanks, I have enough brothers, I don't want another ;P. Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now