AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   im new with a couple of questions (https://forums.alliedmods.net/showthread.php?t=13899)

shockdoN 06-01-2005 23:54

im new with a couple of questions
 
Hey guys, the topic says it all, im getting into coding in small/amx plugins after my take with PHP/MySQL/HTML/ect ect, I have a few questions before coding some real plugins though. I've been reading up on how to code amx plugins using small for awhile now but still dont exactly understand how to register a command that would be activiated in messagemode1, as in a pug system would use .ready/.notready in messagemode1. I only see console command registering from the documents and what not, and the second question would be how can I set the access rights to just plain public so anyone can use the command, and finally, whats a good access to use if im having the connecting user's steamid checked through a MySQL database to see if their a member. Should I maybe make in the database a column access, and then read their steamid + access for that steamid and then make a variable to react as the access? I dont know guys! Im so lost, hopefully you guys are friendly and help the new guy out :D

slurpycof 06-02-2005 00:58

Code:
public plugin_init(){ register_clcmd("say","check_ready",-1,"Check for ready/not ready" } public check_ready(id, level, cid){     new message [192]     read_args(message, 190)     remove_quotes(message)     if (containi(message,".notready")!=-1) {         //do something         return PLUGIN_HANDLED     }else if(containi(message,".ready")!=-1){         //do something else         return PLUGIN_HANDLED     }     return PLUGIN_CONTINUE }

You can use admin_sql.amxx instead of re-creating it yourself

shockdoN 06-02-2005 19:01

alright, thanks alot, one more question though if you're willing to answer. How would I go about enabling what is said after first word check, for example in your coding it checks to see if the word said is either .ready/.notready and then goes to the function, how would i go about like .stats enable/.stats disable ? :/

shockdoN 06-02-2005 19:25

wait, i should just use read_argc's right?;o

WaZZeR++ 06-03-2005 10:02

or just chech the hole string ".stats enable" and ".stats disable"
or another way:
Code:
if (containi(message,".stats")!=-1) {     if (containi(message,"enable")!=-1) {         //do the thing         return PLUGIN_HANDLED     }else if (containi(message,"disable")!=-1) {         //do the thing         return PLUGIN_HANDLED     }     return PLUGIN_HANDLED     }


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

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