Author Topic: looping through a single command...Testing loop but not working....  (Read 1130 times)

Now we just need to convince Reaper to make non-private mods.

Now we just need to convince Reaper to make non-private mods.
Because 5-minute mods requiring help need to be released?

Because 5-minute mods requiring help need to be released?
I guess not... Still, some of them are kinda nice.

In my view:
Code: [Select]
function servercmdSlap(%client, %victim, %repeats, %force)
{
    if(%repeats < 1)
        return;
    %repeats--;
    findclientbyname(%victim).player.addvelocity("0 0 "@%force@");
    schedule(100, 0, servercmdaddvelocity, %client, %victim, %repeats, %force);
    commandToClient(%victim,'centerprint',"You've been slapped by"@ %client.name,3);  
}

Should add /slap NameToSlap HowManyTimesToSlap ForceToGoUp

Screw at 1 line version i don't think works:
Code: [Select]
function servercmdSlap(%client, %victim, %repeats, %force){ if(%repeats < 1) { return; } %repeats--; findClientByName(%victim).player.addVelocity("0 0 "@%force@"); schedule(100, 0, servercmdaddvelocity, %client, %victim, %repeats, %force); commandToClient(%victim, centerprint,"You've been slapped by "@%client.name@"!"); }Please notice that i just tried the above 1 line code for fun, and I don't think it works.
1 thing, it's too large for the console anyway ^_^
« Last Edit: September 23, 2009, 02:30:55 AM by Tickle »

Eeeew %client.name
I also took the hand in fixing your code for you.
Code: [Select]
function servercmdSlap(%client, %victim, %times, %force)
{
    if(%times < 1)
        return;
    %times--;
    findclientbyname(%victim).player.addvelocity("0 0 "@%force);
    commandToClient(%victim,'centerprint',"You've been slapped by"@ %client.getPlayerName(),3);   
}
All better, though I'm not sure about the centerprint.
« Last Edit: September 23, 2009, 03:50:14 PM by Jimmg »

Thanks this should help alot.