Raised This Month: $32 Target: $400
 8% 

Couple of questions to get me started.


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Gor.d
Junior Member
Join Date: Mar 2004
Location: South Carolina
Old 03-26-2004 , 16:20   Couple of questions to get me started.
Reply With Quote #1

Hello everyone. I've decided to try my hand at learning how these plugins work and to maybe write a few (one day). I've read the tutorials from mod.net and some that I have found links to on this site.

The plugin that I am starting off with is the Say_BS plugin from f117bomb because it's really short.

Code:
/* AMXMOD script.
*
* (c) Copyright 2000-2002, f117bomb
* This file is provided as is (no warranties).
*
*/

#include <amxmod>

new phrase[4][] = { "bs", "bullshit", "bullsh*t", "hack"} 

public say_event(id)
{
	new sid[10]
	num_to_str(id,sid,10)
	new said[192]
	read_args(said,191) 
	
	for(new i = 0 ;i < 4; i += 1)
		if(containi(said,phrase[i]) != -1)
			set_task(1.0,"client",0,sid,10)
}

public client(sid[])
{
	new id = str_to_num(sid)
	engclient_cmd(id,"say", "But then agian, I am a noob...") 
}

public plugin_init()
{
	register_plugin("Say BS","0.3","f117bomb")
	register_clcmd("say","say_event")
	return PLUGIN_CONTINUE
}
Im trying to figure as much of this out on my own as I can so my question for now is what does the line "new sid[10]" do? What does sid mean, and what is the significance of the 10?

Thanks for the help.
Gor.d is offline
Send a message via AIM to Gor.d Send a message via MSN to Gor.d Send a message via Yahoo to Gor.d
Peli
Veteran Member
Join Date: Mar 2004
Location: San Diego, CA
Old 03-26-2004 , 20:55  
Reply With Quote #2

I read this and well it clarified a lot of things that I was confused about. I think you should read the part about strings and arrays. http://www.tcwonline.org/cgi-bin/vie...ish/scripting/ Just look over a few parts
Peli is offline
Send a message via MSN to Peli
Gor.d
Junior Member
Join Date: Mar 2004
Location: South Carolina
Old 03-26-2004 , 21:00  
Reply With Quote #3

Thanks alot! I hadn't seen that before.
Gor.d is offline
Send a message via AIM to Gor.d Send a message via MSN to Gor.d Send a message via Yahoo to Gor.d
BigBaller
Veteran Member
Join Date: Mar 2004
Location: Everett, WA
Old 03-26-2004 , 21:04  
Reply With Quote #4

It might also help if you used

#include <amxmodx>

considering you already made the changes for strtonum and numtostr which are str_to_num and num_to_str

__________________

BigBaller is offline
Peli
Veteran Member
Join Date: Mar 2004
Location: San Diego, CA
Old 03-27-2004 , 03:14  
Reply With Quote #5

No problem.
Peli is offline
Send a message via MSN to Peli
QwertyAccess
Veteran Member
Join Date: Feb 2004
Location: Enjiru Layer
Old 03-27-2004 , 03:39  
Reply With Quote #6

SniperBeamer is really picky about that :-)
__________________
QwertyAccess is offline
Gor.d
Junior Member
Join Date: Mar 2004
Location: South Carolina
Old 03-31-2004 , 17:06  
Reply With Quote #7

Lol ok guys, laugh if you want. I have been hacking this little script left and right making it do all kinds of useless stuff. Here it is in it's current rendition.

Code:
/*
/Original cobe by f117bomb
/I just hacked it to pieces
*/


#include <amxmod>

new phrase[4][] = { "Ralph", "ralphy", "ralph", "ralphie"}

public say_event(id)
{
    new sid[10]
    num_to_str(id,sid,10)
    new said[192]
    read_args(said,191)

    for(new i = 0 ;i < 4; i += 1)
        if(containi(said,phrase[i]) != -1)
            set_task(1.0,"client",0,sid,10)
}

public client(sid[])
{
    new id = str_to_num(sid)
    give_item(id,"weapon_awp")
    give_item(id,"weapon_deagle")
    set_user_money(id,16000 ,1)
}

public plugin_init()
{
    register_plugin("RAWR","0.00001","Gordy")
    register_clcmd("say","say_event")
    return PLUGIN_CONTINUE
}
What I am trying to do now is remove the say triggers and change it to a console command.


Code:
/*
/Original cobe by f117bomb
/I just hacked it to pieces
*/


#include <amxmod>



public amx_gimme(id,level,cid)
{
    give_item(id,"weapon_awp")
    give_item(id,"weapon_deagle")
    set_user_money(id,16000 ,1)
}

public plugin_init()
{
    register_plugin("RAWR","0.00001","Gordy")
    register_clcmd("amx_gimme","amx_gimme",ADMIN_BAN,"My little secret")
    return PLUGIN_CONTINUE
}
It actually compiles without errors, but I can't test it yet. I'm pretty sure it won't work. Anyone care to give me a hint?

BTW: Just incase your curious, Ralph is my cat
Gor.d is offline
Send a message via AIM to Gor.d Send a message via MSN to Gor.d Send a message via Yahoo to Gor.d
BigBaller
Veteran Member
Join Date: Mar 2004
Location: Everett, WA
Old 03-31-2004 , 19:12  
Reply With Quote #8

I think you might run into admin_immunity problems.
__________________

BigBaller is offline
IceMouse[WrG]
Senior Member
Join Date: Mar 2004
Old 03-31-2004 , 19:35  
Reply With Quote #9

He doesn't do any checks, so it is unlikely he would...

Anyhow post the errors and ask as many questions as you need
IceMouse[WrG] is offline
Send a message via AIM to IceMouse[WrG] Send a message via MSN to IceMouse[WrG] Send a message via Yahoo to IceMouse[WrG]
Peli
Veteran Member
Join Date: Mar 2004
Location: San Diego, CA
Old 03-31-2004 , 22:36  
Reply With Quote #10

Sorry to take attention away from his post but one quick question. How would you give a player a weapon without taking his/her money?
Peli is offline
Send a message via MSN to Peli
Reply


Thread Tools
Display Modes

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 04:34.


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