Reflex# Posted November 28, 2012 Share Posted November 28, 2012 What functions I must to use for this script : Sample in outputChatbox : [TESTING RESULTS] Map : mapName(what currently playing now) ACCEPTED(DECLINED) [TESTING RESULTS] want to make it on command /accepted or /declined like result of testing maps. hope you understand. Link to comment
fmj02 Posted November 28, 2012 Share Posted November 28, 2012 you can simply use addCommandHandler and add exception for execution Link to comment
Reflex# Posted November 28, 2012 Author Share Posted November 28, 2012 I understand,but I want to ask,what functions I want to use for another part of script Link to comment
TwiX! Posted November 28, 2012 Share Posted November 28, 2012 /accept on 1 server outputchatbox on another? Link to comment
TwiX! Posted November 28, 2012 Share Posted November 28, 2012 (edited) Your resource(code) on 1 server local serverIP = "127.0.0.1:22005" -- Server ip [ Need HTTP Port (Not mta) ] function callBack (remote,code) if not code then return end outputDebugString( remote.." "..code ); end function aMap(player) local accName = getAccountName ( getPlayerAccount ( player ) ); if isObjectInACLGroup ( "user." .. tostring( accName ), aclGetGroup( "Admin" ) ) then local mapName = getResourceInfo ( exports.mapmanager:getRunningGamemodeMap(), "name" ); if mapName then callRemote ( serverIP, getResourceName ( getThisResource() ), "gotResult", callBack, 1, mapName ); end else outputChatBox("* You need #ff0000Admin #ffffffRights!",player,255,255,255,true) end end addCommandHandler("accepted",aMap) function dMap(player) local accName = getAccountName ( getPlayerAccount ( player ) ); if isObjectInACLGroup ( "user." .. tostring( accName ), aclGetGroup( "Admin" ) ) then local mapName = getResourceInfo ( exports.mapmanager:getRunningGamemodeMap(), "name" ); if mapName then callRemote ( serverIP, getResourceName ( getThisResource() ), "gotResult", callBack, 2, mapName ); end else outputChatBox("* You need #ff0000Admin #ffffffRights!",player,255,255,255,true) end end addCommandHandler("declined",dMap) Other server function gotResult (mode,mapName) if mode == 1 then outputChatBox ( "[TESTING RESULTS]", getRootElement(), 255, 255, 255, true ); outputChatBox ( "Map #ff0000'#ffffff" ..mapName.. "#ff0000'#ffffff was #00ff00accepted", getRootElement(), 255, 255, 255, true ); outputChatBox ( "[TESTING RESULTS]", getRootElement(), 255, 255, 255, true ); else outputChatBox ( "[TESTING RESULTS]", getRootElement(), 255, 255, 255, true ); outputChatBox ( "Map #ff0000'#ffffff" ..mapName.. "#ff0000'#ffffff was #ff0000declined", getRootElement(), 255, 255, 255, true ); outputChatBox ( "[TESTING RESULTS]", getRootElement(), 255, 255, 255, true ); end end meta.xml <export function="gotResult" http="true" /> This resource is SERVER-SIDE and need Admin Rights for 'callRemote' Edited November 28, 2012 by Guest Link to comment
Reflex# Posted November 28, 2012 Author Share Posted November 28, 2012 Your resource(code) on 1 server local serverIP = "127.0.0.1:22005" -- Server ip [ Need HTTP Port (Not mta) ] function callBack (remote,code) if not code then return end outputDebugString( remote.." "..code ); end function aMap(player) local accName = getAccountName ( getPlayerAccount ( player ) ); if isObjectInACLGroup ( "user." .. tostring( accName ), aclGetGroup( "Admin" ) ) then local mapName = tostring ( exports.mapmanager:getRunningGamemodeMap( exports.mapmanager:getRunningGamemode() ) ); if mapName then callRemote ( serverIP, getResourceName ( getThisResource() ), "gotResult", callBack, 1, mapName ); end else outputChatBox("* You need #ff0000Admin #ffffffRights!",player,255,255,255,true) end end addCommandHandler("accepted",aMap) function dMap(player) local accName = getAccountName ( getPlayerAccount ( player ) ); if isObjectInACLGroup ( "user." .. tostring( accName ), aclGetGroup( "Admin" ) ) then local mapName = tostring ( exports.mapmanager:getRunningGamemodeMap( exports.mapmanager:getRunningGamemode() ) ); if mapName then callRemote ( serverIP, getResourceName ( getThisResource() ), "gotResult", callBack, 2, mapName ); end else outputChatBox("* You need #ff0000Admin #ffffffRights!",player,255,255,255,true) end end addCommandHandler("declined",dMap) Other server function gotResult (mode,mapName) if mode == 1 then outputChatBox ( "[TESTING RESULTS]", getRootElement(), 255, 255, 255, true ); outputChatBox ( "Map #ff0000'#ffffff" ..mapName.. "#ff0000'#ffffff was #00ff00accepted", getRootElement(), 255, 255, 255, true ); outputChatBox ( "[TESTING RESULTS]", getRootElement(), 255, 255, 255, true ); else outputChatBox ( "[TESTING RESULTS]", getRootElement(), 255, 255, 255, true ); outputChatBox ( "Map #ff0000'#ffffff" ..mapName.. "#ff0000'#ffffff was #ff0000declined", getRootElement(), 255, 255, 255, true ); outputChatBox ( "[TESTING RESULTS]", getRootElement(), 255, 255, 255, true ); end end meta.xml <export function="gotResult" http="true" /> This resource is SERVER-SIDE and need Admin Rights for 'callRemote' Wow...you awesome TwiX As always I wanted to make it by myself but you helped me more..I'll learn this script and I'll try to modify it THX Link to comment
deltamta Posted December 10, 2012 Share Posted December 10, 2012 Sorry for bumping but your code gives me an ERROR 22! I have read CURL and it shows this : CURLE_HTTP_RETURNED_ERROR (22) This is returned if CURLOPT_FAILONERROR is set TRUE and the HTTP server returns an error code that is >= 400. Sorry if I look like a nab but i actually never worked with callRemote. Link to comment
TwiX! Posted December 11, 2012 Share Posted December 11, 2012 This code (my post) is working You need change the IP And read https://wiki.multitheftauto.com/wiki/CallRemote Link to comment
deltamta Posted December 11, 2012 Share Posted December 11, 2012 yes ofc i did that and I also put HTTP port But still aint working. ( I also tested with a different host but still nothing ) Link to comment
Anderl Posted December 11, 2012 Share Posted December 11, 2012 I already told you via Skype it was wrong. 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