Bully-Board

Bully Modding Section => Modding Questions/Help => Topic started by: RBS ID on January 15, 2022, 01:24:09 AM

Title: Get ped name without "N_" (substring)
Post by: RBS ID on January 15, 2022, 01:24:09 AM
Does anyone know how to get the name of the ped without   N_   ?
Example:  N_Jimmy  =>  Jimmy

I've tried like this, but the script just immediately stopped running.
Code: [Select]
local pedName = PedGetName(ped)
string.sub(pedName, 3, string.len(pedName)) -- 1.
string.sub(pedName, 3) -- 2.
Title: Re: Get ped name without "N_" (substring)
Post by: Razc01na on January 15, 2022, 09:24:51 AM
Strings in lua are immutable values. This means you cannot change a character (like you can in C).

To do that, you need to create a new string, or, rewrite the entire string:

Code: [Select]
local PedName = PedGetName(gPlayer)       --print(PedName) >> N_Jimmy
PedName = string.gsub(PedName, "N_", "")  --print(PedName) >> Jimmy
Title: Re: Get ped name without "N_" (substring)
Post by: RBS ID on January 15, 2022, 11:41:23 PM
Oh ok, i got it, thanks!
Title: Re: Get ped name without "N_" (substring)
Post by: Altamurenza on January 16, 2022, 02:22:08 AM
Strings in lua are immutable values. This means you cannot change a character (like you can in C).

To do that, you need to create a new string, or, rewrite the entire string:

Code: [Select]
local PedName = PedGetName(gPlayer)       --print(PedName) >> N_Jimmy
PedName = string.gsub(PedName, "N_", "")  --print(PedName) >> Jimmy

As far as i know, string.gsub doesn't even exist in Bully (Scholarship Edition at least). The developer made several adjustment for the Lua 5.0.2 standard library and remove a lot of things in string manipulation, table manipulation, and even completely remove IO also OS facilities.
Title: Re: Get ped name without "N_" (substring)
Post by: RBS ID on January 16, 2022, 03:47:36 AM
Yeah, i've tried, but still not working.
Title: Re: Get ped name without "N_" (substring)
Post by: Altamurenza on January 16, 2022, 03:58:23 AM
Yeah, i've tried, but still not working.

