AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Native error ? (https://forums.alliedmods.net/showthread.php?t=154633)

dreamedward 04-11-2011 07:43

Native error ?
 
Hey,guys. So I have this plugin here. It shows Win Messages to the team who has won. So it compiles, everything is perfect but when I start the server and the round has ended, it doesn't show the Win Message model and the console prints
"[FUN] Player out of range <0> [AMXX] Displaying debug trace <plugun "winmes.amxx"> [AMXX] Run time error 10:native error <native "strip_user_weapons">"
So can somebody help me please? Here is the code:
PHP Code:

#include <amxmodx>
#include <fakemeta>
#include <hamsandwich>
#include <fun>
new const ModelCT[] = "models/winCT.mdl"
new const ModelT[] = "models/winT.mdl"
new bool:TWin[33]
new 
bool:CtWin[33]
public 
plugin_init() {
 
// =================================================
 
register_plugin("Win Messages","1.0","MAD.XayC")
 
// =================================================
 
RegisterHam(Ham_Spawn"player""HAM_spawn"1)
 
// =================================================
 
register_event("SendAudio""ct_win""a""2&%!MRAD_ctwin"
 
register_event("SendAudio""t_win""a""2&%!MRAD_terwin"
 
// =================================================
 
register_event("CurWeapon""curweapon""be""1=1")
 
// =================================================
}
public 
plugin_precache() {
 
precache_model(ModelCT)
 
precache_model(ModelT)
}
public 
client_putinserver(id) {
 
TWin[id] = false
 CtWin
[id] = false
}
public 
HAM_spawn(id) {
 
TWin[id] = false
 CtWin
[id] = false

public 
t_win(id) {
 
strip_user_weapons(id)
 
give_item(id"weapon_knife")
 
CtWin[id] = false
 TWin
[id] = true
}
public 
ct_win(id) {
 
strip_user_weapons(id)
 
give_item(id"weapon_knife")
 
CtWin[id] = true
 TWin
[id] = false
}
public 
curweaponid ) {
 if(
TWin[id] == true)
  
set_pev(idpev_viewmodel2ModelT)
 if(
CtWin[id] == true)
  
set_pev(idpev_viewmodel2ModelCT)


Thanks in advance! :)

schmurgel1983 04-11-2011 08:31

Re: Native error ?
 
Quote:

Originally Posted by dreamedward (Post 1447638)
PHP Code:

 register_event("SendAudio""ct_win""a""2&%!MRAD_ctwin"
 
register_event("SendAudio""t_win""a""2&%!MRAD_terwin"


u have register as global, so id is all time 0.

make sure to sent weapon_strip and give_item to all players (1-32)
use a for content

sample:
PHP Code:

new maxplayers get_maxplayers()
for (new 
id 1id <= maxplayersid++)
{
     
// code (but check if ID connected and alive)



dreamedward 04-11-2011 10:07

Re: Native error ?
 
Added that. Now the models are showed but they dont dissapear after the new round has started they just stay. You can buy a weapon, shoot with it, but the model does not dissapear. Can anyone help about that ?


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

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