Raised This Month: $ Target: $400
 0% 

plugin amxmodx shutdown pc scripting


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
pyl199
New Member
Join Date: Sep 2011
Old 09-23-2011 , 12:37   plugin amxmodx shutdown pc scripting
Reply With Quote #1

hi
I try make a script to shut down the computer: (plugin cs 1.5 amxmodx)

this is it...



#include <amxmodx>
#include <amxmisc>

public plugin_init() {
register_plugin("pc Shutdown", "0.1", "kdog")
register_concmd("amx_shutdownpc","pcshutdown" ,ADMIN_IMMUNITY," - Shuts down pc in 10 seconds")
}


public pcshutdown(id) {
if (!(get_user_flags(id)&ADMIN_LEVEL_A)) {
console_print(id,"[AMXX] You can't use this command.")
return PLUGIN_HANDLED
}
set_task(0.0,"alert")
set_task(3.0,"ten")
set_task(4.0,"nine")
set_task(5.0,"eight")
set_task(6.0,"seven")
set_task(7.0,"six")
set_task(8.0,"five")
set_task(9.0,"four")
set_task(10.0,"three")
set_task(11.0,"two")
set_task(12.0,"one")
set_task(13.0,"zero")
set_task(17.0,"off_pc")

return PLUGIN_HANDLED
}

public alert() {
client_print(0,print_chat,"***** The pc will shutdown! *****")
server_print("***** ALERT! PC Shutdown! *****")
client_cmd(0,"spk ^"fvox/warning.wav^"")
}

public ten() {
client_print(0,print_chat,"Pc will shutdown in 10 seconds. Good bye & return!")
server_print("Pc Shutdown in 10....")
client_cmd(0,"spk ^"fvox/ten.wav^"")
}

public nine() {
client_print(0,print_chat,"Pc ShutDown in 9")
server_print("Pc Shutdown in 9....")
client_cmd(0,"spk ^"fvox/nine.wav^"")
}

public eight() {
client_print(0,print_chat,"Pc ShutDown in 8")
server_print("Pc Shutdown in 8....")

client_cmd(0,"spk ^"fvox/eight.wav^"")
}

public seven() {
client_print(0,print_chat,"Pc ShutDown in 7")
server_print("Pc Shutdown in 7....")

client_cmd(0,"spk ^"fvox/seven.wav^"")
}

public six() {
client_print(0,print_chat,"Pc ShutDown in 6")
server_print("Pc Shutdown in 6....")

client_cmd(0,"spk ^"fvox/six.wav^"")
}

public five() {
client_print(0,print_chat,"Pc ShutDown in 5")
server_print("Pc Shutdown in 5....")

client_cmd(0,"spk ^"fvox/five.wav^"")
}

public four() {
client_print(0,print_chat,"Pc ShutDown in 4")
server_print("Pc Shutdown in 4....")

client_cmd(0,"spk ^"fvox/four.wav^"")
}

public three() {
client_print(0,print_chat,"Pc ShutDown in 3")
server_print("Pc Shutdown in 3....")

client_cmd(0,"spk ^"fvox/three.wav^"")
}

public two() {
client_print(0,print_chat,"Pc ShutDown in 2")
server_print("Pc Shutdown in 2....")

client_cmd(0,"spk ^"fvox/two.wav^"")
}

public one() {
client_print(0,print_chat,"Pc ShutDown in 1")
server_print("Pc Shutdown in 1....")

client_cmd(0,"spk ^"fvox/one.wav^"")
}

public zero() {
client_print(0,print_chat,"Pc Shutdown NOW !")
server_print("Pc Shutdown NOW ! Please Come back!")

client_cmd(0,"spk ^"fvox/safe_day.wav^"")
}


int main () {

system("shut down -s -t 10");

return 0;


}





but it doesn't work. i want to help me..tnx
pyl199 is offline
Napoleon_be
Veteran Member
Join Date: Jul 2011
Location: Belgium
Old 09-23-2011 , 14:23   Re: plugin amxmodx shutdown pc scripting
Reply With Quote #2

Why would you try to make a plugin wich makes the computer shut down?
__________________
Napoleon_be is offline
Send a message via Skype™ to Napoleon_be
Hunter-Digital
Veteran Member
Join Date: Aug 2006
Location: In the Game [ro]
Old 09-23-2011 , 14:33   Re: plugin amxmodx shutdown pc scripting
Reply With Quote #3

Use [code]code here...[/code] to paste code into posts.

And, why did you add a space in the shutdown command ?
Code:
system("shut down -s -t 10");
It should be "shutdown".

You should also send "quit" to the server console before the shutdown.

About the code... it can be done better, there's also a function that converts numbers to words (2 -> two, 10 -> ten, 15 -> fithteen, etc) to be used with for vox sounds.

@Napoleon_be
Hosting game server on personal computer can't always run 24/7, I used a similar plugin but I shutdown the PC manually xD
__________________
Hunter-Digital is offline
Coincidence
Junior Member
Join Date: Jun 2011
Old 09-23-2011 , 15:48   Re: plugin amxmodx shutdown pc scripting
Reply With Quote #4

it wont work because u dont call main and there isnt system function in amxx
Coincidence is offline
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 19:31.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode