Raised This Month: $ Target: $400
 0% 

Simple Script but help needed


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
BetaX
Member
Join Date: Nov 2005
Old 06-26-2006 , 14:50   Re: Simple Script but help needed
Reply With Quote #1

Code:
#include <amxmodx>
#include <fun>

public plugin_init ( ) {
	register_plugin("Striker's Superman Plugin","0.1","Ryan 'Striker' Davis")
	register_concmd("rp_superman","do_sm",ADMIN_KICK, " Sets user to Superman!")
}
public do_sm(id) {
  new user[256];
  read_argv(1,user,255);
  // The computer does not know who you are asking about. You must tell it.
  // Try looking over the natives: www.amxmodx.org/funcwiki.php?
  // (Note, I changed this to check if the player is alive. ID is your id in the server.
	if (!is_user_alive(id)) {
		console_print(id,"[Striker's RP] You must be alive to use this command.")
		return PLUGIN_HANDLED
	}

  /* This is not needed... Plus, there would be no command here.
  read_argc returns the amount of commands, and if it returned 2, the amount
  of arguments would really be 1, because it counts the command itself (in this case
  that is do_sm).
  
  If you do not enter anything, it repeats the help command.
  
  if (read_argc () == 0) {
		console_print (id, "[Striker's RP] Who the fuck am I supposed to turn into Superman?")
		return PLUGIN_HANDLED
	}*/

  // I am now telling it to go to HEALTH now, forwarding the 'id' of the player.
  HEALTH(id);
  return PLUGIN_HANDLED;
}
new HEALTH(id) {
	//get_user_health(id) We don't need to find their health if we're just gonna rewrite it. :P
	set_user_health(id, 200)
//} We don't want this. O: It'll close HEALTH before it has done its job.
	client_cmd (uid,"name Superman")
	client_print(id,print_chat,"YOU ARE NOW SUPERMAN! O:");

  new i;
  do {
    ++i;
    if (i != id) {
	   client_print(i,print_chat,"Watch out! Superman is here!");
	  }
	} while (i <= 32);
	
	return PLUGIN_HANDLED

}
Nice attempt, but please, read the documentation over again.

And keep IE or FireFox or whatever you use open so you can access amxmodx.org/funcwiki.php for whenever you need to do something creative.

Edit: DeathMsg byte, byte, byte, string 1: Killer ID, 2: Victim ID, 3: Headshot, 4:Weapon Name

Leeeeeeeeeeeeeeeeeeeeeeeeearn. o_o

register_event ( const event[], const function[], const flags[], [ cond=[], ... ] )

So, something along the lines of...

Code:
register_event("DeathMsg","SETNORM")
Try figuring out what to do in the function SETNORM, and post it here, we'll see how ya did.

Last edited by BetaX; 06-26-2006 at 14:57.
BetaX is offline
strikerx22
Junior Member
Join Date: Apr 2005
Old 06-26-2006 , 15:06   Re: Simple Script but help needed
Reply With Quote #2

Well, I honestly just started scripting 2 days ago, so any explanation for anything would help.
__________________
Padme:Obi-Wan told me you killed my husband, the father of my child...
Vader:No! I am your babies Daddy!
Padme: *GASP*!?!?!?!?!?!?!
strikerx22 is offline
Deadman0o06
Member
Join Date: Jun 2006
Old 06-26-2006 , 16:14   Re: Simple Script but help needed
Reply With Quote #3

Quote:
Originally Posted by strikerx22
Well, I honestly just started scripting 2 days ago, so any explanation for anything would help.
Here i attempted to rewrite what you did.

Code:
#include <amxmodx> #include <amxmisc> #include <fun> #define PLUGIN "Superman" #define VERSION ".01" #define AUTHOR "AUTHOR" public plugin_init() {  register_plugin(PLUGIN, VERSION, AUTHOR)  register_concmd("amx_superman","superman",ADMIN_KICK," :Creates a superman") } public superman(id) {  if(!(get_user_flags(id)&ADMIN_KICK)) {   console_print(id,"[SUPERMAN] You do not have access fool.")   return PLUGIN_HANDLED  }  if(read_argc() == 0) {   console_print(id,"[SUPERMAN] You did not select a user!")   return PLUGIN_HANDLED  }  new user[32], uid  read_argv(1,user,32)  uid = find_player("bh",user)  if(uid == 0) {   console_print(id,"[SUPERMAN] There is no such user!")   return PLUGIN_HANDLED  }  client_cmd(uid,"name Superman!")  set_user_gravity(uid,"0.4")  set_user_health(uid,"250")  set_user_maxpseed(uid,"2.0")  return PLUGIN_HANDLED }

No idea if it compiles or not.
__________________

Last edited by Deadman0o06; 06-26-2006 at 16:19.
Deadman0o06 is offline
Throstur
Senior Member
Join Date: Nov 2004
Location: Iceland
Old 06-28-2006 , 08:48   Re: Simple Script but help needed
Reply With Quote #4

Quote:
Originally Posted by Deadman0o06
Here i attempted to rewrite what you did.

Code:
#include <amxmodx> #include <amxmisc> #include <fun> #define PLUGIN "Superman" #define VERSION ".01" #define AUTHOR "AUTHOR" public plugin_init() {  register_plugin(PLUGIN, VERSION, AUTHOR)  register_concmd("amx_superman","superman",ADMIN_KICK," :Creates a superman") } public superman(id) {  if(!(get_user_flags(id)&ADMIN_KICK)) {   console_print(id,"[SUPERMAN] You do not have access fool.")   return PLUGIN_HANDLED  }  if(read_argc() == 0) {   console_print(id,"[SUPERMAN] You did not select a user!")   return PLUGIN_HANDLED  }  new user[32], uid  read_argv(1,user,32)  uid = find_player("bh",user)  if(uid == 0) {   console_print(id,"[SUPERMAN] There is no such user!")   return PLUGIN_HANDLED  }  client_cmd(uid,"name Superman!")  set_user_gravity(uid,"0.4")  set_user_health(uid,"250")  set_user_maxpseed(uid,"2.0")  return PLUGIN_HANDLED }

No idea if it compiles or not.
PHP Code:
set_user_maxpseed(uid,"2.0"
PHP Code:
set_user_maxspeed(uid,"2.0"
Throstur is offline
Send a message via AIM to Throstur Send a message via MSN to Throstur
Deadman0o06
Member
Join Date: Jun 2006
Old 06-28-2006 , 10:28   Re: Simple Script but help needed
Reply With Quote #5

Quote:
Originally Posted by Throstur
PHP Code:
set_user_maxpseed(uid,"2.0"
PHP Code:
set_user_maxspeed(uid,"2.0"
Yea i know i had an error there but i fixed it
__________________
Deadman0o06 is offline
Reply



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 08:03.


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