AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   scripting questions (https://forums.alliedmods.net/showthread.php?t=10376)

nightscreem 02-17-2005 16:39

scripting questions
 
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
}

XxAvalanchexX 02-17-2005 17:08

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.

nightscreem 02-17-2005 17:42

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 :D

f1del1ty.oXi 02-17-2005 17:46

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. :D

nightscreem 02-17-2005 18:08

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

nightscreem 02-18-2005 10:41

HELP :!: :!:

Peli 02-18-2005 12:41

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

nightscreem 02-18-2005 12:59

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")

Peli 02-18-2005 13:14

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?

NiGHTFiRE 02-18-2005 13:17

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 ()


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

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