alexx860 Posted January 31, 2004 Share Posted January 31, 2004 hi all, i am begginer in JA Coding, so i have a question : it's possible to make the disruptor fire bounce on wall, if yes, how ??? thx in advance alexx860 Link to comment Share on other sites More sharing options...
MasterSidious Posted January 31, 2004 Share Posted January 31, 2004 You could check out bg_weapons.c and g_weapons.h, don't know about doing this with that gun though Link to comment Share on other sites More sharing options...
razorace Posted February 1, 2004 Share Posted February 1, 2004 You can't without doing some serious coding changes to the SDK code. Link to comment Share on other sites More sharing options...
alexx860 Posted February 1, 2004 Author Share Posted February 1, 2004 ok, thx for answers, but i have another question : how to remove an item from the player ? because i have made a command to give the jetpack to the player, but how remove it ?? Link to comment Share on other sites More sharing options...
razorace Posted February 2, 2004 Share Posted February 2, 2004 Well, I beleive the jetpack disappears when the player dies. Link to comment Share on other sites More sharing options...
Freyr Posted February 2, 2004 Share Posted February 2, 2004 if( ent->client->ps.stats[sTAT_HOLDABLE_ITEM] & HI_JETPACK ) { ent->client->ps.stats[sTAT_HOLDABLE_ITEM] ^= HI_JETPACK ; } I think that will work. Link to comment Share on other sites More sharing options...
alexx860 Posted February 11, 2004 Author Share Posted February 11, 2004 didn't work Link to comment Share on other sites More sharing options...
razorace Posted February 12, 2004 Share Posted February 12, 2004 ent->client->ps.stats[sTAT_HOLDABLE_ITEM] ^= HI_JETPACK; What's the ^= operator? (x = x ^ y) = (x ^= y)? The correct math operator to remove a flag like that is... ent->client->ps.stats[sTAT_HOLDABLE_ITEM] &= ~HI_JETPACK; Link to comment Share on other sites More sharing options...
RenegadeOfPhunk Posted February 12, 2004 Share Posted February 12, 2004 The ^ operator is Exclusive OR (XOR) - with the following truth table: A B R 0 0 0 0 1 1 1 0 1 1 1 0 This code: if( ent->client->ps.stats[sTAT_HOLDABLE_ITEM] & HI_JETPACK ) { ent->client->ps.stats[sTAT_HOLDABLE_ITEM] ^= HI_JETPACK ; } ...would toggle the HI_JETPACK bit to off, if it was on. So actually, even though it's a bit OTT (Razor's code is the more correct and easier way!), this code should actually succeed in turning off that bit. I think the problem may lie in when you are running this code - I don't think you've specified this anywhere. Also, you probably need to clear the EF_JETPACK flag at the same time... i.e. ent->client->ps.stats[sTAT_HOLDABLE_ITEM] &= ~HI_JETPACK; ent->client->ps.eFlags &= ~EF_JETPACK; Link to comment Share on other sites More sharing options...
Azymn Posted February 14, 2004 Share Posted February 14, 2004 If you wanna use the same command to give the jetpack as take it away then XORing is the way to go: if( !strcmp(cmd, "givejetpack")) { ent->client->ps.stats[sTAT_HOLDABLE_ITEM] ^= HI_JETPACK; ent->client->ps.eFlags ^= EF_JETPACK; } That command will give them a jetpack if they don't have one, and take it away if they do. The only problem is if the HI_JETPACK and EF_JETPACK bits get out of sync with each other. =] Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.