Raised This Month: $ Target: $400
 0% 

scripting questions


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
nightscreem
Veteran Member
Join Date: Jul 2004
Location: Belgium
Old 02-17-2005 , 16:39   scripting questions
Reply With Quote #1

what am i doing wrong
this is the scripting tut from doc
Quote:
#include <amxmodx>
#include <amxmisc>
#include <fun>

new PLUGIN[]="HP"
new AUTHOR[]="Nightscream"
new VERSION[]="1.00"

public plugin_unit()
{
register_plugin ("HP, 1.00, Nightscream")
register_concmd ("amx_hp", "cmd_hp", ADMIN_SLAY, " ")
}
public cmd_hp(id, level, cid)
{
if(cmd_access(id, level, cid, 3))
return PLUGIN_HANDLED
new Arg1[24]
new Arg2[4]

read_argv(1, Argh1, 23)
read_argv(2, Argh2, 3)

new Health = str_to_num(Arg2)

if (Arg1[0] == '@'
{
new Team = 0

if (equali(Arg1[1], "CT"))
{
Team = 2
} else if (equali(Arg1[1], "T") {
Team = 1
}
new player [32], num
get_players(players, num)

new i
for (i=0; i<num; i++)
{
if (!Team)
{
set_user_health(players[i], Health)
} else {
if (get_user_team(players[i]) == Team)
{
set_user_health(players[i], Health)
}
}
}
} else {
new player = cmd_target(id, Argh1, 1)
if (!player)
{
console_print(id, "Sorry, player %s could not be found or targetted!", Argh1)

return PLUGIN_HANDLED
} else {
set_user_health(player, Health)
}
}
return PLUGIN_HANDLED
}
__________________
- Bye bye!
nightscreem is offline
XxAvalanchexX
Veteran Member
Join Date: Oct 2004
Location: abort73.com
Old 02-17-2005 , 17:08  
Reply With Quote #2

Code:
#include <amxmodx> #include <amxmisc> #include <fun> new PLUGIN[]="HP" new AUTHOR[]="Nightscream" new VERSION[]="1.00" public plugin_unit() { register_plugin ("HP, 1.00, Nightscream") register_concmd ("amx_hp", "cmd_hp", ADMIN_SLAY, " ") } public cmd_hp(id, level, cid) { if(!cmd_access(id, level, cid, 3)) return PLUGIN_HANDLED new Arg1[24] new Arg2[4] new Team; read_argv(1, Arg1, 23) read_argv(2, Arg2, 3) new Health = str_to_num(Arg2) if (Arg1[0] == '@') { Team = 0 } if (equali(Arg1[1], "CT")) { Team = 2 } else if (equali(Arg1[1], "T")) { Team = 1 } new player [32], num get_players(players, num) new i for (i=0; i<num; i++) { if (!Team) { set_user_health(players[i], Health) } else { if (get_user_team(players[i]) == Team) { set_user_health(players[i], Health) } } } } else { new player = cmd_target(id, Arg1, 1) if (!player) { console_print(id, "Sorry, player %s could not be found or targetted!", Arg1) return PLUGIN_HANDLED } else { set_user_health(player, Health) } } return PLUGIN_HANDLED }

It was just a bunch of mis-spelled variables and some syntax errors.
__________________
No longer around. Thanks your support, everyone! As always:
THIS ONES FOR YOU
3000 PTS
XxAvalanchexX is offline
nightscreem
Veteran Member
Join Date: Jul 2004
Location: Belgium
Old 02-17-2005 , 17:42  
Reply With Quote #3

oh i have another question what does argh because i don't understaned it
and what are does this means [24] and (!team) the ! don't know it
i read the scripting doc but sry for this noobish questions i'm learning script
__________________
- Bye bye!
nightscreem is offline
f1del1ty.oXi
Veteran Member
Join Date: Nov 2004
Old 02-17-2005 , 17:46  
Reply With Quote #4

All ! means is false, so for something like that,

if (!player) is just saying if there is no player found, then do some command, else if you could find him, execute the command.

Just like php.
__________________
f1del1ty.oXi is offline
nightscreem
Veteran Member
Join Date: Jul 2004
Location: Belgium
Old 02-17-2005 , 18:08  
Reply With Quote #5

i don't know php but thx
and what does this means [24] is it that it can only have 24 characters
i have another question what does this means
Code:
new customdir[64]
and i wanna make a plugin like
amx_ejl_cmdlistgenerator
but then with menu in the game
Quote:
like i have admin acces abcdefghijklmnopqrstu
and i get all commands in a menu on the server and i can execute them
like you want to set godmode on someone you can push button 3=set godmode
and someone that only got opqrstu get a menu with all commands he can use i hope you understand
__________________
- Bye bye!
nightscreem is offline
nightscreem
Veteran Member
Join Date: Jul 2004
Location: Belgium
Old 02-18-2005 , 10:41  
Reply With Quote #6

HELP
__________________
- Bye bye!
nightscreem is offline
Peli
Veteran Member
Join Date: Mar 2004
Location: San Diego, CA
Old 02-18-2005 , 12:41  
Reply With Quote #7

First of all , people are helping you so stop spamming HELP!! In all your posts... and did you ever read the second part of the scripting tutorial? It will help you understand what these are :
Variables
Arrays
Strings
Peli is offline
Send a message via MSN to Peli
nightscreem
Veteran Member
Join Date: Jul 2004
Location: Belgium
Old 02-18-2005 , 12:59  
Reply With Quote #8

yes i will read it again and again
can someone help me further i have this in my plugin is it
allready good are there some errors in it
Code:
#include <amxmodx> #include <amxmisc> new PLUGIN[]="cmdmenu" new AUTHOR[]="Nighscream" new VERSION[]="0.1" public plugin_unit() {     register_plugin("cmdmenu", "Nightscream", "0.1")     register_concmd("amx_writecmd","admin_writecmd",ADMIN_RCON,"[flags] - makes a commandmenu with this access level")     register_concmd("amx_writeallcmd","admin_writeallcmd",ADMIN_RCON,"- makes all server and client help to a command menu with access flag")
__________________
- Bye bye!
nightscreem is offline
Peli
Veteran Member
Join Date: Mar 2004
Location: San Diego, CA
Old 02-18-2005 , 13:14  
Reply With Quote #9

Well , whenever you use :
Code:
new PLUGIN[]="PLUGINNAME" new AUTHOR[]="AUTHORNAME" new VERSION[]="VERSION"
You have to right : PLUGINNAME , AUTHORNAME and VERSION in the :
Code:
register_plugin( )
So , your plugin should look like :
Code:
new PLUGIN[]="cmdmenu" new AUTHOR[]="Nighscream" new VERSION[]="0.1" public plugin_unit() {    register_plugin("PLUGIN", "AUTHOR", "VERSION")    register_concmd("amx_writecmd","admin_writecmd",ADMIN_RCON,"[flags] - makes a commandmenu with this access level")    register_concmd("amx_writeallcmd","admin_writeallcmd",ADMIN_RCON,"- makes all server and client help to a command menu with access flag") }
Get it?
Peli is offline
Send a message via MSN to Peli
NiGHTFiRE
Senior Member
Join Date: Dec 2004
Location: Sweden
Old 02-18-2005 , 13:17  
Reply With Quote #10

I have a qusetion then. Why do you use this New PLUGIN and new AUTHOR and new VERSION? why dont just type the regester_plugin ()
NiGHTFiRE is offline
Send a message via AIM to NiGHTFiRE Send a message via MSN to NiGHTFiRE
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 19:18.


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