Jump to content

Kick problem


TheIceman1

Recommended Posts

Posted

Why this kick me and not the player that I choose in gridlist?

Server side:

function kickplay (text) 
        if ( hasObjectPermissionTo ( source, "function.kickPlayer" ) ) then 
        kickPlayer ( source, source, text ) 
    end 
end 
addEvent ( "kickplayer", true ) 
addEventHandler ( "kickplayer", root, kickplay ) 

Client side(players on gridlist):

for id, playeritem in ipairs(getElementsByType("player")) do  
              local row = guiGridListAddRow ( GUIEditor_Grid[1] ) 
              guiGridListSetItemText ( GUIEditor_Grid[1], row, col, getPlayerName( playeritem ), false, false ) 
              local name = getPlayerName ( playeritem ) 
              local wl = getPlayerWantedLevel ( playeritem ) 
              guiSetText ( GUIEditor_Label[1], "Name:"..name ) 
              guiSetText ( GUIEditor_Label[5], "WantedLevel:"..wl ) 
end 
addEventHandler( "onClientGUIClick", GUIEditor_Grid[1], getplayer, false ) 
  

Client side:

function kickplayer () 
local text = guiGetText ( GUIEditor_Edit[1] ) 
 triggerServerEvent ( "kickplayer", getLocalPlayer(), text ) 
end 
addEventHandler ( "onClientGUIClick", GUIEditor_Button[5], kickplayer ) 

Need paid scripter just pm me i will accept every job!

Posted
triggerServerEvent ( "kickplayer", getLocalPlayer(), text ) 

Is because you are triggering the local player as source.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

You are kicking the sourcePlayer in kickplay function.

Please do not PM me with scripting related question nor support, use the forums instead.

Posted

What is "playeritem"?

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted
for id, playeritem in ipairs(getElementsByType("player")) do  
              local row = guiGridListAddRow ( GUIEditor_Grid[1] ) 
              guiGridListSetItemText ( GUIEditor_Grid[1], row, col, getPlayerName( playeritem ), false, false ) 
              local name = getPlayerName ( playeritem ) 
              local wl = getPlayerWantedLevel ( playeritem ) 
              guiSetText ( GUIEditor_Label[1], "Name:"..name ) 
              guiSetText ( GUIEditor_Label[5], "WantedLevel:"..wl ) 
end 
addEventHandler( "onClientGUIClick", GUIEditor_Grid[1], getplayer, false ) 

@ Solidsnake14: From here?

@Mr.Prestege: Why this dont kick me?

function kickplayer () 
local playerNameK = guiGridListGetItemText ( GUIEditor_Grid[1], guiGridListGetSelectedItem ( GUIEditor_Grid[1] ), 1 ) 
local text = guiGetText ( GUIEditor_Edit[1] ) 
 triggerServerEvent ( "kickplayer", playerNameK, text ) 
end 
addEventHandler ( "onClientGUIClick", GUIEditor_Button[5], kickplayer ) 

Need paid scripter just pm me i will accept every job!

Posted

function kickplayer () 
local playerNameK = guiGridListGetItemText ( GUIEditor_Grid[1], guiGridListGetSelectedItem ( GUIEditor_Grid[1] ), 1 ) 
local text = guiGetText ( GUIEditor_Edit[1] ) 
if ( playerNameK ) then 
 triggerServerEvent ( "kickplayer", tostring(playerNameK), tostring(text)) 
    end 
end 
addEventHandler ( "onClientGUIClick", GUIEditor_Button[5], kickplayer ) 

  

Posted
function kickplayer () 
local playerNameK = guiGridListGetItemText ( GUIEditor_Grid[1], guiGridListGetSelectedItem ( GUIEditor_Grid[1] ), 1 ) 
local text = guiGetText ( GUIEditor_Edit[1] ) 
if ( playerNameK ) then 
 triggerServerEvent ( "kickplayer", tostring(playerNameK), tostring(text)) 
    end 
end 
addEventHandler ( "onClientGUIClick", GUIEditor_Button[5], kickplayer ) 

Dont work.

Bad argument @ triggerServerEvent[ Expected element at argument 2, got string "TheIceman"

Need paid scripter just pm me i will accept every job!

Posted
function kickplayer () 
local playerNameK = guiGridListGetItemText ( GUIEditor_Grid[1], guiGridListGetSelectedItem ( GUIEditor_Grid[1] ), 1 ) 
local text = guiGetText ( GUIEditor_Edit[1] ) 
if ( playerNameK ) then 
 triggerServerEvent ( "kickplayer", tostring(playerNameK), tostring(text)) 
    end 
end 
addEventHandler ( "onClientGUIClick", GUIEditor_Button[5], kickplayer ) 

Dont work.

Bad argument @ triggerServerEvent[ Expected element at argument 2, got string "TheIceman"

cause you didn't type any element , element is required

triggerServerEvent ( "kickplayer",localPlayer,tostring(playerNameK), tostring(text)) 

localPlayer is predefined variable.

also you need to use getPlayerFromName in the serverside

function kickplay (playerNameK,text) 
        if ( hasObjectPermissionTo ( source, "function.kickPlayer" ) ) then 
        kickPlayer (getPlayerFromName(playerNameK), source, text ) 
    end 
end 
addEvent ( "kickplayer", true ) 
addEventHandler ( "kickplayer", root, kickplay ) 

Posted
function kickplayer () 
local playerNameK = guiGridListGetItemText ( GUIEditor_Grid[1], guiGridListGetSelectedItem ( GUIEditor_Grid[1] ), 1 ) 
local text = guiGetText ( GUIEditor_Edit[1] ) 
if ( playerNameK ) then 
 triggerServerEvent ( "kickplayer", tostring(playerNameK), tostring(text)) 
    end 
end 
addEventHandler ( "onClientGUIClick", GUIEditor_Button[5], kickplayer ) 

Dont work.

Bad argument @ triggerServerEvent[ Expected element at argument 2, got string "TheIceman"

cause you didn't type any element , element is required

triggerServerEvent ( "kickplayer",localPlayer,tostring(playerNameK), tostring(text)) 

localPlayer is predefined variable.

also you need to use getPlayerFromName in the serverside

function kickplay (playerNameK,text) 
        if ( hasObjectPermissionTo ( source, "function.kickPlayer" ) ) then 
        kickPlayer (getPlayerFromName(playerNameK), source, text ) 
    end 
end 
addEvent ( "kickplayer", true ) 
addEventHandler ( "kickplayer", root, kickplay ) 

Working,thanks!

Need paid scripter just pm me i will accept every job!

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