Looking for an MTA DM resource to delete resources

Need people to help you with your mod, post here
Bookmark and Share

Looking for an MTA DM resource to delete resources

Postby [DRuG]NikT on Sun Jun 20, 2010 6:34 pm

In order to clean up the dud maps on our MTADM Race server, I am in need of a /deletemap command.

If anyone is able to put one together, there currently is no such thing, as discussed on irc just now..

On irc.gtanet.com, I wrote:<nikt> anyone around?
<nikt> I have an idea for a script that's pretty simple, but wanted to ask around if anyone knows if it's already been done
<KWKSND> ask away
<nikt> I'm looking for a resource that allows admins to delete resources.. so we can remove all the dud maps from our race server
<nikt> so if a crap map comes up, they can go /deletemap
<nikt> (without giving them shell access, like, in game)
<KWKSND> dont know of one myself
<nikt> theres a thread on the forums that refers to a function " removeResourceFile ( resource theResource, string fileName ) "
<nikt> not sure if that would do it properly though, u think it's worth me trying?
<nikt> or u reckon they just made that up as some utopian function
<nikt> http://forum.multitheftauto.com/viewtop ... ce#p313257
[01:29pm][nikt(+iwx)][Mail: 105] [#mta.scripting(+nrt)]
[Lag 1] [O/1 N/47 I/0 V/2 F/0] [U:a:S:b:h]
[#mta.scripting]


I didn't get any response following.. any help would be appreciated.


"But my head's all messed up, so you better driive brother"
User avatar

[DRuG]NikT
[DRuG] cofounder & your host

Status:
Check out the downloads and members areas on drugcrew.com

[DRuG] cofounder & your host
[DRuG] coleader
[DRuG] member
DRuG server admin
[AGS] member
]DR[ member
 
Posts: 2527
Joined: Sat Jul 28, 2007 10:39 am
Location: Melbourne, Victoria, Australia


Re: Looking for an MTA DM resource to delete resources

Postby AcidbRain on Thu Oct 21, 2010 9:46 pm

You may be able to do that using the PHP SDK. Basically you only need to issue the callRemote command, which could be done this way:
Code: Select all
function deletemapCallback(result)
  outputDebugString("External server acknowledged "..tostring(result))
end
addCommandHandler("deletemap", function(playerSource, commandName, resourceName)
  callRemote("http://<server url>/deletemap.php", deletemapCallback, resourceName)
end)


This assumes that you have a deletemap.php script that can run on the MTA server, which will receive the resource name and delete it accordingly.
Such script should be much like this one:
Code: Select all
<?php
include('mta_sdk.php');

$ip = $_SERVER['REMOTE_ADDR'];
if ($ip != '<allowed ip>')
{
   mta::doReturn('Invalid IP');
   exit();
}

$payload = mta::getInput();
if (sizeof($payload) > 0)
{
   $resourceName = $payload[0];

   // TODO: recursively delete resource directory
   
   mta::doReturn('Resource deleted');
}

?>
User avatar

AcidbRain
-]alw[- member
-]alw[- member
 
Posts: 13
Joined: Fri Aug 20, 2010 12:43 pm


Re: Looking for an MTA DM resource to delete resources

Postby [DRuG]NikT on Fri Oct 22, 2010 12:55 am

NIce one.. I'll take a look at that this weekend if I can.

Thanks [mrgreen]


"But my head's all messed up, so you better driive brother"
User avatar

[DRuG]NikT
[DRuG] cofounder & your host

Status:
Check out the downloads and members areas on drugcrew.com

[DRuG] cofounder & your host
[DRuG] coleader
[DRuG] member
DRuG server admin
[AGS] member
]DR[ member
 
Posts: 2527
Joined: Sat Jul 28, 2007 10:39 am
Location: Melbourne, Victoria, Australia


Re: Looking for an MTA DM resource to delete resources

Postby [SiK]DemonSeed on Fri Oct 22, 2010 7:09 pm

User avatar

[SiK]DemonSeed
[SiK] member

Status:
Yeah, the drug server has been left out to die it seems.

[SiK] member
 
Posts: 555
Joined: Thu Oct 04, 2007 2:37 pm
Location: Yokosuka, Japan


Re: Looking for an MTA DM resource to delete resources

Postby [DRuG]NikT on Sat Oct 23, 2010 12:34 am

yehhhh nice onnnne.

will chek it out.. thanks. :geek:


"But my head's all messed up, so you better driive brother"
User avatar

[DRuG]NikT
[DRuG] cofounder & your host

Status:
Check out the downloads and members areas on drugcrew.com

[DRuG] cofounder & your host
[DRuG] coleader
[DRuG] member
DRuG server admin
[AGS] member
]DR[ member
 
Posts: 2527
Joined: Sat Jul 28, 2007 10:39 am
Location: Melbourne, Victoria, Australia



Return to Recruits & Requests

Who is online

Users browsing this forum: No registered users and 1 guest

cron