Results 1 to 2 of 2
  1. #1
    TrollerCoaster's Avatar
    Join Date
    Sep 2010
    Gender
    male
    Location
    I am a fish
    Posts
    633
    Reputation
    61
    Thanks
    798

    [Solved]Subtracting and adding strings?

    Okay, so I want to do something like this:

    This is your current gun:
    usp_mp

    I want to subtract _mp from it:
    usp

    then add _xmags_mp to it:
    usp_xmags_mp

    But I want it to work with every gun, but I can't get the string functions to work(strtok, getsubstr, etc.) with the gun names.

    Code:
    	self.currentWeapon = self getCurrentWeapon();
    		newaawep = strtok(self.currentWeapon, "_");
    		newaawep += "xmags_mp"; // or _xmags_mp ??
    I tested that, and it's not returning a proper, or valid string value ( it is not a console error, just isn't returning a string ).
    So how can I do something like what I explained?
    Thanks if you help me

  2. #2
    master131's Avatar
    Join Date
    Apr 2010
    Gender
    male
    Location
    Melbourne, Australia
    Posts
    8,802
    Reputation
    3165
    Thanks
    73,307
    My Mood
    Breezy
    Code:
    //Method 1, works for simple guns with no attachments like "ump45_mp"
    currentWeapon = self getCurrentWeapon();
    newWeapon = strTok(currentWeapon, "_mp");
    finalWeapon = newWeapon[0] + "_xmags_mp";
    
    //Method 2, works for nearly all guns, removes previous attachments
    currentWeapon = self getCurrentWeapon();
    newWeapon = strTok(currentWeapon, "_");
    finalWeapon = newWeapon[0] + "_xmags_mp";
    /marked as solved
    Last edited by master131; 02-02-2011 at 06:41 PM.
    Donate:
    BTC: 1GEny3y5tsYfw8E8A45upK6PKVAEcUDNv9


    Handy Tools/Hacks:
    Extreme Injector v3.6.1 *NEW* Windows 10 compatible!
    A powerful and advanced injector in a simple GUI.
    Can scramble DLLs on injection making them harder to detect and even make detected hacks work again!

    Minion Since: 13th January 2011
    Moderator Since: 6th May 2011
    Global Moderator Since: 29th April 2012
    Super User/Unknown Since: 23rd July 2013
    'Game Hacking' Team Since: 30th July 2013

    --My Art--
    [Roxas - Pixel Art, WIP]
    [Natsu - Drawn]
    [Natsu - Coloured]


    All drawings are coloured using Photoshop.

    --Gifts--
    [Kyle]

  3. The Following 2 Users Say Thank You to master131 For This Useful Post:

    TrollerCoaster (02-02-2011),YuDi21 (02-04-2011)