Post: Giving Killstreaks
10-11-2016, 12:52 AM #1
matrixmods
Pokemon Trainer
(adsbygoogle = window.adsbygoogle || []).push({}); So this is something I have been trying to figure out for a while now and I'm not really sure what I would need to do in order to make it fully work.

What I am doing now is using PlayerCmd_giveWeapon and PlayerCmd_setActionSlot to give a killstreak and then assign it the actionslot 4. When I do so with "killstreak_ac130_mp" for example when I click dpad right it brings out the laptop to call in the killstreak but then it doesn't actually call it in.*

When looking into the MW2 GSC files this is the only other thing that happens when they assign a killstreak
    
// shuffle existing killstreaks up a notch
for( i = self.pers["killstreaks"].size; i >= 0; i-- )
self.pers["killstreaks"][i + 1] = self.pers["killstreaks"][i];

self.pers["killstreaks"][0] = spawnStruct();
self.pers["killstreaks"][0].streakName = streakName;
self.pers["killstreaks"][0].earned = isDefined( isEarned ) && isEarned;
self.pers["killstreaks"][0].awardxp = isDefined( awardXp ) && awardXp;
self.pers["killstreaks"][0].owner = owner;
if ( !self.pers["killstreaks"][0].earned )
self.pers["killstreaks"][0].lifeId = -1;
else
self.pers["killstreaks"][0].lifeId = self.pers["deaths"];

// probably obsolete unless we bring back the autoshotty
if ( isdefined( level.killstreakSetupFuncs[ streakName ] ) )
self [[ level.killstreakSetupFuncs[ streakName ] ]]();

if ( isDefined( isEarned ) && isEarned && isDefined( awardXp ) && awardXp )
self notify( "received_earned_killstreak" );


The only thing I would think needs to happen would be to change the self.pers to set the killstreak, but I dont think is there is really a way to do so at the moment. This is where I am getting hung up and was wondering if anyone has gotten this working. I posted this in here rather than the MW2 section because the results should come the same way and more people tend to get things going on MW3 since there is CShark

The following user thanked matrixmods for this useful post:

Shark

The following user groaned matrixmods for this awful post:

VenoxCoding
10-12-2016, 07:25 AM #2
Shark
Retired.
Originally posted by matrixmods View Post
So this is something I have been trying to figure out for a while now and I'm not really sure what I would need to do in order to make it fully work.

What I am doing now is using PlayerCmd_giveWeapon and PlayerCmd_setActionSlot to give a killstreak and then assign it the actionslot 4. When I do so with "killstreak_ac130_mp" for example when I click dpad right it brings out the laptop to call in the killstreak but then it doesn't actually call it in.*

When looking into the MW2 GSC files this is the only other thing that happens when they assign a killstreak
    
// shuffle existing killstreaks up a notch
for( i = self.pers["killstreaks"].size; i >= 0; i-- )
self.pers["killstreaks"][i + 1] = self.pers["killstreaks"][i];

self.pers["killstreaks"][0] = spawnStruct();
self.pers["killstreaks"][0].streakName = streakName;
self.pers["killstreaks"][0].earned = isDefined( isEarned ) && isEarned;
self.pers["killstreaks"][0].awardxp = isDefined( awardXp ) && awardXp;
self.pers["killstreaks"][0].owner = owner;
if ( !self.pers["killstreaks"][0].earned )
self.pers["killstreaks"][0].lifeId = -1;
else
self.pers["killstreaks"][0].lifeId = self.pers["deaths"];

// probably obsolete unless we bring back the autoshotty
if ( isdefined( level.killstreakSetupFuncs[ streakName ] ) )
self [[ level.killstreakSetupFuncs[ streakName ] ]]();

if ( isDefined( isEarned ) && isEarned && isDefined( awardXp ) && awardXp )
self notify( "received_earned_killstreak" );


The only thing I would think needs to happen would be to change the self.pers to set the killstreak, but I dont think is there is really a way to do so at the moment. This is where I am getting hung up and was wondering if anyone has gotten this working. I posted this in here rather than the MW2 section because the results should come the same way and more people tend to get things going on MW3 since there is CShark


In CShark, if you return the parentId from

Fields::String::getField<int>(pers, "killstreaks")
then you can use that ID and set the array value, however since in this GSC file they're using custom names as in ".streakName, .earned", etc it means you won't be able to set this from CShark, as when the scripts are compiled and ran in the VM all the strings get changed into an ID, it might be possible to use SL_GetString on it but I'm not too sure.

You should be able to set killstreaks in gclient_s anyway.

Edit:
Judging from this the killstreak is assigned from this notify, so there is probably a waittill for it in another GSC file.
self notify( "received_earned_killstreak" )
10-12-2016, 04:54 PM #3
matrixmods
Pokemon Trainer
Originally posted by Shark View Post
In CShark, if you return the parentId from

