Raised This Month: $ Target: $400
 0% 

Simple Script but help needed


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Deadman0o06
Member
Join Date: Jun 2006
Old 06-26-2006 , 17:01   Re: Simple Script but help needed
Reply With Quote #1

Sorry first time using it Hold i will go take a look at this other tutorial about set HP and i will let you know. Me and you shoudl get together and learn i been coding for like 2 days too lol

It looks like i used the right format... not sure what went wrong.
__________________
Deadman0o06 is offline
strikerx22
Junior Member
Join Date: Apr 2005
Old 06-26-2006 , 17:45   Re: Simple Script but help needed
Reply With Quote #2

Yay xD thx. It would be cool if we worked together.
__________________
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
BetaX
Member
Join Date: Nov 2005
Old 06-26-2006 , 20:09   Re: Simple Script but help needed
Reply With Quote #3

Oooooooook, let me break it down for you.

Here we have your code in whole:

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) {
	if (!(get_user_flags(id) &ADMIN_KICK) ) {
		console_print(id,"[Striker's RP] Get Admin douche!")
		return PLUGIN_HANDLED
	}
	if (read_argc () == 0) {
		console_print (id, "[Striker's RP] Who the fuck am I supposed to turn into Superman?")
		return PLUGIN_HANDLED
	}
		new user[32], uid
		read_argv(1,user,32)
	uid = find_player ("bh",user)
	if (uid == 0) {
		console_print (id, "[Striker's RP] Hey, asshole, nobody here goes by that!")
		return PLUGIN_HANDLED
	}
new HEALTH(id) {
	get_user_health(id)
	set_user_health(id, 200)
}
	client_cmd (uid,"name Superman")
	console_print (id,"User Is now Superman.")
	return PLUGIN_HANDLED
}
Now there are some really... really... wrong things here, lol.

First of all, let's start with plugin_init();

Code:
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!")
}
OK, now, in the entry for register_concmd on http://amxmodx.org/funcwiki.php it says...

Code:
register_concmd ( const cmd[],const function[],flags=-1, info[]="" )
cmd[] = the command that you are going to put into the console, function[] is what function it is going to use, flags is where you put what access you need to use the command, and info is what you see whenever a player types it in without any arguments.

Let me say this clearly, IF YOU SET THE FLAGS AS ADMIN_KICK, YOU CANNOT USE THE COMMAND IF YOU DO NOT HAVE UP TO ADMIN_KICK ADMIN ACCESS.

YOU DO NOT NEED TO FIND OUT THEIR ACCESS.

xD

So, let's look at do_sm();

Code:
	if (!(get_user_flags(id) &ADMIN_KICK) ) {
		console_print(id,"[Striker's RP] Get Admin douche!")
		return PLUGIN_HANDLED
[/code]
OK, we can get rid of that...

Now, the next if statement,

Code:
	if (read_argc () == 0) {
		console_print (id, "[Striker's RP] Who the fuck am I supposed to turn into Superman?")
		return PLUGIN_HANDLED
	}
Alright, I see where you are going with this, but it is still very, very wrong lol.

AMXX kinda does this for you. If you were to enter no arguments, it would do nothing, so do not worry about this.

Now, we are assuming you want to type in rp_superman player'snamehere and have them be turned into superman. Well, this is kinda the wrong way to go with it.

So, instead, try this:

Code:
new arg1[256];
read_argv(1,arg1,255);

new pNum = get_playersnum(0);
new pName[256];

for (new i; i < pNum; ++i) {
         get_user_name(i,pName,255);
         
         if (equali(pName,arg1)) {
                  HEALTH(i);
         }
}

return PLUGIN_HANDLED;
PM me with specific questions, or whatever you guys are planning to do.

(Also, try to go read over the Wiki again xD )

Edit: Forgot to fix Health for you.

Code:
new HEALTH(id) {
	get_user_health(id)
	set_user_health(id, 200)

	client_cmd (id,"name Superman")
        set_hudmessage (200,100,0,-1.0,0.35,0,6.0,12.0,0.1,0.2,4);
        show_hudmessage(0,"HOMGSUPERMAN!(gaben)");        

	console_print (id,"User Is now Superman.")
	return PLUGIN_HANDLED;
}

Last edited by BetaX; 06-26-2006 at 20:13.
BetaX is offline
Deadman0o06
Member
Join Date: Jun 2006
Old 06-26-2006 , 20:31   Re: Simple Script but help needed
Reply With Quote #4

The one that reads the argumenst is realy confusing lol.

Also strikerx what is your aim?
__________________
Deadman0o06 is offline
strikerx22
Junior Member
Join Date: Apr 2005
Old 06-26-2006 , 20:37   Re: Simple Script but help needed
Reply With Quote #5

AIM:suddendefeat

And thanks alot Beta, but what is this wiki you keep talking about, it would help me LOADS! Please gimme a link.
__________________
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
BetaX
Member
Join Date: Nov 2005
Old 06-26-2006 , 20:44   Re: Simple Script but help needed
Reply With Quote #6

Quote:
Originally Posted by strikerx22
AIM:suddendefeat

And thanks alot Beta, but what is this wiki you keep talking about, it would help me LOADS! Please gimme a link.
It seems to be down right now. I'm sure someone will poke Bailopan or Freecode or Gaben or someone and get it back up.

Anyways, normally, you'd just go to www.amxmodx.org/ and click on .doc above function.

Also, yea, try again and show me what ya got.
BetaX is offline
strikerx22
Junior Member
Join Date: Apr 2005
Old 06-26-2006 , 21:04   Re: Simple Script but help needed
Reply With Quote #7

This is what I got. I have no idea what half of it means but eh, thats why im here talking to you xD
Code:
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!")
}
new arg1[256];
read_argv(1,arg1,255);

new pNum = get_playersnum(0);
new pName[256];

for (new i; i < pNum; ++i) {
         get_user_name(i,pName,255);
         
         if (equali(pName,arg1)) {
                  HEALTH(i);
         }
}

return PLUGIN_HANDLED;
new HEALTH(id) {
	get_user_health(id)
	set_user_health(id, 200)

	client_cmd (id,"name Superman")
        set_hudmessage (200,100,0,-1.0,0.35,0,6.0,12.0,0.1,0.2,4);
        show_hudmessage(0,"HOMGSUPERMAN!(gaben)");        

	console_print (id,"User Is now Superman.")
	return PLUGIN_HANDLED;
}
__________________
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
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