peace-maker / smrpg

A generic RPG plugin for SourceMod
87 stars 39 forks source link

Adding new feature #68

Closed tellekx3 closed 8 years ago

tellekx3 commented 8 years ago

Hi there! I am running your SM:RPG plugin for almost year and I must admit that you've done such a great job! Unfortunaly my sourcepawn skills ain't high enough to make it by myself so I've decided to ask you about those featuers, which may help not only me, but also other plugin user and make your plugin even better. But back to the point, The feature I'd like to ask for is cvar sm_exp_kill_flag. This cvar have to work same like sm_exp_kill and it have to works only for players with certain flag (for example flag s) and make us able to set higher exp for people with described above flag. Please let me know your state about my suggestion, hope to see it implemented soon. Best regards and keep up your great work!

peace-maker commented 8 years ago

This would need to blend with different experience settings per weapon in configs/smrpg/weapon_experience.cfg. We could add an "admin_flag" key in there, which would override other matching entries. I'd rather have a different config file to override all experience values based on the reason why the experience were given instead of only for ones which involve a weapon. So you can override the experience for e.g. planting a bomb as well.

You can do it lazily in a small plugin yourself until i get around to do it properly. Like

#include <smrpg>
public Action:SMRPG_OnAddExperience(client, const String:reason[], &iExperience, other)
{
  if (CheckCommandAccess(client, "smrpg_vip", ADMFLAG_CUSTOM1, true))
  {
    // smrpg_cstrike plugin uses cs_playerkill as reason, the base smrpg uses ExperienceReason_PlayerKill ("def_playerkill")
    // This just adds to the experience including any bonus experience that might be included for a weapon or an headshot.
    if (StrEquals(reason, "cs_playerkill") || StrEquals(reason, ExperienceReason_PlayerKill))
    {
      iExperience = RoundToNearest(iExperience * 1.2); // Give 20% extra XP on kill for players with the custom1 flag.
      return Plugin_Changed;
    }
  }
  return Plugin_Continue;
}

The only disadvantage of this is, that you don't really change the value of smrpg_exp_kill, but the end result after further calculations. experience for kill = victimlevel * smrpg_exp_kill + smrpg_exp_kill_bonus (+ headshot_experience?)

Nobody-x commented 8 years ago

I edited the XP system to give more credits to any people who put the public community tag or the admin tag on m'y server (with cvar to edit tags and amount). Merged with a flag system Will be powerfull i think

Nobody-x commented 8 years ago

(Sry double post for code highlight)

A config file for xp like that would be great :

xpcredit {
    {
         "type" "default"
         "credit" "5" // or
         "credit_multiply" "1.2"
         "xp" "2" // or
         "xp_multiply" "1.2"
    }
    {
         "type" "tag"
         "label" "TagCommunity"
         "credit" "5" // or
         "credit_multiply" "1.2"
         "xp" "2" // or
         "xp_multiply" "1.2"
    }
    {
         "type" "flag"
         "label" "r"
         "credit" "5" // or
         "credit_multiply" "1.2"
         "xp" "2" // or
         "xp_multiply" "1.2"
    }
}
tellekx3 commented 8 years ago

@peace-maker code you gave gives error during compiling: (this is with changed .inc files location in smrpg.ini)

SourcePawn Compiler 1.8.0-dev+5439 Copyright (c) 1997-2006 ITB CompuPhase Copyright (c) 2004-2015 AlliedModders LLC

plugin.sp(8) : error 017: undefined symbol "StrEquals"

1 Error.

Also my local sourcemod compiler (1,73 dev on windows) is giving error:

path\plugin.sp(0) : fatal error 182: cannot read from file: path\plugin.sp

in plugin.sp i have same code as u posted above. All .inc files are in correct places. Any ideas how to fix or make it works? Thank you in advance.

tellekx3 commented 8 years ago

@up I've just used StrEqual instead of StrEquals and it worked on online compiler but local one still's giving an error.

Hetachi commented 8 years ago

@tellekx3 This code worked for me fully and compiled without errors using dev build sourcemod compiler.

public Plugin:myinfo = 
{
    name = "SM:RPG Upgrade > Poison Smoke",
    author = "Jannik \"Peace-Maker\" Hartung",
    description = "Poison Smoke upgrade for SM:RPG. Damages players standing inside the smoke of a smoke grenade.",
    version = "1",
    url = "http://www.wcfan.de/"
}

#include <smrpg>
public Action:SMRPG_OnAddExperience(client, const String:reason[], &iExperience, other)
{
  if (CheckCommandAccess(client, "smrpg_vip", ADMFLAG_RESERVATION, true))
  {
    // smrpg_cstrike plugin uses cs_playerkill as reason, the base smrpg uses ExperienceReason_PlayerKill ("def_playerkill")
    // This just adds to the experience including any bonus experience that might be included for a weapon or an headshot.
    if (StrEqual(reason, "cs_playerkill") || StrEqual(reason, ExperienceReason_PlayerKill))
    {
      iExperience = RoundToNearest(iExperience * 1.2); // Give 20% extra XP on kill for players with the custom1 flag.
      return Plugin_Changed;
    }
  }
  return Plugin_Continue;
}
tellekx3 commented 8 years ago

I've already tested plugin that i compiled using online compiler. Seems it works fine exp is multiplied correctly, no crashes yet. I'll report if some issue occure :) Thank you for all replies!

peace-maker commented 8 years ago

plugin.sp(8) : error 017: undefined symbol "StrEquals"

Whops, that should be StrEqual. I wrote up that code without looking up the correct native names again..

crashzk commented 5 years ago

@peace-maker do you plan to include this suggestion in future plugin updates?

And it would be nice if you could modify the percentage option that a privileged player earns XP in a cvar.