View Single Post
Author Message
Dizzy
Veteran Member
Join Date: Jun 2004
Location: Massachusetts
Old 12-24-2004 , 12:59   A Simple Tutorial
#1

Hello, I'm Dizzy. When I Started Scripting I Thought It Was Hard Like Most People Do. I Know How You Feel. I Made This Simple Tutorial To Get People Like You Who Don't Know How To Script To Learn it Easier.

LOANER: One Of Dizzy's Plugins:
Code:
//This is A Comment... If You Place // Before A Line It Is Not Compiled Into The Plugin /*This is Another Type Of Comment You Can Type As Many Lines As You Want Until You Place This*/ #include <amxmodx>  //This Is An Include. It includes The Mods You Want (Modules Also) #include <fun> //This is A Module. The Fun Module It is included in this plugin #include <cstrike> //This is the Module That makes this plugin for CS (Or has something needed) new bool:hasloaned[32] //new bool: (as in a new phrase) hasloaned (The Phrase) [32] (An Array) public plugin_init() //This is the public that starts the plugin registration { //This is The Bracket To Start A Plugin Public register_plugin("Loaner","1.0","Dizzy") //This is where you put the Name,Verision,and Author //----------------------------------------- //CVARS //----------------------------------------- register_cvar("sv_loan","1") //This is a cvar. This is a command that you can shut off and on a plugin or used for other things register_cvar("sv_loanmoney","1") //Another Cvar register_cvar("sv_loanhealth","1") // Another Cvar //----------------------------------------- //CLIENT COMMANDS //----------------------------------------- register_clcmd("say /loanmoney","money") //This is A Client Command It is said by clients (players) in game register_clcmd("say /loanhealth","health") //Another Client Command //----------------------------------------- //CONSOLE COMMANDS //----------------------------------------- register_concmd("loanmoney","money") // This is A Console Command It Is Used When Typed In The Console register_concmd("loanhealth","health") // Another Console Command //----------------------------------------- //EVENTS //----------------------------------------- register_event("ResetHUD","roundchange","b") // This Is An Event This Takes Place When Registered. (Every Round Reset) //----------------------------------------- } //The Closing Bracket public client_connect(id) { //This is A Public Connect (When Client (player) connects) hasloaned[32] = false (Using Our (new bool:) we use the phrase hasloaned[32] = false) That states that on connect the client has not loaned } public client_disconnect(id) { //Here it states the same thing but only on the disconnect hasloaned[32] = false } public money(id) //This is The Start Of Our Money Public (Above We put register_clcmd("say /loanmoney","money") The Money States To Go To The public money { if (get_cvar_num("sv_loan")==0) // This checks if the cvar is on return PLUGIN_HANDLED //As you see above it isn't soo it return PLUGIN_HANDLED (which ends the plugin) if (get_cvar_num("sv_loanmoney")==0) // This checks the other cvar return PLUGIN_HANDLED // And returns it :) cs_set_user_money(id, cs_get_user_money(id) + 500) //If all passes it continues the money part and sets there money gets it and adds 500 // the cs_set_user_money above means it needs CS (Counter-Strike) That's why we need the cstrike module :) public health(id) //This is the start of our health one (we nickname the health (id)) { if (get_cvar_num("sv_loan")==0) return PLUGIN_HANDLED if (get_cvar_num("sv_loanhealth")==0) return PLUGIN_HANDLED set_user_health(id, get_user_health(id) + 10) hasloaned[id] = true return PLUGIN_CONTINUE } public roundchange(id) // This is the event roundchange and it states { if hasloaned[id] = true //if they have loaned (if hasloaned[id] = true) it stops the plugin Basically saying if they loaned already don't let them do it again)(And It stop/continues the plugin) return PLUGIN_CONTINUE } // end of the plugin

Hope This Helps You Guys Out! Please Comment If You Have A Concern.
Thanks!
__________________
My Plugins

Purchase Mod - Stable
Type Sounds - Stable
Monster Spawner - Stable
Nade Giver - Maintenance
Dizzy is offline
Send a message via AIM to Dizzy