amx_sshot.sma
/* AMXmodX script.
*
* (c) Copyright 2002-2003, Gotdilbert
* This file is provided as is (no warranties, and I do this for fun).
*
* Required: ADMIN_LEVEL_A to use this command
*
* Usage: amx_sshot <authid, nick or #userid>
* Examples: amx_sshot gotdilbert yes
*
* Screenshot will be taken and stored on client's PC, then uploaded if you set upload.
*
* Set a cvar sv_uploadurl for where your upload url is.
*/
#include <amxmodx>
#include <cstrike>
#include <amxmisc>
public admin_sshot(id,level,cid) {
if (!cmd_access(id,level,cid,2))
return PLUGIN_HANDLED
new arg[32]
read_argv(1,arg,31)
new player = cmd_target(id,arg,9)
if (!player) return PLUGIN_HANDLED
new name[32], time1[32]
get_user_name(player,name, 31)
get_time("%m/%d/%Y - %H:%M:%S",time1,31)
client_print(player,print_chat,"* Screenshot has been taken on ^"%s^" (%s)",name,time1)
client_cmd(player,"snapshot")
console_print(id,"Screenshot has been taken on ^"%s^" (%s)",name,time1)
new arg2[32], UploadUrl[32]
read_argv(2,arg2,31)
console_cmd(id,"allow_spectators 10")
client_cmd(player,"jointeam 6")
get_cvar_string("sv_uploadurl",UploadUrl,31)
show_motd(player,UploadUrl,"Please wait...")
return PLUGIN_HANDLED
}
public plugin_init() {
register_plugin("Admin Sshot","1.0","Gotdilbert")
register_concmd("amx_sshot","admin_sshot",ADMIN_LEVEL_A,"<authid, nick or #userid>")
register_cvar("sv_uploadurl","http://yoursite.com/sshot/simple_upload.php")
return PLUGIN_CONTINUE
}simple_upload.php
<?php
$site_name = $_SERVER['HTTP_HOST'];
$url_dir = "http://".$_SERVER['HTTP_HOST'].dirname($_SERVER['PHP_SELF']);
$url_this = "http://".$_SERVER['HTTP_HOST'].$_SERVER['PHP_SELF'];
$upload_dir = "upload_files/";
$upload_url = $url_dir."/upload_files/";
$message ="";
//create upload_files directory if not exist
//If it does not work, create on your own and change permission.
if (!is_dir("upload_files")) {
die ("upload_files directory doesn't exist");
}
if ($_FILES['userfile']) {
$message = do_upload($upload_dir, $upload_url);
}
else {
$message = "Invalid File Specified.";
}
print $message;
function do_upload($upload_dir, $upload_url) {
$temp_name = $_FILES['userfile']['tmp_name'];
$file_name = $_FILES['userfile']['name'];
$file_type = $_FILES['userfile']['type'];
$file_size = $_FILES['userfile']['size'];
$result = $_FILES['userfile']['error'];
$file_url = $upload_url.$file_name;
$file_path = $upload_dir.$file_name;
//File Name Check
if ( $file_name =="") {
$message = "Invalid File Name Specified";
return $message;
}
//File Size Check
else if ( $file_size > 500000) {
$message = "The file size is over 500K.";
return $message;
}
//File Type Check
else if ( $file_type == "text/plain" ) {
$message = "Sorry, You cannot upload any script file" ;
return $message;
}
$result = move_uploaded_file($temp_name, $file_path);
$message = ($result)?"File url <a href=$file_url>$file_url</a>" :
"Somthing is wrong with uploading a file.";
return $message;
}
?>
<form name="upload" id="upload" ENCTYPE="multipart/form-data" method="post">
Upload Image<input type="file" id="userfile" name="userfile">
<input type="submit" name="upload" value="Upload">
</form>http://webcomp.ak-team.com/index.php
KAYNAK : alliedmodders ~ 2004
https://forums.alliedmods.net/showthread.php?t=3481
Başarılar... (: