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

Giving weapons - crash? :/


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Spunky
Senior Member
Join Date: May 2008
Location: Orlando, Fl.
Old 09-27-2010 , 21:12   Giving weapons - crash? :/
Reply With Quote #1

So I'm trying to give a player the "arms" weapon in Zombie Panic: Source, but the server crashes.

PHP Code:
// _Data is the client
FakeClientCommand(_Data"panic")
FakeClientCommand(_Data"dropweapon")
 
new 
iWeapon GivePlayerItem(_Data"weapon_arms")
PrintToServer("Player index %d given weapon index %d"_DataiWeapon)
EquipPlayerWeapon(_DataiWeapon)
PrintToServer("Player index %d equipped weapon index %d"_DataiWeapon
Sometimes the server will crash, sometimes the player will crash. I've noticed it prints different weapon indexes each time. One time when it crashed, it printed weapon index 317. Another when a player crashed, it printed 312. I'm not sure why exactly.
Spunky is offline
Send a message via AIM to Spunky
FaTony
Veteran Member
Join Date: Aug 2008
Old 09-28-2010 , 09:15   Re: Giving weapons - crash? :/
Reply With Quote #2

Index is defined at runtime.
FaTony is offline
Spunky
Senior Member
Join Date: May 2008
Location: Orlando, Fl.
Old 09-28-2010 , 13:59   Re: Giving weapons - crash? :/
Reply With Quote #3

Any insight into why it's crashing then? :/
Spunky is offline
Send a message via AIM to Spunky
Silvers
SourceMod Plugin Approver
Join Date: Aug 2010
Location: SpaceX
Old 09-28-2010 , 14:58   Re: Giving weapons - crash? :/
Reply With Quote #4

I think I had crashes with EquipPlayerWeapon when I had just removed a weapon, try adding a 0.1 delay before executing it.
__________________
Silvers is offline
Spunky
Senior Member
Join Date: May 2008
Location: Orlando, Fl.
Old 09-28-2010 , 22:51   Re: Giving weapons - crash? :/
Reply With Quote #5

Quote:
Originally Posted by Silvers View Post
I think I had crashes with EquipPlayerWeapon when I had just removed a weapon, try adding a 0.1 delay before executing it.
No dice. Thanks though.

Any other ideas?
Spunky is offline
Send a message via AIM to Spunky
Dr!fter
The Salt Boss
Join Date: Mar 2007
Old 09-28-2010 , 22:57   Re: Giving weapons - crash? :/
Reply With Quote #6

I had a crash with EquipPlayerWeapon when it tried to equip the weapon and it was already equiping it (auto switching on pick up). I dont exactly remember how i over came it i believe i found a different way to do it and avoided using EquipPlayerWeapon
Dr!fter is offline
Spunky
Senior Member
Join Date: May 2008
Location: Orlando, Fl.
Old 10-01-2010 , 19:21   Re: Giving weapons - crash? :/
Reply With Quote #7

I still can't figure this out. I've tried every method of spawning weapons I can think of.

I really really hate the ZPS team right now.
Spunky is offline
Send a message via AIM to Spunky
Silvers
SourceMod Plugin Approver
Join Date: Aug 2010
Location: SpaceX
Old 10-02-2010 , 08:21   Re: Giving weapons - crash? :/
Reply With Quote #8

This is what I'm using:

PHP Code:
// Remove
RemovePlayerItem(clienti_Ent);
RemoveEdict(i_Ent);

// Equip
new i_Ent CreateEntityByName("weapon_arms");
if (
i_Ent == -1) return;

DispatchSpawn(i_Ent);
EquipPlayerWeapon(clienti_Ent); 
I use this in Left4Dead but I'm guessing it will work.
__________________
Silvers is offline
Spunky
Senior Member
Join Date: May 2008
Location: Orlando, Fl.
Old 10-02-2010 , 10:28   Re: Giving weapons - crash? :/
Reply With Quote #9

Tried it before, doesn't work.
Spunky is offline
Send a message via AIM to Spunky
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 20:04.


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