AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Trouble with ts_givepwup (https://forums.alliedmods.net/showthread.php?t=9732)

Maddo 01-29-2005 00:00

Trouble with ts_givepwup
 
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

XxAvalanchexX 01-29-2005 03:06

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.

Maddo 01-30-2005 20:33

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?

XxAvalanchexX 01-30-2005 20:52

Yes. Use TSPWUP_SUPERJUMP, not TSITEM_SUPERJUMP.

Maddo 01-30-2005 21:14

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?

Knare 02-01-2005 12:04

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

TotalNoobScripter 02-01-2005 23:56

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

Maddo 02-02-2005 00:02

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. :P

TotalNoobScripter 02-02-2005 00:16

... isnt that a little harsh? why not just disable the powerup 1 2 3 4 commands...

Maddo 02-02-2005 00:37

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?


All times are GMT -4. The time now is 19:22.

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