If you're working on PC version of mod, you probably want to try DerpyScriptAddons V3 (https://bullylua.neocities.org/other/derpy.html) which allows you to use fully implemented Lua 5.0.2 libraries. That string.gsub function also included as well of course, just in case you want to try that again.
Title: Re: Get ped name without "N_" (substring)
Post by: RBS ID on January 16, 2022, 04:41:40 AM
Wow, I never knew that Derpy had a new website. Btw, thanks, I'll just use the alternative way to get the ped name.
Code: [Select]
local peds = {
    [0] = {model = "player", name = "Jimmy", style = "Player"},
{model = "player" ,name = "Jimmy" ,style = "Player"},
{model = "DOgirl_Zoe_EG" ,name = "Zoe" ,style = "GS_Female_A"},
{model = "NDGirl_Beatrice" ,name = "Beatrice" ,style = "GS_Female_A"},
{model = "NDH1a_Algernon" ,name = "Algernon" ,style = "N_Striker_B"},
{model = "NDH1_Fatty" ,name = "Fatty" ,style = "N_Striker_A"},
{model = "ND2nd_Melvin" ,name = "Melvin" ,style = "N_Striker_A"},
{model = "NDH2_Thad" ,name = "Thad" ,style = "N_Ranged_A"},
{model = "NDH3_Bucky" ,name = "Bucky" ,style = "N_Ranged_A"},
{model = "NDH2a_Cornelius" ,name = "Cornelius" ,style = "N_Ranged_A"},
{model = "NDLead_Earnest" ,name = "Earnest" ,style = "N_Ranged_A"},
{model = "NDH3a_Donald" ,name = "Donald" ,style = "N_Ranged_A"},
{model = "JKH1_Damon" ,name = "Damon" ,style = "J_Striker_A"},
{model = "JKH1a_Kirby" ,name = "Kirby" ,style = "J_Striker_A"},
{model = "JKGirl_Mandy" ,name = "Mandy" ,style = "GS_Female_A"},
{model = "JKH2_Dan" ,name = "Dan" ,style = "J_Striker_A"},
{model = "JKH2a_Luis" ,name = "Luis" ,style = "J_Grappler_A"},
{model = "JKH3_Casey" ,name = "Casey" ,style = "J_Melee_A"},
{model = "JKH3a_Bo" ,name = "Bo" ,style = "J_Melee_A"},
{model = "JKlead_Ted" ,name = "Ted" ,style = "J_Striker_A"},
{model = "JK2nd_Juri" ,name = "Juri" ,style = "J_Grappler_A"},
{model = "GR2nd_Peanut" ,name = "Peanut" ,style = "G_Striker_A"},
{model = "GRH2A_Hal" ,name = "Hal" ,style = "G_Grappler_A"},
{model = "GRlead_Johnny" ,name = "Johnny" ,style = "G_Striker_A"},
{model = "GRH1_Lefty" ,name = "Lefty" ,style = "G_Melee_A"},
{model = "GRGirl_Lola" ,name = "Lola" ,style = "GS_Female_A"},
{model = "GRH3_Lucky" ,name = "Lucky" ,style = "G_Striker_A"},
{model = "GRH1a_Vance" ,name = "Vance" ,style = "G_Melee_A"},
{model = "GRH3a_Ricky" ,name = "Ricky" ,style = "G_Striker_A"},
{model = "GRH2_Norton" ,name = "Norton" ,style = "G_Grappler_A"},
{model = "PRH1_Gord" ,name = "Gord" ,style = "P_Striker_A"},
{model = "PRH1a_Tad" ,name = "Tad" ,style = "P_Striker_A"},
{model = "PRH2a_Chad" ,name = "Chad" ,style = "P_Grappler_A"},
{model = "PR2nd_Bif" ,name = "Bif" ,style = "P_Striker_A"},
{model = "PRH3_Justin" ,name = "Justin" ,style = "P_Striker_B"},
{model = "PRH2_Bryce" ,name = "Bryce" ,style = "P_Grappler_A"},
{model = "PRH2_Bryce_OBOX" ,name = "Bryce" ,style = "P_Striker_A"},
{model = "PRlead_Darby" ,name = "Darby" ,style = "P_Striker_A"},
{model = "PRGirl_Pinky" ,name = "Pinky" ,style = "GS_Female_A"},
{model = "GN_Asiangirl" ,name = "Angie" ,style = "GS_Female_A"},
{model = "PRH3a_Parker" ,name = "Parker" ,style = "P_Striker_B"},
{model = "DOH2_Jerry" ,name = "Jerry" ,style = "DO_Grappler_A"},
{model = "DOH1a_Otto" ,name = "Otto" ,style = "DO_Striker_A"},
{model = "DOH2a_Leon" ,name = "Leon" ,style = "DO_Striker_A"},
{model = "DOH1_Duncan" ,name = "Duncan" ,style = "DO_Striker_A"},
{model = "DOH3_Henry" ,name = "Henry" ,style = "DO_Grappler_A"},
{model = "DOH3a_Gurney" ,name = "Gurney" ,style = "DO_Grappler_A"},
{model = "DO2nd_Omar" ,name = "Omar" ,style = "DO_Striker_A"},
{model = "DOGirl_Zoe" ,name = "Zoe" ,style = "GS_Female_A"},
{model = "PF2nd_Max" ,name = "Max" ,style = "Authority"},
{model = "PFH1_Seth" ,name = "Seth" ,style = "Authority"},
{model = "PFH2_Edward" ,name = "Edward" ,style = "Authority"},
{model = "PFlead_Karl" ,name = "Karl" ,style = "Authority"},
{model = "TO_Orderly" ,name = "Theo" ,style = "LE_Orderly_A"},
{model = "TE_HallMonitor" ,name = "MissPeabody" ,style = "TE_Female_A"},
{model = "TE_GymTeacher" ,name = "MrBurton" ,style = "Authority"},
{model = "TE_Janitor" ,name = "MrLuntz" ,style = "CV_Male_A"},
{model = "TE_English" ,name = "MrGalloway" ,style = "Authority"},
{model = "TE_Cafeteria" ,name = "Edna" ,style = "Authority"},
{model = "TE_Secretary" ,name = "MissWinston" ,style = "TE_Female_A"},
{model = "TE_Nurse" ,name = "MrsMcRae" ,style = "TE_Female_A"},
{model = "TE_MathTeacher" ,name = "MrHuntingdon" ,style = "Authority"},
{model = "TE_Librarian" ,name = "MrsCarvin" ,style = "TE_Female_A"},
{model = "TE_Art" ,name = "MsPhillips" ,style = "TE_Female_A"},
{model = "TE_Biology" ,name = "MrSlawter" ,style = "Authority"},
{model = "TE_Principal" ,name = "DrCrabblesnitch" ,style = "Authority"},
{model = "GN_Littleblkboy" ,name = "Sheldon" ,style = "GS_Male_A"},
{model = "GN_SexyGirl" ,name = "Christy" ,style = "GS_Female_A"},
{model = "GN_Littleblkgirl" ,name = "Gloria" ,style = "GS_Female_A"},
{model = "GN_Hispanicboy" ,name = "Pedro" ,style = "GS_Male_A"},
{model = "GN_Greekboy" ,name = "Constantinos" ,style = "GS_Male_A"},
{model = "GN_Fatboy" ,name = "Ray" ,style = "GS_Fat_A"},
{model = "GN_Boy01" ,name = "Ivan" ,style = "GS_Male_A"},
{model = "GN_Boy02" ,name = "Trevor" ,style = "GS_Male_A"},
{model = "GN_Fatgirl" ,name = "Eunice" ,style = "GS_Fat_A"},
{model = "DOlead_Russell" ,name = "Russell" ,style = "B_Striker_A"},
{model = "TO_Business1" ,name = "DrBambillo" ,style = "CV_Male_A"},
{model = "TO_Business2" ,name = "MrSullivan" ,style = "CV_Male_A"},
{model = "TO_BusinessW1" ,name = "MsKopke" ,style = "CV_Female_A"},
{model = "TO_BusinessW2" ,name = "MsRushinski" ,style = "CV_Female_A"},
{model = "TO_RichW1" ,name = "MsIsaacs" ,style = "CV_Female_A"},
{model = "TO_RichW2" ,name = "BethanyJones" ,style = "CV_Female_A"},
{model = "TO_Fireman" ,name = "ORourke" ,style = "CV_Male_A"},
{model = "TO_Cop" ,name = "OfficerMonson" ,style = "Authority"},
{model = "TO_Comic" ,name = "ZackOwens" ,style = "CV_Male_A"},
{model = "GN_Bully03" ,name = "Trent" ,style = "B_Striker_A"},
{model = "TO_Bikeowner" ,name = "TobiasMason" ,style = "CV_Male_A"},
{model = "TO_Hobo" ,name = "MrGrant" ,style = "CV_Male_A"},
{model = "Player_Mascot" ,name = "Mascot" ,style = "J_Mascot"},
{model = "TO_GroceryOwner" ,name = "MrOh" ,style = "CV_Male_A"},
{model = "GN_Sexygirl_UW" ,name = "Christy" ,style = "GS_Female_A"},
{model = "DOLead_Edgar" ,name = "Edgar" ,style = "DO_Striker_A"},
{model = "JK_LuisWrestle" ,name = "Luis" ,style = "J_Grappler_A"},
{model = "JKGirl_MandyUW" ,name = "Mandy" ,style = "GS_Female_A"},
{model = "PRGirl_PinkyUW" ,name = "Pinky" ,style = "GS_Female_A"},
{model = "NDGirl_BeatriceUW" ,name = "Beatrice" ,style = "GS_Female_A"},
{model = "GRGirl_LolaUW" ,name = "Lola" ,style = "GS_Female_A"},
{model = "TO_Cop2" ,name = "OfficerWilliams" ,style = "Authority"},
{model = "Player_OWres" ,name = "Jimmy" ,style = "Player"},
{model = "GN_Bully02" ,name = "Davis" ,style = "B_Striker_A"},
{model = "TO_RichM1" ,name = "MrBreckindale" ,style = "CV_Male_A"},
{model = "TO_RichM2" ,name = "MrDoolin" ,style = "CV_Male_A"},
{model = "GN_Bully01" ,name = "Troy" ,style = "B_Striker_A"},
{model = "TO_FireOwner" ,name = "Nate" ,style = "CV_Male_A"},
{model = "TO_CSOwner_2" ,name = "MrCarmichael" ,style = "CV_Male_A"},
{model = "TO_CSOwner_3" ,name = "NickyCharles" ,style = "CV_Male_A"},
{model = "TE_Chemistry" ,name = "MrWatts" ,style = "Authority"},
{model = "TO_Poorwoman" ,name = "MissAbby" ,style = "CV_OLD"},
{model = "TO_MotelOwner" ,name = "Mihailovich" ,style = "CV_Male_A"},
{model = "JKKirby_FB" ,name = "Kirby" ,style = "J_Striker_A"},
{model = "JKTed_FB" ,name = "Ted" ,style = "J_Striker_A"},
{model = "JKDan_FB" ,name = "Dan" ,style = "J_Striker_A"},
{model = "JKDamon_FB" ,name = "Damon" ,style = "J_Striker_A"},
{model = "TO_Carny02" ,name = "Freeley" ,style = "CV_Male_A"},
{model = "TO_Carny01" ,name = "Dorsey" ,style = "CV_Male_A"},
{model = "TO_CarnyMidget" ,name = "Hector" ,style = "CV_Male_A"},
{model = "TO_Poorman2" ,name = "Osbourne" ,style = "CV_Male_A"},
{model = "PRH2A_Chad_OBOX" ,name = "Chad" ,style = "P_Striker_A"},
{model = "PRH3_Justin_OBOX" ,name = "Justin" ,style = "P_Striker_A"},
{model = "PRH3a_Parker_OBOX" ,name = "Parker" ,style = "P_Striker_A"},
{model = "TO_BarberRich" ,name = "MariaTheresa" ,style = "CV_Female_A"},
{model = "GenericWrestler" ,name = "Bob" ,style = "GS_Male_A"},
{model = "ND_FattyWrestle" ,name = "Fatty" ,style = "GS_Male_A"},
{model = "TO_Industrial" ,name = "Chuck" ,style = "CV_Male_A"},
{model = "TO_Associate" ,name = "Ian" ,style = "CV_Male_A"},
{model = "TO_Asylumpatient" ,name = "Fenwick" ,style = "DO_Striker_A"},
{model = "TE_Autoshop" ,name = "Neil" ,style = "Authority"},
{model = "TO_Mailman" ,name = "MrSvenson" ,style = "CV_Male_A"},
{model = "TO_Tattooist" ,name = "Denny" ,style = "CV_Male_A"},
{model = "TE_Assylum" ,name = "MrGalloway" ,style = "Authority"},
{model = "Nemesis_Gary" ,name = "Gary" ,style = "B_Striker_A"},
{model = "TO_Oldman2" ,name = "Krakauer" ,style = "CV_OLD"},
{model = "TO_BarberPoor" ,name = "MrMoratti" ,style = "CV_Male_A"},
{model = "PR2nd_Bif_OBOX" ,name = "Bif" ,style = "P_Striker_A"},
{model = "Peter" ,name = "Peter" ,style = "GS_Male_A"},
{model = "TO_RichM3" ,name = "MrSmith" ,style = "CV_Male_A"},
{model = "Rat_Ped" ,name = "Rat" ,style = "AN_Rat"},
{model = "GN_LittleGirl_2" ,name = "Melody" ,style = "GS_Female_A"},
{model = "GN_LittleGirl_3" ,name = "Karen" ,style = "GS_Female_A"},
{model = "GN_WhiteBoy" ,name = "Gordon" ,style = "GS_Male_A"},
{model = "TO_FMidget" ,name = "Brandy" ,style = "GS_Male_A"},
{model = "Dog_Pitbull" ,name = "Pitbull" ,style = "AN_DOG"},
{model = "GN_SkinnyBboy" ,name = "Lance" ,style = "GS_Male_A"},
{model = "TO_Carnie_female" ,name = "Crystal" ,style = "CV_Female_A"},
{model = "TO_Business3" ,name = "MrMartin" ,style = "CV_Male_A"},
{model = "GN_Bully04" ,name = "Ethan" ,style = "B_Striker_A"},
{model = "GN_Bully05" ,name = "Wade" ,style = "B_Striker_A"},
{model = "GN_Bully06" ,name = "Tom" ,style = "B_Striker_A"},
{model = "TO_Business4" ,name = "MrRamirez" ,style = "CV_Male_A"},
{model = "TO_Business5" ,name = "MrHuntingdon" ,style = "CV_Male_A"},
{model = "DO_Otto_asylum" ,name = "Otto" ,style = "DO_Striker_A"},
{model = "TE_History" ,name = "MrWiggins" ,style = "Authority"},
{model = "TO_Record" ,name = "Floyd" ,style = "CV_Male_A"},
{model = "DO_Leon_Assylum" ,name = "Leon" ,style = "DO_Striker_A"},
{model = "DO_Henry_Assylum" ,name = "Henry" ,style = "DO_Striker_A"},
{model = "NDH1_FattyChocolate" ,name = "Fatty" ,style = "N_Striker_A"},
{model = "TO_GroceryClerk" ,name = "Stan" ,style = "CV_Male_A"},
{model = "TO_Handy" ,name = "Handy" ,style = "CV_OLD"},
{model = "TO_Orderly2" ,name = "Gregory" ,style = "LE_Orderly_A"},
{model = "GN_Hboy_Ween" ,name = "Pedro" ,style = "GS_Male_A"},
{model = "Nemesis_Ween" ,name = "Gary" ,style = "B_Striker_A"},
{model = "GRH3_Lucky_Ween" ,name = "Lucky" ,style = "G_Striker_A"},
{model = "NDH3a_Donald_ween" ,name = "Donald" ,style = "N_Ranged_A"},
{model = "PRH3a_Parker_Ween" ,name = "Parker" ,style = "P_Striker_B"},
{model = "JKH3_Casey_Ween" ,name = "Casey" ,style = "J_Melee_A"},
{model = "Peter_Ween" ,name = "Peter" ,style = "GS_Male_A"},
{model = "GN_AsianGirl_Ween" ,name = "Angie" ,style = "GS_Female_A"},
{model = "PRGirl_Pinky_Ween" ,name = "Pinky" ,style = "GS_Female_A"},
{model = "JKH1_Damon_ween" ,name = "Damon" ,style = "J_Striker_A"},
{model = "GN_WhiteBoy_Ween" ,name = "Gordon" ,style = "GS_Male_A"},
{model = "GN_Bully01_Ween" ,name = "Ivan" ,style = "B_Striker_A"},
{model = "GN_Boy02_Ween" ,name = "Trevor" ,style = "B_Striker_A"},
{model = "PR2nd_Bif_OBOX_D1" ,name = "Bif" ,style = "P_Striker_A"},
{model = "GRH1a_Vance_Ween" ,name = "Vance" ,style = "G_Melee_A"},
{model = "NDH2_Thad_Ween" ,name = "Thad" ,style = "N_Ranged_A"},
{model = "PRGirl_Pinky_BW" ,name = "Pinky" ,style = "GS_Female_A"},
{model = "DOlead_Russell_BU" ,name = "Russell" ,style = "B_Striker_A"},
{model = "PRH1a_Tad_BW" ,name = "Tad" ,style = "P_Striker_A"},
{model = "PRH2_Bryce_BW" ,name = "Bryce" ,style = "P_Grappler_A"},
{model = "PRH3_Justin_BW" ,name = "Justin" ,style = "P_Striker_B"},
{model = "GN_Asiangirl_CH" ,name = "Angie" ,style = "GS_Female_A"},
{model = "GN_Sexygirl_CH" ,name = "Christy" ,style = "GS_Female_A"},
{model = "PRGirl_Pinky_CH" ,name = "Pinky" ,style = "GS_Female_A"},
{model = "TO_NH_Res_01" ,name = "MrBuba" ,style = "CV_OLD"},
{model = "TO_NH_Res_02" ,name = "MrGordon" ,style = "CV_OLD"},
{model = "TO_NH_Res_03" ,name = "MrsLisburn" ,style = "CV_OLD"},
{model = "NDH1_Fatty_DM" ,name = "Fatty" ,style = "N_Striker_A"},
{model = "TO_PunkBarber" ,name = "Betty" ,style = "CV_Male_A"},
{model = "FightingMidget_01" ,name = "Lightning" ,style = "P_Striker_A"},
{model = "FightingMidget_02" ,name = "Zeke" ,style = "G_Striker_A"},
{model = "TO_Skeletonman" ,name = "Alfred" ,style = "CV_Male_A"},
{model = "TO_Beardedwoman" ,name = "Paris" ,style = "CV_Female_A"},
{model = "TO_CarnieMermaid" ,name = "Courtney" ,style = "CV_Female_A"},
{model = "TO_Siamesetwin2" ,name = "Delilah" ,style = "CV_Female_A"},
{model = "TO_Paintedman" ,name = "Drew" ,style = "CV_Male_A"},
{model = "TO_GN_Workman" ,name = "Castillo" ,style = "CV_Male_A"},
{model = "DOLead_Edgar_GS" ,name = "Edgar" ,style = "DO_Striker_A"},
{model = "DOH3a_Gurney_GS" ,name = "Gurney" ,style = "DO_Grappler_A"},
{model = "DOH2_Jerry_GS" ,name = "Jerry" ,style = "DO_Grappler_A"},
{model = "DOH2a_Leon_GS" ,name = "Leon" ,style = "DO_Striker_A"},
{model = "GRH2a_Hal_GS" ,name = "Hal" ,style = "G_Grappler_A"},
{model = "GRH2_Norton_GS" ,name = "Norton" ,style = "G_Grappler_A"},
{model = "GR2nd_Peanut_GS" ,name = "Peanut" ,style = "G_Striker_A"},
{model = "GRH1a_Vance_GS" ,name = "Vance" ,style = "G_Melee_A"},
{model = "JKH3a_Bo_GS" ,name = "Bo" ,style = "J_Melee_A"},
{model = "JKH1_Damon_GS" ,name = "Damon" ,style = "J_Striker_A"},
{model = "JK2nd_Juri_GS" ,name = "Juri" ,style = "J_Grappler_A"},
{model = "JKH1a_Kirby_GS" ,name = "Kirby" ,style = "J_Striker_A"},
{model = "NDH1a_Algernon_GS" ,name = "Algernon" ,style = "N_Striker_B"},
{model = "NDH3_Bucky_GS" ,name = "Bucky" ,style = "N_Ranged_A"},
{model = "NDH2_Thad_GS" ,name = "Thad" ,style = "N_Ranged_A"},
{model = "PRH3a_Parker_GS" ,name = "Parker" ,style = "P_Striker_B"},
{model = "PRH3_Justin_GS" ,name = "Justin" ,style = "P_Striker_B"},
{model = "PRH1a_Tad_GS" ,name = "Tad" ,style = "P_Striker_A"},
{model = "PRH1_Gord_GS" ,name = "Gord" ,style = "P_Striker_A"},
{model = "NDLead_Earnest_EG" ,name = "Earnest" ,style = "N_Ranged_A"},
{model = "JKlead_Ted_EG" ,name = "Ted" ,style = "J_Striker_A"},
{model = "GRlead_Johnny_EG" ,name = "Johnny" ,style = "G_Johnny"},
{model = "PRlead_Darby_EG" ,name = "Darby" ,style = "P_Striker_A"},
{model = "Dog_Pitbull2" ,name = "Pitbull" ,style = "AN_DOG"},
{model = "Dog_Pitbull3" ,name = "Pitbull" ,style = "AN_DOG"},
{model = "TE_CafeMU_W" ,name = "Edna" ,style = "Authority"},
{model = "TO_Millworker" ,name = "McInnis" ,style = "CV_Male_A"},
{model = "TO_Dockworker" ,name = "Johnson" ,style = "CV_Male_A"},
{model = "NDH2_Thad_PJ" ,name = "Thad" ,style = "N_Ranged_A"},
{model = "GN_Lblkboy_PJ" ,name = "Sheldon" ,style = "GS_Male_A"},
{model = "GN_Hboy_PJ" ,name = "Pedro" ,style = "GS_Male_A"},
{model = "GN_Boy01_PJ" ,name = "Ivan" ,style = "GS_Male_A"},
{model = "GN_Boy02_PJ" ,name = "Trevor" ,style = "GS_Male_A"},
{model = "TE_Gym_Incog" ,name = "MrBurton" ,style = "Authority"},
{model = "JK_Mandy_Towel" ,name = "Mandy" ,style = "GS_Female_A"},
{model = "JK_Bo_FB" ,name = "Bo" ,style = "J_Melee_A"},
{model = "JK_Casey_FB" ,name = "Casey" ,style = "J_Melee_A"},
{model = "PunchBag" ,name = "PunchBag" ,style = "PunchBagBS"},
{model = "TO_Cop3" ,name = "OfficerMonson" ,style = "Authority"},
{model = "GN_GreekboyUW" ,name = "Constantinos" ,style = "GS_Male_A"},
{model = "TO_Construct01" ,name = "McInnis" ,style = "CV_Male_A"},
{model = "TO_Construct02" ,name = "McInnis" ,style = "CV_Male_A"},
{model = "TO_Cop4" ,name = "OfficerWilliams" ,style = "Authority"},
{model = "PRH2_Bryce_OBOX_D1" ,name = "Bryce" ,style = "P_Striker_A"},
{model = "PRH2_Bryce_OBOX_D2" ,name = "Bryce" ,style = "P_Striker_A"},
{model = "PRH2A_Chad_OBOX_D1" ,name = "Chad" ,style = "P_Striker_A"},
{model = "PRH2A_Chad_OBOX_D2" ,name = "Chad" ,style = "P_Striker_A"},
{model = "PR2nd_Bif_OBOX_D2" ,name = "Bif" ,style = "P_Striker_A"},
{model = "PRH3_Justin_OBOX_D1" ,name = "Justin" ,style = "P_Striker_A"},
{model = "PRH3_Justin_OBOX_D2" ,name = "Justin" ,style = "P_Striker_A"},
{model = "PRH3a_Prkr_OBOX_D1" ,name = "Parker" ,style = "P_Striker_A"},
{model = "PRH3a_Prkr_OBOX_D2" ,name = "Parker" ,style = "P_Striker_A"},
{model = "TE_Geography" ,name = "GeographyTeacher" ,style = "Authority"},
{model = "TE_Music" ,name = "MusicTeacher" ,style = "TE_Female_A"},
{model = "TO_ElfF" ,name = "Elf" ,style = "GS_Male_A"},
{model = "TO_ElfM" ,name = "Elf" ,style = "GS_Male_A"},
{model = "TO_HoboSanta" ,name = "HoboSanta" ,style = "CV_Male_A"},
{model = "TO_Santa" ,name = "Santa" ,style = "CV_Male_A"},
{model = "TO_Santa_NB" ,name = "Santa" ,style = "CV_Male_A"},
{model = "Peter_Nutcrack" ,name = "Peter" ,style = "GS_Male_A"},
{model = "GN_Fatgirl_Fairy" ,name = "Eunice" ,style = "GS_Fat_A"},
{model = "GN_Lgirl_2_Flower" ,name = "Melody" ,style = "GS_Female_A"},
{model = "GN_Hboy_Flower" ,name = "Pedro" ,style = "GS_Male_A"}
}

