iPrestege Posted April 26, 2013 Share Posted April 26, 2013 (edited) Hello Guys Am Working On My Own Script But I Have A Simple Problem! The Problem Is When I Click On The Grid List The Grid Trigger The Event To The Server But The Server Trigger To Client But The Client Doesn't Set The Text On The Panel ; -- Client -- addEventHandler("onClientGUIClick",guiRoot, function ( button , state , absoluteX , absoluteY ) local Player = guiGridListGetItemText ( MyAdmin.gridlist[1], guiGridListGetSelectedItem ( MyAdmin.gridlist[1] ), 1 ) if ( source == MyAdmin.gridlist[1] ) then if ( guiGridListGetSelectedItem(MyAdmin.gridlist[1]) ~= -1 ) then triggerServerEvent("GetData",localPlayer,Player) else guiSetText(MyAdmin.label[2],"Nick : N/A") guiSetText(MyAdmin.label[3],"Account Name : N/A") guiSetText(MyAdmin.label[4],"IP : N/A") guiSetText(MyAdmin.label[5],"Serial : N/A") guiSetText(MyAdmin.label[6],"Verison : N/A") guiSetText(MyAdmin.label[8],"Health : N/A") guiSetText(MyAdmin.label[9],"Armor : N/A") guiSetText(MyAdmin.label[10],"Skin : N/A") guiSetText(MyAdmin.label[11],"Team : N/A") guiSetText(MyAdmin.label[13],"Money : N/A") guiSetText(MyAdmin.label[14],"X : N/A") guiSetText(MyAdmin.label[16],"Y : N/A") guiSetText(MyAdmin.label[16],"Z : N/A") guiSetText(MyAdmin.label[17],"Area : N/A") guiSetText(MyAdmin.label[18],"Dimenison : N/A") guiSetText(MyAdmin.label[19],"Interior : N/A") guiSetText(MyAdmin.label[21],"Vehicle ID/Name : N/A") guiSetText(MyAdmin.label[22],"Vehicle Health : N/A") end end end ) addEvent("SetTextSelectedPlayerInfo",true) addEventHandler("SetTextSelectedPlayerInfo",getRootElement(), function ( Nick,AccountName,IP,Serial,Health,Armor,Skin,teamName,Money,x,y,z,Area,Dimenison,Interior,VehicleID,VehicleName,VehicleHealth ) guiSetText(MyAdmin.label[2],"Nick : "..Nick.." ") guiSetText(MyAdmin.label[3],"Account Name : "..AccountName.." ") guiSetText(MyAdmin.label[4],"IP : "..IP.." ") guiSetText(MyAdmin.label[5],"Serial : "..Serial.." ") guiSetText(MyAdmin.label[6],"Verison : Soon ") guiSetText(MyAdmin.label[8],"Health : "..Health.." ") guiSetText(MyAdmin.label[9],"Armor : "..Armor.." ") guiSetText(MyAdmin.label[10],"Skin : "..Skin.." ") guiSetText(MyAdmin.label[11],"Team : "..teamName.." ") guiSetText(MyAdmin.label[13],"Money : "..Money.." ") guiSetText(MyAdmin.label[14],"X : "..x.." ") guiSetText(MyAdmin.label[16],"Y : "..y.." ") guiSetText(MyAdmin.label[16],"Z : "..z.." ") guiSetText(MyAdmin.label[17],"Area : "..Area.." ") guiSetText(MyAdmin.label[18],"Dimenison : "..Dimenison.." ") guiSetText(MyAdmin.label[19],"Interior : "..Interior.." ") guiSetText(MyAdmin.label[21],"Vehicle ID/Name : "..VehicleID.." | "..VehicleName.." ") guiSetText(MyAdmin.label[22],"Vehicle Health : "..VehicleHealth.." ") end ) -- Server -- addEvent("GetData",true) addEventHandler("GetData",getRootElement(), function ( Player ) local element = getPlayerFromName(Player) local Nick = getPlayerName(element) local Account = getPlayerAccount(element) if Account then local AccountName = getAccountName(Account) or "N/A" local IP = getPlayerIP(element) local Serial = getPlayerSerial(element) local Health = getElementHealth(element) local Armor = getPedArmor(element) local Skin = getElementModel(element) local team = getPlayerTeam(element) if team then local teamName = getTeamName(team) or "N/A" local Money = getPlayerMoney(element) local x,y,z = getElementPosition(element) local Area = getZoneName ( x,y,z ) local Dimenison = getElementDimension(element) local Interior = getElementInterior(element) if not isPedInVehicle(element) then return end local VehicleID = getElementModel(getPedOccupiedVehicle(element)) local VehicleName = getVehicleName(getPedOccupiedVehicle(element)) local VehicleHealth = getElementHealth(getPedOccupiedVehicle(element)) if ( element and Nick and AccountName and IP and Serial and Health and Armor and Skin and teamName and Money and x and y and z and Area and Dimenison and Interior ) then triggerClientEvent(source,"SetTextSelectedPlayerInfo",source,Nick,AccountName,IP,Serial,Health,Armor,Skin,teamName,Money,x,y,z,Area,Dimenison,Interior,VehicleID,VehicleName,VehicleHealth) end end end end ) I Hope Some One Will Help Me Thanks In Advance! Edited April 26, 2013 by Guest Link to comment
xXMADEXx Posted April 26, 2013 Share Posted April 26, 2013 Not sure, but try this: addEvent("GetData",true) addEventHandler("GetData",getRootElement(), function ( Player ) local Nick = getPlayerName(Player) local Account = getPlayerAccount(Player) if Account then local AccountName = getAccountName(Account) or "N/A" local IP = getPlayerIP(Player) local Serial = getPlayerSerial(Player) local Health = getElementHealth(Player) local Armor = getPedArmor(Player) local Skin = getElementModel(Player) local team = getPlayerTeam(Player) if team then local teamName = getTeamName(team) or "N/A" local Money = getPlayerMoney(Player) local x,y,z = getElementPosition(Player) local Area = getZoneName ( x,y,z ) local Dimenison = getElementDimension(Player) local Interior = getElementInterior(Player) if not isPedInVehicle(Player) then return end local VehicleID = getElementModel(getPedOccupiedVehicle(Player)) local VehicleName = getVehicleName(getPedOccupiedVehicle(Player)) local VehicleHealth = getElementHealth(getPedOccupiedVehicle(Player)) if ( Player and Nick and AccountName and IP and Serial and Health and Armor and Skin and teamName and Money and x and y and z and Area and Dimenison and Interior ) then triggerClientEvent(source,"SetTextSelectedPlayerInfo",source,Nick,AccountName,IP,Serial,Health,Armor,Skin,teamName,Money,x,y,z,Area,Dimenison,Interior,VehicleID,VehicleName,VehicleHealth) end end end end ) Link to comment
iPrestege Posted April 26, 2013 Author Share Posted April 26, 2013 Bad argument @ getPlayerName Expected element at argument 1,got string 'Mr.Pres[T]ege' ! Link to comment
xXMADEXx Posted April 26, 2013 Share Posted April 26, 2013 Bad argument @ getPlayerName Expected element at argument 1,got string 'Mr.Pres[T]ege' ! Can you PM me the full code, so i can try to fix? (I hate trying to script, if i don't know what the result is ) Link to comment
iPrestege Posted April 26, 2013 Author Share Posted April 26, 2013 Bad argument @ getPlayerName Expected element at argument 1,got string 'Mr.Pres[T]ege' ! Can you PM me the full code, so i can try to fix? (I hate trying to script, if i don't know what the result is ) Will the problem is the event not triggered i outputChatBox after trigger it but nothing ! Link to comment
xXMADEXx Posted April 26, 2013 Share Posted April 26, 2013 humm, weird, im not sure, maybe: addEvent("GetData",true) addEventHandler("GetData",getRootElement(), function ( him ) local Player = getPlayerFromName(him) local Account = getPlayerAccount(Player) if Account then local AccountName = getAccountName(Account) or "N/A" local IP = getPlayerIP(Player) local Serial = getPlayerSerial(Player) local Health = getElementHealth(Player) local Armor = getPedArmor(Player) local Skin = getElementModel(Player) local team = getPlayerTeam(Player) if team then local teamName = getTeamName(team) or "N/A" local Money = getPlayerMoney(Player) local x,y,z = getElementPosition(Player) local Area = getZoneName ( x,y,z ) local Dimenison = getElementDimension(Player) local Interior = getElementInterior(Player) if not isPedInVehicle(Player) then return end local VehicleID = getElementModel(getPedOccupiedVehicle(Player)) local VehicleName = getVehicleName(getPedOccupiedVehicle(Player)) local VehicleHealth = getElementHealth(getPedOccupiedVehicle(Player)) if ( Player and him and AccountName and IP and Serial and Health and Armor and Skin and teamName and Money and x and y and z and Area and Dimenison and Interior ) then triggerClientEvent(source,"SetTextSelectedPlayerInfo",source,Nick,AccountName,IP,Serial,Health,Armor,Skin,teamName,Money,x,y,z,Area,Dimenison,Interior,VehicleID,VehicleName,VehicleHealth) end end end end ) Link to comment
iPrestege Posted April 26, 2013 Author Share Posted April 26, 2013 @ No error's but the event not triggered to the client side -.- the problem is on the server side but i don't know where is it . Link to comment
xXMADEXx Posted April 26, 2013 Share Posted April 26, 2013 try removing the "if" statements. Link to comment
DNL291 Posted April 26, 2013 Share Posted April 26, 2013 if not isPedInVehicle(Player) then return end If you're not in a vehicle, the rest of the code will not run. Link to comment
iPrestege Posted April 26, 2013 Author Share Posted April 26, 2013 if not isPedInVehicle(Player) then return end If you're not in a vehicle, the rest of the code will not run. ._. Ah , you are right -.- fuckn mistake but i want to check if not isPedInVehicle then return end and not getTheModel of the vehicle ! and the name ? Link to comment
DNL291 Posted April 26, 2013 Share Posted April 26, 2013 Try this: addEvent("GetData",true) addEventHandler("GetData",getRootElement(), function ( Player ) local element = getPlayerFromName(Player) local Nick = getPlayerName(element) local Account = getPlayerAccount(element) if Account then local AccountName = getAccountName(Account) or "N/A" local IP = getPlayerIP(element) local Serial = getPlayerSerial(element) local Health = getElementHealth(element) local Armor = getPedArmor(element) local Skin = getElementModel(element) local team = getPlayerTeam(element) if team then local teamName = getTeamName(team) or "N/A" local Money = getPlayerMoney(element) local x,y,z = getElementPosition(element) local Area = getZoneName ( x,y,z ) local Dimenison = getElementDimension(element) local Interior = getElementInterior(element) if isPedInVehicle(element) then local VehicleID = getElementModel(getPedOccupiedVehicle(element)) local VehicleName = getVehicleName(getPedOccupiedVehicle(element)) local VehicleHealth = getElementHealth(getPedOccupiedVehicle(element)) end if ( element and Nick and AccountName and IP and Serial and Health and Armor and Skin and teamName and Money and x and y and z and Area and Dimenison and Interior ) then triggerClientEvent(source,"SetTextSelectedPlayerInfo",source,Nick,AccountName,IP,Serial,Health,Armor,Skin,teamName,Money,x,y,z,Area,Dimenison,Interior,VehicleID,VehicleName,VehicleHealth) end end end end ) Link to comment
iPrestege Posted April 26, 2013 Author Share Posted April 26, 2013 Client : attempt to concatenate local 'VehicleName' (a nil value) Link to comment
DNL291 Posted April 26, 2013 Share Posted April 26, 2013 addEvent("GetData",true) addEventHandler("GetData",getRootElement(), function ( Player ) local element = getPlayerFromName(Player) local Nick = getPlayerName(element) local Account = getPlayerAccount(element) local AccountName = getAccountName(Account) or "N/A" local IP = getPlayerIP(element) local Serial = getPlayerSerial(element) local Health = getElementHealth(element) local Armor = getPedArmor(element) local Skin = getElementModel(element) local team = getPlayerTeam(element) local teamName = getTeamName(team) or "N/A" local Money = getPlayerMoney(element) local x,y,z = getElementPosition(element) local Area = getZoneName ( x,y,z ) local Dimenison = getElementDimension(element) local Interior = getElementInterior(element) local VehicleID = getElementModel(getPedOccupiedVehicle(element)) or "N/A" local VehicleName = getVehicleName(getPedOccupiedVehicle(element)) or "N/A" local VehicleHealth = getElementHealth(getPedOccupiedVehicle(element)) or "N/A" if ( element and Nick and AccountName and IP and Serial and Health and Armor and Skin and teamName and Money and x and y and z and Area and Dimenison and Interior ) then triggerClientEvent(source,"SetTextSelectedPlayerInfo",source,Nick,AccountName,IP,Serial,Health,Armor,Skin,teamName,Money,x,y,z,Area,Dimenison,Interior,VehicleID,VehicleName,VehicleHealth) end end ) Link to comment
iPrestege Posted April 26, 2013 Author Share Posted April 26, 2013 [2013-04-26 05:24:37] WARNING: MyAdmin\Server.lua:21: Bad argument @ 'getElementModel' [Expected element at argument 1, got boolean] [2013-04-26 05:24:37] WARNING: MyAdmin\Server.lua:22: Bad argument @ 'getVehicleName' [2013-04-26 05:24:37] WARNING: MyAdmin\Server.lua:23: Bad argument @ 'getElementHealth' [Expected element at argument 1, got boolean] and getTeamName to ! Link to comment
Castillo Posted April 26, 2013 Share Posted April 26, 2013 "element" must be returning false, ur sure that "Player" argument is returning the correct player name? Link to comment
DNL291 Posted April 26, 2013 Share Posted April 26, 2013 If the player are not in a vehicle, getPedOccupiedVehicle will return false. addEvent("GetData",true) addEventHandler("GetData",getRootElement(), function ( Player ) local element = getPlayerFromName(Player) local Nick = getPlayerName(element) local Account = getPlayerAccount(element) if (Account) then local AccountName = getAccountName(Account) else local AccountName = "Not logged in" end local IP = getPlayerIP(element) local Serial = getPlayerSerial(element) local Health = getElementHealth(element) local Armor = getPedArmor(element) local Skin = getElementModel(element) local team = getPlayerTeam(element) if (team) then local teamName = getTeamName(team) else local teamName = "N/A" end local Money = getPlayerMoney(element) local x,y,z = getElementPosition(element) local Area = getZoneName ( x,y,z ) local Dimenison = getElementDimension(element) local Interior = getElementInterior(element) local vehicle = getPedOccupiedVehicle(element) if (vehicle) then local VehicleID = getElementModel(vehicle) local VehicleName = getVehicleName(vehicle) local VehicleHealth = getElementHealth(vehicle) else local VehicleID = "N/A" local VehicleName = "N/A" local VehicleHealth = "N/A" end if ( element and Nick and AccountName and IP and Serial and Health and Armor and Skin and teamName and Money and x and y and z and Area and Dimenison and Interior ) then triggerClientEvent(source,"SetTextSelectedPlayerInfo",source,Nick,AccountName,IP,Serial,Health,Armor,Skin,teamName,Money,x,y,z,Area,Dimenison,Interior,VehicleID,VehicleName,VehicleHealth) end end ) Try it. Link to comment
iPrestege Posted April 26, 2013 Author Share Posted April 26, 2013 Doesn't work any more ! I Cant see the information now in the vehicle or with out it ._, @ SolidSnake Yes return to the PlayerName and You See i send "Player" from the Client GridText and i get bad argument @ getTeamName and nothing work DNL! Link to comment
MR.S3D Posted April 26, 2013 Share Posted April 26, 2013 -- Client -- addEventHandler("onClientGUIClick",guiRoot, function ( button , state , absoluteX , absoluteY ) local Player = guiGridListGetItemText ( MyAdmin.gridlist[1], guiGridListGetSelectedItem ( MyAdmin.gridlist[1] ), 1 ) if ( source == MyAdmin.gridlist[1] ) then if ( guiGridListGetSelectedItem(MyAdmin.gridlist[1]) ~= -1 ) then local elem = getPlayerFromName( Player ) if elem then triggerServerEvent("GetData",localPlayer,elem) end else guiSetText(MyAdmin.label[2],"Nick : N/A") guiSetText(MyAdmin.label[3],"Account Name : N/A") guiSetText(MyAdmin.label[4],"IP : N/A") guiSetText(MyAdmin.label[5],"Serial : N/A") guiSetText(MyAdmin.label[6],"Verison : N/A") guiSetText(MyAdmin.label[8],"Health : N/A") guiSetText(MyAdmin.label[9],"Armor : N/A") guiSetText(MyAdmin.label[10],"Skin : N/A") guiSetText(MyAdmin.label[11],"Team : N/A") guiSetText(MyAdmin.label[13],"Money : N/A") guiSetText(MyAdmin.label[14],"X : N/A") guiSetText(MyAdmin.label[16],"Y : N/A") guiSetText(MyAdmin.label[16],"Z : N/A") guiSetText(MyAdmin.label[17],"Area : N/A") guiSetText(MyAdmin.label[18],"Dimenison : N/A") guiSetText(MyAdmin.label[19],"Interior : N/A") guiSetText(MyAdmin.label[21],"Vehicle ID/Name : N/A") guiSetText(MyAdmin.label[22],"Vehicle Health : N/A") end end end ) addEvent("SetTextSelectedPlayerInfo",true) addEventHandler("SetTextSelectedPlayerInfo",getRootElement(), function ( Nick,AccountName,IP,Serial,Health,Armor,Skin,teamName,Money,x,y,z,Area,Dimenison,Interior,VehicleID,VehicleName,VehicleHealth ) guiSetText(MyAdmin.label[2],"Nick : "..Nick.." ") guiSetText(MyAdmin.label[3],"Account Name : "..tostring( AccountName ).." ") guiSetText(MyAdmin.label[4],"IP : "..IP.." ") guiSetText(MyAdmin.label[5],"Serial : "..Serial.." ") guiSetText(MyAdmin.label[6],"Verison : Soon ") guiSetText(MyAdmin.label[8],"Health : "..Health.." ") guiSetText(MyAdmin.label[9],"Armor : "..Armor.." ") guiSetText(MyAdmin.label[10],"Skin : "..Skin.." ") guiSetText(MyAdmin.label[11],"Team : "..tostring( teamName ).." ") guiSetText(MyAdmin.label[13],"Money : "..Money.." ") guiSetText(MyAdmin.label[14],"X : "..x.." ") guiSetText(MyAdmin.label[16],"Y : "..y.." ") guiSetText(MyAdmin.label[16],"Z : "..z.." ") guiSetText(MyAdmin.label[17],"Area : "..Area.." ") guiSetText(MyAdmin.label[18],"Dimenison : "..Dimenison.." ") guiSetText(MyAdmin.label[19],"Interior : "..Interior.." ") guiSetText(MyAdmin.label[21],"Vehicle ID/Name : "..VehicleID.." | "..VehicleName.." ") guiSetText(MyAdmin.label[22],"Vehicle Health : "..VehicleHealth.." ") end ) -- Server -- addEvent("GetData",true) addEventHandler("GetData",getRootElement(), function ( element ) if not ( isElement( element ) ) then return end local Nick = getPlayerName(element) local Account = getPlayerAccount(element) local AccountName = getAccountName(Account) local IP = getPlayerIP(element) local Serial = getPlayerSerial(element) local Health = getElementHealth(element) local Armor = getPedArmor(element) local Skin = getElementModel(element) local team = getPlayerTeam(element) local teamName if team then teamName = getTeamName(team) else teamName = "N/A" end local Money = getPlayerMoney(element) local x,y,z = getElementPosition(element) local Area = getZoneName ( x,y,z ) local Dimenison = getElementDimension(element) local Interior = getElementInterior(element) local VehicleID local VehicleName local VehicleHealth if isPedInVehicle(element) then VehicleID = getElementModel(getPedOccupiedVehicle(element)) VehicleName = getVehicleName(getPedOccupiedVehicle(element)) VehicleHealth = getElementHealth(getPedOccupiedVehicle(element)) else VehicleID = 'Foot' VehicleName = 'N/A' VehicleHealth = 'N/ِA' end if ( isElement( element ) and Nick and AccountName and IP and Serial and Health and Armor and Skin and teamName and Money and x and y and z and Area and Dimenison and Interior ) then triggerClientEvent(source,"SetTextSelectedPlayerInfo",source,Nick,AccountName,IP,Serial,Health,Armor,Skin,teamName,Money,x,y,z,Area,Dimenison,Interior,VehicleID,VehicleName,VehicleHealth) end end ) 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