Andrixx Posted January 31, 2013 Share Posted January 31, 2013 Hola. Estaba creando un script de CNN pero no logro hacer que al escribir "/nn mas el texto" funcione solo para los que se encuentran en el team y vehiculo inidicados. Server: teamCNN = createTeam ( "CNN News", 100, 255, 100 ) cnnVehicles = { [582]=true } Teams = { [teamCNN] =true } function input_Console ( text ) local team = getTeamFromName ( "CNN News" ) if team then if ( cnnVehicles[getElementModel ( source )] ) then local command = gettok ( text, 1, 32 ) if ( command == "nn" ) then local actionText = string.sub ( text, 3 ) outputChatBox ( ".:*[CNN News]*:. " .. actionText, getRootElement(), 100, 255, 100 ) end end end end addEventHandler ( "onVehicleEnter", getRootElement(), input_Console ) Entonces, ¿En esta fallando el script y que me falta para lo que necesito? ya que el debugscript 3 me dice 'bad argument getElementModel'. Gracias Link to comment
Arsilex Posted January 31, 2013 Share Posted January 31, 2013 teamCNN = createTeam ( "CNN News", 100, 255, 100 ) function input_Console ( source, text ) local team = getTeamFromName ( "CNN News" ) if team then veh = getPedOccupiedVehicle(source) if veh and getElementData(veh) == 441 then local command = gettok ( text, 1, 32 ) if ( command == "nn" ) then local actionText = string.sub ( text, 3 ) outputChatBox ( ".:*[CNN News]*:. " .. actionText, getRootElement(), 100, 255, 100 ) end end end end addEventHandler ( "onVehicleEnter", getRootElement(), input_Console ) Link to comment
Andrixx Posted January 31, 2013 Author Share Posted January 31, 2013 Gracias por responder, pero no me ha funcionado, me subo al auto escribo "/nn probando" y no aparece nada en el chat.. PD: cambie el id del auto en la linea if veh and getElementData(veh) == 582 then y aun asi no funciono.. Link to comment
Xperia Posted January 31, 2013 Share Posted January 31, 2013 if veh and getElementModel(veh) == 582 then Link to comment
Arsilex Posted January 31, 2013 Share Posted January 31, 2013 teamCNN = createTeam ( "CNN News", 100, 255, 100 ) function input_Console ( source text ) local team = getTeamFromName ( "CNN News" ) if getPlayerTeam ( team ) == "CNN News" then veh = getPedOccupiedVehicle(source) if veh and getElementData(veh) == 441 then addCommandHandler("nn", function(thePlayer,Command,text) if text then local actionText = string.sub ( text, 3 ) outputChatBox ( ".:*[CNN News]*:. " .. actionText, getRootElement(), 100, 255, 100 ) end end) end end end addEventHandler ( "onVehicleEnter", getRootElement(), input_Console ) Link to comment
Andrixx Posted January 31, 2013 Author Share Posted January 31, 2013 Gracias por responder pero aun no funciona.. y me da error a "Bad 'player' pointer @ 'getPlayerTeam' <1> PD: Aqui function input_Console ( source, text ) faltaba una coma y lo corregi en cuanto lo vi.. si que ese no era el error Link to comment
Andrixx Posted January 31, 2013 Author Share Posted January 31, 2013 Gracias pekio123 por tu tiempo, pero no me funcionaba y le pedi ayuda a Alexs_Steel y el me lo soluciono Link to comment
Recommended Posts