Raised This Month: $ Target: $400
 0% 

Trouble with ts_givepwup


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Maddo
Member
Join Date: Dec 2004
Old 01-29-2005 , 00:00   Trouble with ts_givepwup
Reply With Quote #1

I'm trying to make a plugin for TS while gives a random powerup to each player on spawn. However, I hit the wall when I couldn't get the ts_givepwup function to work. I created this very simple plugin to test it out, but to no avail.

Code:
#include <amxmodx> #include <tsx> public plugin_init()     {     register_plugin("Poweruptest", "1.0", "Maddo")     register_clcmd("say /give", "give_superjump")     }       public give_superjump(id)       {     ts_givepwup( id, TSPWUP_SUPERJUMP )     return PLUGIN_HANDLED                   }

It compiles fine, and when I try "say /give" on my server, the plugin obviously catches it, since it doesn't display on the screen. However, nothing happens. I've tested it with other powerups, and just using the numbers etc, but nothing works.

If anyone could tell me how I can get this function working, I would be most appreciative

Thanks in advance
Maddo is offline
XxAvalanchexX
Veteran Member
Join Date: Oct 2004
Location: abort73.com
Old 01-29-2005 , 03:06  
Reply With Quote #2

From tsx.inc:

Code:
/* Function will create pwup entity and return its index (pwupent) */ native ts_createpwup( pwup ); native ts_givepwup( index,pwupent );

There may also have to be a very small (ie: 0.1 second) delay before giving it after you create it.
__________________
No longer around. Thanks your support, everyone! As always:
THIS ONES FOR YOU
3000 PTS
XxAvalanchexX is offline
Maddo
Member
Join Date: Dec 2004
Old 01-30-2005 , 20:33  
Reply With Quote #3

okay, I added some code to create the powerup, but still nothing happens.

Code:
#include <amxmodx> #include <tsx> new ent = 0 public plugin_init()     {     register_plugin("ts_superjump", "0.1", "Maddo")     register_cvar("sv_superjump","1")     register_clcmd("say /super","give_superjump")     }           public give_superjump(id)         {                                     if (get_cvar_num("sv_superjump") !=0)                   {                 ent = ts_createpwup(TSITEM_SUPERJUMP)                                 set_task(1.0, "give_pwup", id)                                                 }             return PLUGIN_HANDLED                       }         public give_pwup(id)     {     ts_givepwup( id, ent )     return PLUGIN_HANDLED       }

Is there something else I'm missing here?
Maddo is offline
XxAvalanchexX
Veteran Member
Join Date: Oct 2004
Location: abort73.com
Old 01-30-2005 , 20:52  
Reply With Quote #4

Yes. Use TSPWUP_SUPERJUMP, not TSITEM_SUPERJUMP.
__________________
No longer around. Thanks your support, everyone! As always:
THIS ONES FOR YOU
3000 PTS
XxAvalanchexX is offline
Maddo
Member
Join Date: Dec 2004
Old 01-30-2005 , 21:14  
Reply With Quote #5

Sorry, I was testing before, and forgot to change it back. It still doesn't work with TSPWUP_SUPERJUMP. Is there anything wrong with the changes I made to create the powerup?
Maddo is offline
Knare
Member
Join Date: Oct 2004
Location: New York, USA
Old 02-01-2005 , 12:04  
Reply With Quote #6

make sure sv_cheat is set to 1 or you cannot give out powerups
i will figure out how to include that in your plugin but i have no time now
__________________
0110101100111011100110000101110010011001
Knare is offline
Send a message via AIM to Knare Send a message via MSN to Knare
TotalNoobScripter
Senior Member
Join Date: Aug 2004
Old 02-01-2005 , 23:56  
Reply With Quote #7

i saw someone do it without sv_cehats 1... they wouldnt let me look at their code though...

also, Knare, are you aware that your signature in binary translates to
k;˜\™
In ASCII format?

0100101101101110011000010111001001100101
is binary for
Knare
TotalNoobScripter is offline
Send a message via AIM to TotalNoobScripter
Maddo
Member
Join Date: Dec 2004
Old 02-02-2005 , 00:02  
Reply With Quote #8

Thanks guys, it works fine now. I added a little function to slay people using cheats, so my server doesn't get grenade spammed or anything.
Maddo is offline
TotalNoobScripter
Senior Member
Join Date: Aug 2004
Old 02-02-2005 , 00:16  
Reply With Quote #9

... isnt that a little harsh? why not just disable the powerup 1 2 3 4 commands...
TotalNoobScripter is offline
Send a message via AIM to TotalNoobScripter
Maddo
Member
Join Date: Dec 2004
Old 02-02-2005 , 00:37  
Reply With Quote #10

Is there actually a legitimate use for the powerup command? If there is, I will modify it.

EDIT: Okay, it seems I was a little premature in declaring this working. It does work, but only on the map ts_dojo. I can actually see the powerup spawn in the middle of the dojo, and then disappear a second later when it is given to the player. Anyone have any thoughts as to why it only works on this map?
Maddo 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 19:22.


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