View Single Post
bigdaddy424
Senior Member
Join Date: Oct 2021
Location: Jupiter
Old 04-16-2024 , 21:00   Re: Ultimate Break Message v1.1
Reply With Quote #4

great idea, although your works lacks readability because its in someway hardcoded
  • use charsmax
  • put `get_mapname` in `plugin_init`, map name will never change
  • extensive use of `dir_exists` and `mkdir`, just create one directory on /configs and use `file_exists` pointing directly to end file and use a proper name on naming directory, dont promote your name. eg:configs/map_breakables/mapname.json should be just fine i suppose
  • `is_user_connected` is pointless
  • `entity_get_edict` doest return -1 but 0 read:https://www.amxmodx.org/api/engine/entity_get_edict
    `entity_get_edict2` returns -1 read:https://www.amxmodx.org/api/engine/entity_get_edict2
    _edict2 is recommended from devs being 'safer'
  • extensive use of `get_user_team` if/else statements, do this instead if you want to put a team name
    PHP Code:
    new const Teams[][] =
    {
        
    "UNASSIGNED",
        
    "Terrorist",
        
    "Counter-Terrorist",
        
    "Spectator"
    }
    server_print "Team %s"Teams[get_user_team(id)] 
  • or use maching team color on their name, its self explanatory and makes this plugin great for other gamemodes eg: `client_print_color(id, id, "^3%n ^1broke a structure", id)`
  • since youre dropping support for lower versions use `bind_pcvar_num` combined with `create_cvar`
  • reconstruct `ct_enitityname`
    PHP Code:
    public ct_enitityname(entity_name[], output[], len)
    {
        new 
    cells_written json_object_get_string(datajsonentity_nameoutputlen)
        if (!
    cells_written)
            
    copy(outputlen"a structure")

  • i would totally remove `send_to_admins` and send it to everyone, but id recommend having a cvar to toggle between sending the break entity message to your teammates & spectators or to everybody
__________________
bigdaddy424 is offline