AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Help with first plugin please (https://forums.alliedmods.net/showthread.php?t=13188)

BRUm 05-07-2005 14:42

Help with first plugin please
 
Hi, i've decided to make a simple plugin. The basic and only origional idea I could think of, was to make, on map startup, a message being displayed on every player's HUD, and their health being set to a random amount.

I've got this so far, and have got stuck :(

Code:
#include <amxmodx> new PLUGIN[]="Nerd's revenge" new AUTHOR[]="BRUm" new VERSION[]="1.00" public plugin_init() {      register_plugin(PLUGIN, VERSION, AUTHOR)      register_concmd("admin_nerd", "cmd_nerd", ADMIN_CHAT, "admin_nerd") } public cmd_nerd(id, level, cid) {      //This will check if the user calling the command has the right access level.        if (!cmd_access(id, level, cid, 0)) {           //This terminates the command           return PLUGIN_HANDLED      }      //This prints a message to all clients      client_print(0, print_chat, "YoU hAvE bEeN cUrSeD bY tEh EvIl nErD!")      return PLUGIN_HANDLED }

teame06 05-07-2005 14:59

Code:
#include <amxmodx> #include <amxmisc> #include <fun> new PLUGIN[]="Nerd's revenge" new AUTHOR[]="BRUm" new VERSION[]="1.00" public plugin_init() {     register_plugin(PLUGIN, VERSION, AUTHOR)     register_concmd("admin_nerd", "cmd_nerd", ADMIN_CHAT, "admin_nerd") } public cmd_nerd(id, level, cid) {     //This will check if the user calling the command has the right access level.     if (!cmd_access(id, level, cid, 0)) {     //This terminates the command         return PLUGIN_HANDLED     }     //This prints a message to all clients     client_print(0, print_chat, "YoU hAvE bEeN cUrSeD bY tEh EvIl nErD!")     // Variable that hold information     new Players[32]     new playerCount     new player     // Get players only that are alive     get_players(Players, playerCount, "a")     for (new i=0; i<playerCount; i++)     {         new randomhealth         // player hold the index of the player.         player = Players[i]         // Random a number from 1 to 255 for health         randomhealth = random_num(1, 255)         if(is_user_connected(player) && is_user_connected(player))         {             // Set user health from  (Any number above 255 will not display correctly on the health bar.)             set_user_health(player, randomhealth)         }     }     return PLUGIN_HANDLED } /*small  /small*/

v3x 05-07-2005 15:20

Code:
if (!cmd_access(id, level, cid, 1)) {

BRUm 05-07-2005 15:28

lol thanks guys... Miming posts, wow! heheh :D

BRUm 05-07-2005 15:34

Code:
 new Players[32]
Is this an array? And how come you've set it to 32?

Code:
   // Get players only that are alive     get_players(Players, playerCount, "a")     for (new i=0; i<playerCount; i++)     {         new randomhealth         // player hold the index of the player.         player = Players[i]

Also, could you explain what the 'i's are, and why the '++? And, what's the index of the player?

Thanks :D

teame06 05-07-2005 15:44

http://www.amxmodx.org/doc/source/scripting/index.htm

You need to read this. Then if you don't understand i'll try to help you.

BRUm 05-07-2005 17:03

lol.. the amount of times i've studied that guide, and the huge pdf.. :shock:

teame06 05-07-2005 17:47

That the smallest tutorial guide compare to the one at that other website about small. Like i said if you don't understand it after reading it. i'll help you.

v3x 05-07-2005 22:08

Go here.

BRUm 05-08-2005 03:04

Ok i've had a look at boths tutorials. I understand the arithmatic, but none of the tutorials show specific amxx coding, like commands for health, and players and stuff. Know where I could find one?


All times are GMT -4. The time now is 16:35.

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