function PedGetModel(ped)
  -- Brute force methode:
  for i = 0, 258 do
    if PedIsModel(ped, i) then
      return i
    end
  end
end

function F_PedGetName(ped)
  return peds[PedGetModel(ped)].name
end


-- F_PedGetName(ped)
Title: Re: Get ped name without "N_" (substring)
Post by: Razc01na on January 16, 2022, 07:09:13 AM
Yeah, i've tried, but still not working.

If you're working on PC version of mod, you probably want to try DerpyScriptAddons V3 (https://bullylua.neocities.org/other/derpy.html) which allows you to use fully implemented Lua 5.0.2 libraries. That string.gsub function also included as well of course, just in case you want to try that again.

How long has this addon existed? Never even heard of it until now...
I would love to give it a try, download link is broken though...
Title: Re: Get ped name without "N_" (substring)
Post by: SimonBestia on January 16, 2022, 08:06:01 AM
Let Derpy know on Twitter.
She might fix it.
Title: Re: Get ped name without "N_" (substring)
Post by: Altamurenza on January 16, 2022, 05:35:05 PM
Wow, I never knew that Derpy had a new website. Btw, thanks, I'll just use the alternative way to get the ped name.

Okay then, after all, nothing is better than "it just works" on programming.

How long has this addon existed? Never even heard of it until now...
I would love to give it a try, download link is broken though...

Maybe around 2019 or 2020? correct me if i'm wrong.
Also, i did not know it was no longer available sorry xd.
Title: Re: Get ped name without "N_" (substring)
Post by: Razc01na on January 16, 2022, 06:38:09 PM
How long has this addon existed? Never even heard of it until now...
I would love to give it a try, download link is broken though...

Maybe around 2019 or 2020? correct me if i'm wrong.
Also, i did not know it was no longer available sorry xd.

Think I'll ask derpy for a reupload...