Raised This Month: $ Target: $400
 0% 

Giving ammo in TS


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
burcyril10
Junior Member
Join Date: Feb 2005
Old 03-21-2005 , 01:29   Giving ammo in TS
Reply With Quote #1

OK, those of you who play ts would know. I want to give ammo to a player, so what exactly do I do. If they have a smg, anything less then 50 bullets is crap so I want to give them at least 75 bullets however I don't want to give them 75 shells and how do I know that I am giving them right ammo for their weapon, I could still be giving a shotgunner 9mm which wouldn't really help them. Can someone enlighten me?
burcyril10 is offline
XxAvalanchexX
Veteran Member
Join Date: Oct 2004
Location: abort73.com
Old 03-21-2005 , 13:56  
Reply With Quote #2

This can update a user's backpack ammo, if that will help you at all, but you'll have to fetch another big huge set of pdata offsets to update their clip.

Code:
 // XxAvalanchexX's code -- no stealing without credit you bastages  // Set a user's ammo amount  public ts_setuserammo(id,weapon,ammo) {     // Kung Fu     if(weapon == 36) {         client_cmd(id,"weapon_0"); // switch to kung fu         return 0; // stop now     }     // Invalid Weapon     if(weapon < 0 || weapon > 35) {         return 0; // stop now     }     client_cmd(id,"weapon_%d",weapon); // switch to whatever weapon     // C4 or Katana     if(weapon == 29 || weapon == 34) {         return 0; // stop now     }     // TS AMMO OFFSETS     new tsweaponoffset[36];     tsweaponoffset[1] = 50;     tsweaponoffset[3] = 50;     tsweaponoffset[4] = 52;     tsweaponoffset[5] = 53;     tsweaponoffset[6] = 50;     tsweaponoffset[7] = 50;     tsweaponoffset[8] = 50;     tsweaponoffset[9] = 51;     tsweaponoffset[10] = 51;     tsweaponoffset[11] = 52;     tsweaponoffset[12] = 54;     tsweaponoffset[13] = 53;     tsweaponoffset[14] = 56;     tsweaponoffset[15] = 53;     tsweaponoffset[16] = 50;     tsweaponoffset[17] = 50;     tsweaponoffset[18] = 57;     tsweaponoffset[19] = 56;     tsweaponoffset[20] = 52;     tsweaponoffset[21] = 51;     tsweaponoffset[22] = 58;     tsweaponoffset[23] = 51;     tsweaponoffset[24] = 354;     tsweaponoffset[25] = 366;     tsweaponoffset[26] = 52;     tsweaponoffset[27] = 53;     tsweaponoffset[28] = 59;     tsweaponoffset[30] = 56;     tsweaponoffset[31] = 61;     tsweaponoffset[32] = 53;     tsweaponoffset[33] = 52;     tsweaponoffset[35] = 486;     new currentent = -1, tsgun = 0; // used for getting user's weapon_tsgun     // get origin     new Float:origin[3];     entity_get_vector(id,EV_VEC_origin,origin);     // loop through "user's" entities (whatever is stuck to user, basically)     while((currentent = find_ent_in_sphere(currentent,origin,Float:1.0)) != 0) {         new classname[32];         entity_get_string(currentent,EV_SZ_classname,classname,31);         if(equal(classname,"weapon_tsgun")) { // Found weapon_tsgun             tsgun = currentent; // remember it         }     }     // Couldn't find weapon_tsgun     if(tsgun == 0) {         return 0; // stop now     }     // Get some of their current settings     new currclip, currammo, currmode, currextra;     ts_getuserwpn(id,currclip,currammo,currmode,currextra);     set_pdata_int(tsgun,tsweaponoffset[weapon],ammo); // set their ammo     // Grenade or knife, set clip     if(weapon == 24 || weapon == 25 || weapon == 35) {         set_pdata_int(tsgun,41,ammo); // special clip storage         set_pdata_int(tsgun,839,ammo); // more special clip storage         currclip = ammo; // change what we send to WeaponInfo         ammo = 0; // once again, change what we send to WeaponInfo     }     else { // Not a grenade or knife, set ammo         set_pdata_int(tsgun,850,ammo); // special ammo storage     }     // Update user's HUD     message_begin(MSG_ONE,get_user_msgid("WeaponInfo"),{0,0,0},id);     write_byte(weapon);     write_byte(currclip);     write_short(ammo);     write_byte(currmode);     write_byte(currextra);     message_end();     return 1; // wooh!  }
__________________
No longer around. Thanks your support, everyone! As always:
THIS ONES FOR YOU
3000 PTS
XxAvalanchexX is offline
burcyril10
Junior Member
Join Date: Feb 2005
Old 03-22-2005 , 02:41  
Reply With Quote #3

eeeeek, somewhat more complex then i anticipated!
burcyril10 is offline
Twilight Suzuka
bad
Join Date: Jul 2004
Location: CS lab
Old 03-22-2005 , 12:46  
Reply With Quote #4

OR...you can use TSX module.

ts_giveweapon ( index, weapon, clips, extra )

If you give the same weapon, but with different clips, you can upgrade the clips.
__________________
Twilight Suzuka is offline
Send a message via AIM to Twilight Suzuka Send a message via MSN to Twilight Suzuka
XxAvalanchexX
Veteran Member
Join Date: Oct 2004
Location: abort73.com
Old 03-22-2005 , 17:01  
Reply With Quote #5

I'm pretty sure that's BS right there, I tried that before and it doesn't work. ts_giveweapon replicates a user picking up a ts_groundweapon (or whatever the name is). If you have 30 | 18 for your gun, drop it, and pick up the same kind of gun that has 30 | 90 (but placed by the mapper), you still have 30 | 18.
__________________
No longer around. Thanks your support, everyone! As always:
THIS ONES FOR YOU
3000 PTS
XxAvalanchexX 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 14:10.


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