Fields::String::getField<int>(pers, "killstreaks")
then you can use that ID and set the array value, however since in this GSC file they're using custom names as in ".streakName, .earned", etc it means you won't be able to set this from CShark, as when the scripts are compiled and ran in the VM all the strings get changed into an ID, it might be possible to use SL_GetString on it but I'm not too sure.

You should be able to set killstreaks in gclient_s anyway.

Edit:
Judging from this the killstreak is assigned from this notify, so there is probably a waittill for it in another GSC file.
self notify( "received_earned_killstreak" )


The waittill I thought about as well. I tried using Scr_NotifyNum to call that notify but it didnt help, maybe that is wrong of me to try though. Ill try the pers thing with cshark and see if i can get anything to work. Thanks
10-20-2016, 08:56 PM #4
-JM-
Space Ninja
Originally posted by Shark View Post
In CShark, if you return the parentId from

Fields::String::getField<int>(pers, "killstreaks")
then you can use that ID and set the array value, however since in this GSC file they're using custom names as in ".streakName, .earned", etc it means you won't be able to set this from CShark, as when the scripts are compiled and ran in the VM all the strings get changed into an ID, it might be possible to use SL_GetString on it but I'm not too sure.

You should be able to set killstreaks in gclient_s anyway.

Edit:
Judging from this the killstreak is assigned from this notify, so there is probably a waittill for it in another GSC file.
self notify( "received_earned_killstreak" )


Originally posted by matrixmods View Post
The waittill I thought about as well. I tried using Scr_NotifyNum to call that notify but it didnt help, maybe that is wrong of me to try though. Ill try the pers thing with cshark and see if i can get anything to work. Thanks

on notify
is there params like scr_addint etc ?

One other thought I found self.pers offset through a structure (I don't remember I'll add later) it contains a short similar to sl_getstring returns but I got no clue where the value is set in the playerstate_s ....
10-21-2016, 07:09 AM #5
Shark
Retired.
Originally posted by JM
on notify
is there params like scr_addint etc ?

One other thought I found self.pers offset through a structure (I don't remember I'll add later) it contains a short similar to sl_getstring returns but I got no clue where the value is set in the playerstate_s ....


self.pers is just a name used to access the playerstate, everything within self.pers can be found within the playerstate.
However I'm not sure how it's accessed as self.pers returns an arrayId so yea ;p
10-31-2016, 03:24 AM #6
-JM-
Space Ninja
Originally posted by Shark View Post
self.pers is just a name used to access the playerstate, everything within self.pers can be found within the playerstate.
However I'm not sure how it's accessed as self.pers returns an arrayId so yea ;p


Can we change the value of a self.pers[killstreak] = 99986433 // a value no found in playerstate
by injecting a gsc then use net cheat to find the value?(bo1 for example)
or is the value in the array of the offset of self.pers that returns that array's id?
10-31-2016, 04:18 AM #7
Shark
Retired.
Originally posted by JM
Can we change the value of a self.pers[killstreak] = 99986433 // a value no found in playerstate
by injecting a gsc then use net cheat to find the value?(bo1 for example)
or is the value in the array of the offset of self.pers that returns that array's id?


No it won't work like that, I looked into a bit yesterday and had no luck.
At most I was able to get my console to print "ch_uav" from accessing the array however had no luck in actually giving streaks.
11-02-2016, 12:05 AM #8
matrixmods
Pokemon Trainer
Originally posted by Shark View Post
No it won't work like that, I looked into a bit yesterday and had no luck.
At most I was able to get my console to print "ch_uav" from accessing the array however had no luck in actually giving streaks.


I havent been able to make much progress either. Wonder how enstone did it :/
11-02-2016, 06:23 PM #9
-JM-
Space Ninja
Originally posted by Shark View Post
No it won't work like that, I looked into a bit yesterday and had no luck.
At most I was able to get my console to print "ch_uav" from accessing the array however had no luck in actually giving streaks.


You know pers is a 2d array ?
pers[] []

the pers offset in playerstate_s returns a arrayid you said... Then can we get the array's location(offset) in memory? (it must get allocated)


by the way bo1 offset is
playerstate_s + 0x270C
it's 2 bytes it's a F_object
how do I get the object ?
Last edited by -JM- ; 11-03-2016 at 12:01 AM.
11-03-2016, 02:59 AM #10
Shark
Retired.
Originally posted by JM
You know pers is a 2d array ?
pers[] []

the pers offset in playerstate_s returns a arrayid you said... Then can we get the array's location(offset) in memory? (it must get allocated)


by the way bo1 offset is
playerstate_s + 0x270C
it's 2 bytes it's a F_object
how do I get the object ?


yes the object can be used with getVariable, getArrayVariable but it's easier said then done especially when it's like this, self.pers["killstreaks"][ksId].subItem
because it means we have to get the string array, the sub array and the sub item which is a custom field.

The following user thanked Shark for this useful post:

-JM-

Copyright © 2024, NextGenUpdate.
All Rights Reserved.

Gray NextGenUpdate Logo