razvan2299 Posted July 1, 2015 Share Posted July 1, 2015 Good evening. So I was just wondering if someone can make this resource https://community.multitheftauto.com/index.php?p=resources&s=details&id=1705 available only for the VIP's, so they can add/delete teleports. Instead of checking if the player can ban, it can use the function isPlayerVIP from my "vip" resource(not made by me), I belive the function is client sided, too. I tried for 2 hours, but then I gave up. If anyone is willing to help, I would be very greatful. Link to comment
Ab-47 Posted July 1, 2015 Share Posted July 1, 2015 Post your code and we'll try and help, demanding/requesting won't get you anywhere. Link to comment
razvan2299 Posted July 1, 2015 Author Share Posted July 1, 2015 client_Script: addEvent ( "client_ReturnPermissions", true ) addEvent ( "client_ReturnAvailableTeleports", true ) addEvent ( "client_ReturnSpecificTeleport", true ) teleRows = {} function toggleTeleportManager() if guiGetVisible ( teleManager ) == true or guiGetVisible ( teleWizard ) == true then guiSetVisible ( teleManager, false ) guiSetVisible ( teleWizard, false ) showCursor ( false ) guiGridListClear ( list ) guiSetInputEnabled ( false ) else guiSetVisible ( teleManager, true ) showCursor ( true ) processAvailableTeleports() end end function processAvailableTeleports() triggerServerEvent ( "client_CallAvailableTeleports", getLocalPlayer() ) end function checkPermissions() triggerServerEvent ( "client_CheckPermissions", getLocalPlayer() ) end function client_ReturnPermissions ( isAdmin ) if exports.vip:isPlayerVIP(client) then setElementData ( getLocalPlayer(), "allowedToCreateTele", true ) if not exports.vip:isPlayerVIP(client) then setElementData ( getLocalPlayer(), "allowedToCreateTele", false ) end end function client_ReturnAvailableTeleports ( availableTele, tNodeType, teleNodeX, teleNodeY, teleNodeZ, teleNodeDesc, number ) if availableTele == false then teleRows[1] = guiGridListAddRow ( list ) guiGridListSetItemText ( list, teleRows[1], listDescColumn, "*No Available Teleports*", false, false ) guiSetEnabled ( teleManagerUseTele, false ) guiSetEnabled ( teleManagerDeleteTele, false ) else teleRows[number] = guiGridListAddRow ( list ) guiGridListSetItemText ( list, teleRows[number], listDescColumn, ""..teleNodeDesc.."", false, false ) guiGridListSetItemText ( list, teleRows[number], listTypeColumn, tostring(tNodeType), false, false ) guiSetEnabled ( teleManagerUseTele, true ) guiSetEnabled ( teleManagerDeleteTele, true ) end end function client_ReturnSpecificTeleport ( x, y, z, rot, warpType ) if rot == nil or rot == false then rot = 0 end if warpType == nil or warpType == false then warpType = "foot only" end if isPedInVehicle ( getLocalPlayer() ) == true then if getVehicleController ( getPedOccupiedVehicle ( getLocalPlayer() ) ) == getLocalPlayer() then if warpType == "both" or warpType == "vehicle only" then setTimer ( setVehicleFrozen, 1500, 1, getPedOccupiedVehicle ( getLocalPlayer() ), true ) fadeCamera ( false, 1 ) setTimer ( setElementPosition, 1500, 1, getPedOccupiedVehicle ( getLocalPlayer() ), x, y, z ) setTimer ( setElementRotation, 1500, 1, getPedOccupiedVehicle ( getLocalPlayer() ), 0, 0, rot ) setTimer ( setVehicleFrozen, 3000, 1, getPedOccupiedVehicle ( getLocalPlayer() ), false ) setTimer ( fadeCamera, 3000, 1, true, 1 ) elseif warpType == "foot only" then outputChatBox ( "*You have to be on foot to use this warp", 255, 0, 0 ) end end elseif isPedInVehicle ( getLocalPlayer() ) == false then if warpType == "both" or warpType == "foot only" then fadeCamera ( false, 1 ) setTimer ( setElementPosition, 2000, 1, getLocalPlayer(), x, y, z ) setTimer ( setPedRotation, 2000, 1, getLocalPlayer(), tonumber(rot) ) setTimer ( fadeCamera, 3000, 1, true, 1 ) elseif warpType == "vehicle only" then outputChatBox ( "*You have to be in a vehicle to use this warp", 255, 0, 0 ) end end end addCommandHandler ( "tele", toggleTeleportManager ) addEventHandler ( "client_ReturnPermissions", getRootElement(), client_ReturnPermissions ) addEventHandler ( "client_ReturnAvailableTeleports", getRootElement(), client_ReturnAvailableTeleports ) addEventHandler ( "client_ReturnSpecificTeleport", getRootElement(), client_ReturnSpecificTeleport ) server_Script: addEvent ( "client_CheckPermissions", true ) addEvent ( "client_CallAvailableTeleports", true ) addEvent ( "client_DestroyTeleport", true ) addEvent ( "client_CallSpecificTeleport", true ) addEvent ( "client_CreateNewTeleport", true ) isAdminStatus = {} teleportNodes = {} function client_CheckPermissions() if exports.vip:isPlayerVIP(client) then isAdminStatus[client] = true if not exports.vip:isPlayerVIP(client) then return false end end triggerClientEvent ( client, "client_ReturnPermissions", client, isAdminStatus[client] ) end function onPlayerLogout ( prevAccount, curAccount ) setElementData ( source, "allowedToCreateTele", false ) setElementData ( source, "allowedToDestroyTele", false ) if exports.VIP:isPlayerVIP(client) then isAdminStatus[client] = true if not exports:VIP:isPlayerVIP(client) then isAdminStatus[client] = false end end function onPlayerLogin ( prevAccount, curAccount ) if exports.VIP:isPlayerVIP(client) then isAdminStatus[client] = true if not exports.VIP:isPlayerVIP(client) then isAdminStatus[client] = false end triggerClientEvent ( source, "client_ReturnPermissions", source, isAdminStatus[source] ) end function client_CallAvailableTeleports() teleFile = xmlLoadFile ( "warps.xml" ) if teleFile then teleNodes = xmlNodeGetChildren ( teleFile ) for i, node in ipairs ( teleNodes ) do -- end local tableSize = table.maxn ( teleNodes ) if tableSize == 0 then teleAvailable = false triggerClientEvent ( client, "client_ReturnAvailableTeleports", client, teleAvailable ) else teleAvailable = true for i, v in ipairs ( teleNodes ) do tNodeX = xmlNodeGetAttribute ( v, "x" ) tNodeY = xmlNodeGetAttribute ( v, "y" ) tNodeZ = xmlNodeGetAttribute ( v, "z" ) tNodeRot = xmlNodeGetAttribute ( v, "rot" ) tNodeDesc = xmlNodeGetAttribute ( v, "desc" ) tNodeType = xmlNodeGetAttribute ( v, "type" ) triggerClientEvent ( client, "client_ReturnAvailableTeleports", client, teleAvailable, tNodeType, tNodeX, tNodeY, tNodeZ, tNodeDesc, i, tNodeRot ) end end end end function client_DestroyTeleport ( numberInTable ) xmlDestroyNode ( teleNodes[numberInTable] ) xmlSaveFile ( teleFile ) xmlUnloadFile ( teleFile ) outputChatBox ( "*Teleport deleted", client, 0, 255, 0 ) client_CallAvailableTeleports() end function client_CreateNewTeleport ( x, y, z, desc, rot, warpType ) teleFile = xmlLoadFile ( "warps.xml" ) mainNode = xmlFindChild ( teleFile, "teleports", 0 ) newTeleportNode = xmlCreateChild ( teleFile, "teleport" ) xmlNodeSetAttribute ( newTeleportNode, "x", tonumber(x) ) xmlNodeSetAttribute ( newTeleportNode, "y", tonumber(y) ) xmlNodeSetAttribute ( newTeleportNode, "z", tonumber(z) ) xmlNodeSetAttribute ( newTeleportNode, "rot", tonumber(rot) ) xmlNodeSetAttribute ( newTeleportNode, "type", tostring(warpType) ) xmlNodeSetAttribute ( newTeleportNode, "desc", tostring(desc) ) xmlSaveFile ( teleFile ) xmlUnloadFile ( teleFile ) outputChatBox ( "*New teleport added!", client, 0, 255, 0 ) end function client_CallSpecificTeleport ( teleportID ) teleFile = xmlLoadFile ( "warps.xml" ) teleNodes = xmlNodeGetChildren ( teleFile ) selectedNode = teleNodes[teleportID] warpX = xmlNodeGetAttribute ( selectedNode, "x" ) warpY = xmlNodeGetAttribute ( selectedNode, "y" ) warpZ = xmlNodeGetAttribute ( selectedNode, "z" ) warpRot = xmlNodeGetAttribute ( selectedNode, "rot" ) warpType = xmlNodeGetAttribute ( selectedNode, "type" ) triggerClientEvent ( client, "client_ReturnSpecificTeleport", client, warpX, warpY, warpZ, warpRot, warpType ) end addEventHandler ( "client_CheckPermissions", getRootElement(), client_CheckPermissions ) addEventHandler ( "client_CallAvailableTeleports", getRootElement(), client_CallAvailableTeleports ) addEventHandler ( "client_DestroyTeleport", getRootElement(), client_DestroyTeleport ) addEventHandler ( "onPlayerLogout", getRootElement(), onPlayerLogout ) addEventHandler ( "onPlayerLogin", getRootElement(), onPlayerLogin ) addEventHandler ( "client_CreateNewTeleport", getRootElement(), client_CreateNewTeleport ) addEventHandler ( "client_CallSpecificTeleport", getRootElement(), client_CallSpecificTeleport ) Link to comment
razvan2299 Posted July 1, 2015 Author Share Posted July 1, 2015 I can't access the console, I'm using a friend's host and I've only got FTP access. Link to comment
tuaos Posted July 1, 2015 Share Posted July 1, 2015 How is the VIP set to a player in your "vip" resource! If it is by SQL then, obtain players which is vip by: executeSQLQuery Or if it is set in account then: getAccountData Else if you have a team for VIP then its easy with: isPlayerInTeam 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