as the topic says.. i want to have every first letter of the sentence be uppercase,
add a space after every dot if not already done,
and add a dot to the end (couldnt figure this out)
but ingame it does nothing
Code:
#include <amxmodx>
new isreal
public plugin_init() {
register_plugin("Clean Say", "1.0", "noob")
register_clcmd("say", "check_say", 0)
}
public check_say(id) {
if(!isreal) { // dont stop the msg sent by the plugin
isreal = 1
return PLUGIN_CONTINUE
}
isreal = 0
new arg[64]
read_args(arg,63)
cleanit(arg[63])
client_cmd(id, "say %s", arg) // repeat the clean string as say
return PLUGIN_HANDLED
}
stock cleanit(arg[]) {
if(equal(arg[0],"@")) // this is meant to adminchat plugin, abort
return arg
new leftsay[64], rightsay[64]
ucfirst(arg[63]) // make the first letter uppercase
for(new i = 0; i < 63; ++i) {
if(equal(arg[i], ".")) {
if(equal(arg[i-1],".") || equal(arg[i+1],".")) // check if there were 2 dots in a row. if found, skip it
continue
strtok(arg, leftsay,63, rightsay,63, '.') // split the saying to two parts
ucfirst(rightsay[63]) // make the first letter after the dot uppercase
format(arg,63, "%s. %s", leftsay, rightsay) // join them together again
}
}
return arg
}