Slyz, thanks a lot for the function, it's working perfectly!
The code looks like this now, for anyone interested:
void main(string sender, string message)
{
if(contains_text(message, "buff"))
{
int numcasts = to_int(message);
boolean buff( skill buff, int numcasts, string sender )...