AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Plugins (https://forums.alliedmods.net/forumdisplay.php?f=108)
-   -   [CSS] Laser Aim (https://forums.alliedmods.net/showthread.php?t=117943)

Leonardo 02-06-2010 12:32

[CSS] Laser Aim
 
2 Attachment(s)
Name:
Laser Aim
Description:
Creates A Beam For every times when a Snipers Rifle in arms
Changelogs:
Spoiler

CVars:
PHP Code:

    // Get plugins version
    
sm_laser_aim
    
// Enable/disable plugin
    
sm_laser_aim_on 1
    
// Beam/dot color
    
sm_laser_aim_red 200
    sm_laser_aim_green 0
    sm_laser_aim_blue 0
    sm_laser_aim_alpha 150
    
// Beam size
    
sm_laser_aim_width 2
    
// Dot size
    
sm_laser_aim_dot_width 2 


usla 02-06-2010 16:15

Re: Laser Aim
 
very nice man

bouncer 02-06-2010 21:02

Re: [CSS] Laser Aim
 
Sweet... is this possible for Insurgency maybe? Would love it!

bouncer 02-07-2010 00:39

Re: [CSS] Laser Aim
 
Hey I tried modifying your plugin to show lasers for only Marines team at the moment for INS, but with no luck, it compiled and all but it just didn't show any lasers, would you know why?

Here is the source http://pastebin.com/m76bc3364

Leonardo 02-07-2010 04:29

Re: [CSS] Laser Aim
 
maybe weapon names is incorrect?
in CSS this is weapon_*
and check, do you need <player team>?

bouncer 02-07-2010 12:42

Re: [CSS] Laser Aim
 
I don't believe that it is weapon_ in Insurgency. But the team numbers do switch depending on the map. It goes like this...

Code:

public OnMapStart()
{
    decl String:mapname[64];
    GetCurrentMap(mapname, sizeof(mapname));
    if (strcmp(mapname, "ins_karam") == 0 || strcmp(mapname, "ins_baghdad") == 0)
    {
        INSURGENTS = 1;
        MARINES = 2;
    }
    else
    {
        MARINES = 1;
        INSURGENTS = 2;
    }
}

Could you try to develop lasers for INS? So that when players walk around they have a laser sticking out and they can turn on and off the laser through a laser menu such as !lasers and the color of it on that menu?

Leonardo 02-08-2010 02:17

Re: [CSS] Laser Aim
 
Unfortunately, I dont know what is it "Insurgency" ^_^
but try to use function OnMapSpawn. for checking on every rounds before event round_start.
and.... maybe not "strcmp", but this: StrContains(string_a ,string_b)>=-1
and for "menu" should use ConCommands, for example, "+toggleLaser"/"-toggleLaser".
personal setting must be in arrays... for example: new PlayerSettings[<clientID>][<settingID>][<lengthOfSettingsValue>]


and can anyone say, whats wrong here?
Code:

        g_CvarWeapons = CreateConVar("sm_laser_aim_weapons", "weapon_awp|weapon_scout", "List of weapons", FCVAR_NOTIFY);
Code:

        new bool:b_playerNeededWeapon;
        b_playerNeededWeapon = false;
        new String:s_neededWeaponList[128];
        GetConVarString(g_CvarWeapons, s_neededWeaponList, sizeof(s_neededWeaponList));
        new a_playerWeaponTemp[12][32];
        str_piece(s_neededWeaponList, a_playerWeaponTemp, sizeof(a_playerWeaponTemp), sizeof(a_playerWeaponTemp[]) - 1, '|');
        for(new i = 0; i < sizeof(a_playerWeaponTemp); i++)
        {
                if (StrEqual(a_playerWeaponTemp[i], s_playerWeapon))
                {
                        b_playerNeededWeapon = true;
                }
        }

Code:

stock str_piece(input[], output[][], outputsize, piecelen, token = '|')
{
 new i = -1, pieces, len = -1 ;
 
 while ( input[++i] != 0 )
 {
  if ( input[i] != token )
  {
  if ( ++len < piecelen )
    output[pieces][len] = input[i] ;
  }
  else
  {
  output[pieces++][++len] = 0 ;
  len = -1 ;
 
  if ( pieces == outputsize )
    return pieces ;
  }
 }
 return pieces + 1;
}


Black Haze 02-08-2010 07:24

Re: [CSS] Laser Aim
 
Quote:

Originally Posted by bouncer (Post 1081166)
Hey I tried modifying your plugin to show lasers for only Marines team at the moment for INS, but with no luck, it compiled and all but it just didn't show any lasers, would you know why?

Here is the source http://pastebin.com/m76bc3364

I can't test this cause I can't stand that lagging piece of sh*t game ;), but get rid of the if statement with all the weapons in it, so everyone has a laser. See if that works in Insurgency first.

If after you compile that code everyone suddenly has lasers, then you did something wrong with the if statement.

If noone still has lasers, then this code just won't work for ins and you'll have to rewrite parts.

Black Haze 02-08-2010 07:32

Re: [CSS] Laser Aim
 
Quote:

Originally Posted by Leonardo (Post 1082420)
Unfortunately, I dont know what is it "Insurgency" ^_^
but try to use function OnMapSpawn. for checking on every rounds before event round_start.
and.... maybe not "strcmp", but this: StrContains(string_a ,string_b)>=-1
and for "menu" should use ConCommands, for example, "+toggleLaser"/"-toggleLaser".
personal setting must be in arrays... for example: new PlayerSettings[<clientID>][<settingID>][<lengthOfSettingsValue>]


and can anyone say, whats wrong here?
Code:

        g_CvarWeapons = CreateConVar("sm_laser_aim_weapons", "weapon_awp|weapon_scout", "List of weapons", FCVAR_NOTIFY);
Code:

        new bool:b_playerNeededWeapon;
        b_playerNeededWeapon = false;
        new String:s_neededWeaponList[128];
        GetConVarString(g_CvarWeapons, s_neededWeaponList, sizeof(s_neededWeaponList));
        new a_playerWeaponTemp[12][32];
        str_piece(s_neededWeaponList, a_playerWeaponTemp, sizeof(a_playerWeaponTemp), sizeof(a_playerWeaponTemp[]) - 1, '|');
        for(new i = 0; i < sizeof(a_playerWeaponTemp); i++)
        {
                if (StrEqual(a_playerWeaponTemp[i], s_playerWeapon))
                {
                        b_playerNeededWeapon = true;
                }
        }

Code:

stock str_piece(input[], output[][], outputsize, piecelen, token = '|')
{
 new i = -1, pieces, len = -1 ;
 
 while ( input[++i] != 0 )
 {
  if ( input[i] != token )
  {
  if ( ++len < piecelen )
    output[pieces][len] = input[i] ;
  }
  else
  {
  output[pieces++][++len] = 0 ;
  len = -1 ;
 
  if ( pieces == outputsize )
    return pieces ;
  }
 }
 return pieces + 1;
}


I'm not seeing exactly what you are trying to do, but if you're trying to check the equiped weapon against the allowed weapons, I suggest you just make as many cvars as there are weapons, like "sm_laseraim_weapon_awp 1", it'll make things easier on your end user, and on you, since you could just check this by using a switch statement.

If this was not where you where going for, ignore me :p

Leonardo 02-08-2010 14:44

Re: [CSS] Laser Aim
 
in some ES script I found this:
Code:

es_xsetinfo gunlist "awp"
es es_xsetinfo playergun event_var(es_userweapon)
es_xstring playergun replace "weapon_" ""
if (server_var(playergun) in server_var(gunlist)) do
{
es_tell event_var(userid) This weapon founded in list!
}

how this idea can be wrote on SM ?


All times are GMT -4. The time now is 18:16.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.