Sasu Posted April 21, 2013 Share Posted April 21, 2013 When I use banPlayer(thePlayer, false, false, true, adminBanner, "Razon: "..editText.." [ "..timeBan.." Min ] ", theTimeBan) on the admin panel in column 'nick' ( first column ) returns me N/A, so return false. Why? All arguments are defined. Link to comment
50p Posted April 21, 2013 Share Posted April 21, 2013 What do you mean? In admin panel you just select the player and hit Ban. What has this line to do with the admin panel? Link to comment
Sasu Posted April 21, 2013 Author Share Posted April 21, 2013 Its says N/A instead name of the player who was banned. Link to comment
Tete omar Posted April 21, 2013 Share Posted April 21, 2013 Its says N/A instead name of the player who was banned. Because you banned them using their serial/ip ? Link to comment
Sasu Posted April 22, 2013 Author Share Posted April 22, 2013 Its says N/A instead name of the player who was banned. Because you banned them using their serial/ip ? Yes. Why...? Link to comment
Tete omar Posted April 22, 2013 Share Posted April 22, 2013 In admin panel, you can't ban someone from serial/ip and expect their name will be shown .. , you should do what 50p told you to show their name. Link to comment
Sasu Posted April 22, 2013 Author Share Posted April 22, 2013 But I created an admin panel and Its ban from serial. And also I created a gridlist to make list ban. But I cant get the name. Link to comment
OGF Posted April 22, 2013 Share Posted April 22, 2013 Are you doing something like so .. ? playerToBan = guiGridListGetItemText ( playerlist, guiGridListGetSelectedItem ( playerlist ), 1 ) triggerServerEvent ( "yourEventHere", root, playerToBan ) Link to comment
Sasu Posted April 22, 2013 Author Share Posted April 22, 2013 Are you doing something like so .. ? playerToBan = guiGridListGetItemText ( playerlist, guiGridListGetSelectedItem ( playerlist ), 1 ) triggerServerEvent ( "yourEventHere", root, playerToBan ) Yes. And In server I convert with getPlayerFromName. Link to comment
OGF Posted April 22, 2013 Share Posted April 22, 2013 There is probably an issue when you send it to the server since it returns false, try posting your code here at least the significant ones. Link to comment
Sasu Posted April 22, 2013 Author Share Posted April 22, 2013 Client: function banearButton (text, adminBanner, timeBan, editText) if source == banButton then local timeBan = guiGetText(timeEdit) local selected = guiGridListGetSelectedItem( listaPlayers ) local text = guiGridListGetItemText( listaPlayers, selected, 1 ) local editText = guiGetText( reasonEdit ) local adminBanner = getPlayerName(getLocalPlayer()) if string.len ( editText ) > 0 then if string.len ( timeBan ) > 0 then triggerServerEvent("banHim", root, text, adminBanner, timeBan, editText) else outputChatBox("Escribe el tiempo de duracion",255,0,0,false) end else outputChatBox("Escribe la razon para banearlo.",255,0,0,false) end end end addEventHandler("onClientGUIClick", root, banearButton) Server: function banear(text, adminBanner, timeBan, editText) local thePlayer = getPlayerFromName(text) if not thePlayer then outputChatBox("Selecciona a un jugador de la lista", source,255,0,0,true) return end local adminPermisos = getPlayerFromName(adminBanner) if ( hasObjectPermissionTo ( adminPermisos, "function.banPlayer", true ) ) then if (timeBan) then theTimeBan = math.floor ( tonumber ( timeBan )*60 ) banPlayer(thePlayer, false, false, true, adminBanner, "Razon: "..editText.." [ "..timeBan.." Min ] ", theTimeBan) outputChatBox(text.." ha sido baneado por "..adminBanner..". Razon: "..editText.." ( "..timeBan.." Min )", getRootElement(), 255, 0, 0, false) end else outputChatBox("No tienes los permisos suficientes para banearlo", adminPermisos, 255, 0, 0, false) end end addEvent("banHim", true) addEventHandler("banHim", getRootElement(), banear) Link to comment
OGF Posted April 22, 2013 Share Posted April 22, 2013 Try this, it should work. Tested. --client function banearButton (text, adminBanner, timeBan, editText) if source == banButton then local timeBan = guiGetText( timeEdit ) local text = guiGridListGetItemText ( listaPlayers, guiGridListGetSelectedItem ( listaPlayers ), 1 ) local editText = guiGetText( reasonEdit ) local adminBanner = getPlayerName( localPlayer ) if string.len ( editText ) > 0 then if string.len ( timeBan ) > 0 then triggerServerEvent("banHim", root, text, adminBanner, timeBan, editText) else outputChatBox("Escribe el tiempo de duracion",255,0,0,false) end else outputChatBox("Escribe la razon para banearlo.",255,0,0,false) end end end addEventHandler("onClientGUIClick", root, banearButton) 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