Raised This Month: $51 Target: $400
 12% 

Help with ammo please


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
selax
AlliedModders Donor
Join Date: Apr 2008
Location: Moscow
Old 11-14-2009 , 12:42   Help with ammo please
Reply With Quote #1

fucnction to get scout
Code:
GiveScout(client)
{
    GivePlayerItem(client, "weapon_scout");
    PrintToChat(client, "You get a scout...");
    return;
}
need this function give scout with 0 ammo and with 0 clipammo. Help please.

Last edited by selax; 11-14-2009 at 13:51.
selax is offline
MockingBird
Member
Join Date: Mar 2005
Old 11-15-2009 , 03:31   Re: Help with ammo please
Reply With Quote #2

There are 2 ways

You can either get the entid of the scout by use GetPlayerWeapon or something like that.

With that, you can set m_iClip1 to 0.

The otherway is to create the weapon first with CreateEntity, which returns the entid. Then set its clip to 0, Dispatch it, and teleport it to the player
MockingBird is offline
selax
AlliedModders Donor
Join Date: Apr 2008
Location: Moscow
Old 11-15-2009 , 08:15   Re: Help with ammo please
Reply With Quote #3

Thx and please say me, how remove all weapons on client?
selax is offline
selax
AlliedModders Donor
Join Date: Apr 2008
Location: Moscow
Old 11-15-2009 , 10:55   Re: Help with ammo please
Reply With Quote #4

Code:
GiveScout(client)
{
    GivePlayerItem(client, "weapon_scout");
    wpn = GetPlayerWeaponSlot(client, 1);
    ammoOffset = FindSendPropInfo(wpn, "m_iAmmo");
    clipOffset = FindSendPropInfo(wpn, "m_iClip1");
    SetEntData(client, ammoOffset, 0, _, true);
    SetEntData(client, clipOffset, 0, _, true);
    PrintToChat(client, "You get a scout...");
    return;
}
Help please, not work
selax is offline
MockingBird
Member
Join Date: Mar 2005
Old 11-15-2009 , 12:48   Re: Help with ammo please
Reply With Quote #5

Firstly, You dont need to set the m_iAmmo flag.

Secondly, that code tries to modify the clip on the client, when you want to modify the clip on the weapon.

Code:
SetEntData(wpn, clipOffset, 0, _, true);
MockingBird is offline
SilentLikeSilence
Senior Member
Join Date: Jul 2009
Old 11-15-2009 , 16:10   Re: Help with ammo please
Reply With Quote #6

correct these lines (the text is red where the problems were)


wpn = GetPlayerWeaponSlot(client, 0);
SetEntData(wpn, ammoOffset, 0, _, true);
SetEntData(wpn, clipOffset, 0, _, true);


slot 0 primary weapon
slot 1 secondary weapon
slot 2 knife
SilentLikeSilence is offline
selax
AlliedModders Donor
Join Date: Apr 2008
Location: Moscow
Old 11-16-2009 , 10:18   Re: Help with ammo please
Reply With Quote #7

Error:
[SM] Native "SetEntData" reported: Offset -1 is invalid
selax is offline
SilentLikeSilence
Senior Member
Join Date: Jul 2009
Old 11-16-2009 , 11:36   Re: Help with ammo please
Reply With Quote #8

Sorry just noticed the other two problems now.

So:

ammoOffset = FindSendPropInfo("CCSPlayer", "m_iAmmo");
clipOffset = FindSendPropInfo("CBaseCombatWeapon", "m_iClip1");
SilentLikeSilence is offline
selax
AlliedModders Donor
Join Date: Apr 2008
Location: Moscow
Old 11-16-2009 , 14:26   Re: Help with ammo please
Reply With Quote #9

Very good, but 90 not set to 0 :*(
Attached Thumbnails
Click image for larger version

Name:	lal.jpg
Views:	117
Size:	10.6 KB
ID:	53646  
selax is offline
SilentLikeSilence
Senior Member
Join Date: Jul 2009
Old 11-16-2009 , 15:16   Re: Help with ammo please
Reply With Quote #10

SetEntData(wpn, ammoOffset + (2*4), 0);

Last edited by SilentLikeSilence; 11-17-2009 at 11:17.
SilentLikeSilence is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 11:01.


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