Raised This Month: $ Target: $400
 0% 

2 questions


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Casio
Member
Join Date: Jan 2005
Old 04-18-2005 , 09:54   2 questions
Reply With Quote #1

I have a couple of questions here and I am hoping someone will be kind enough to take a few seconds to answer them for me.
Ok here we go.


1. In Visual Basic they are 2 commands "replace()" and "instr()".

The "replace()" command searches a variable for a string and if it is found it replaces that string with another string.

The "instr()" command searches a variable for a string and returns where abouts in the variable the string occurs.

Please can anyone tell me the SMALLTALK equivalents of these 2 commands? and if they are any example uses of them in an AMXX plugin somewhere?


2. Is there an online list where I can find all the commands for SMALLTALK? I can't understand the include files that well lol.


Much thankyou in advance.
Casio.
Casio is offline
PM
hello, i am pm
Join Date: Jan 2004
Location: Canalization
Old 04-18-2005 , 10:16  
Reply With Quote #2

Hah, well, first off, the language AMXX is using is not SmallTalk, but Small (C). Most of the language is a subset of the famous C programming language.

Also note that the language itslef doesn't provide any functions -- all "natives" are provided either by the AMXX core or by one of the modules.

http://www.amxmodx.org/funcwiki.php?go=func&id=45 <-- equivalent of InStr

Replacing all occurencies: You'd have to do a loop I think; Or you can just use xs_replace from xs.inc ;)
__________________
hello, i am pm
PM is offline
Casio
Member
Join Date: Jan 2005
Old 04-18-2005 , 15:52  
Reply With Quote #3

Awesome! thankx for these PM you are the man!

I am planning on using these commands to modify the "gag" command in ADMINMODX to compensate for a minor flaw in its design which allows the the gagged player, to ungag themself. I don't know if posting exploits is allowed here so I won't point it out.
P.S I do mean the "gag" command not the "shutup" command .
Casio is offline
Casio
Member
Join Date: Jan 2005
Old 04-18-2005 , 17:19  
Reply With Quote #4

Typical nothing is as easy as I imagine it to be lol.
Ok, my idea is when an admin gags a player, their STEAMID (surrounded by commas ( , ) ) is stored in a huge string variable and when that player speaks, the code will search that huge string variable for the player's STEAMID and if it is found then block the chat.
Unfortunately since I am relatively new to this language I am having difficulty handling the string variables at the point where I am trying to add the steamid to the huge string variable.
Here is what I have tryed so far (using most of the author's existing code, I said I was new to this :p):

Code:
#include <amxmodx> #include <amxmisc> #include <fakemeta> #include <fun> #include <lang> #include <xs> new g_gagged[510]   // To store SteamID of who are gaged public gag(id, level, cid) {     if(!cmd_access(id, level, cid, 2))         return PLUGIN_HANDLED     new cmd[32], playerName[32]     read_argv(0, cmd, 31)     read_argv(1, playerName, 31)     remove_quotes(playerName)     // Search for the Player     new player_id = get_player(playerName)     new steamAgainst[32]     get_user_authid(player_id, steamAgainst, 31)     if(equal(cmd, "amx_gag"))     {         //g_gagged = g_gagged & "," & steamAgainst & ","         new len = strlen(g_gagged)         //g_gagged[len] = g_gagged[len] & "," & steamAgainst & ","         //g_gagged[len] = g_gagged[len] & "," & steamAgainst & ","         g_gagged[len] = g_gagged[len] + "," & steamAgainst + ","     } }

I cannot get the hang of the indexes in the variables , can you tell me is my modified code anywhere near correct?
Casio is offline
Reply



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 10:00.


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