AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   [ Solved ] fwHamPlayerSpawnPost (https://forums.alliedmods.net/showthread.php?t=75213)

xPaw 08-01-2008 10:19

[ Solved ] fwHamPlayerSpawnPost
 
L 08/01/2008 - 17:13:58: [FUN] Invalid player 2
L 08/01/2008 - 17:13:58: [AMXX] Displaying debug trace (plugin "vip.amxx")
L 08/01/2008 - 17:13:58: [AMXX] Run time error 10: native error (native "set_user_health")
L 08/01/2008 - 17:13:58: [AMXX] [0] vip.sma::fwHamPlayerSpawnPost (line 52)


how to fix it ? here code
PHP Code:

#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <hamsandwich>
#include <fakemeta_util>
#include <ColorChat>
#include <fun>

#define VIP_ACCES ADMIN_LEVEL_B

new iconstatus;

public 
plugin_init() {
    
register_plugin("VIP Plugin""1.1""xPaw")

    
RegisterHam(Ham_Spawn"player""fwHamPlayerSpawnPost"1);
    
register_forward(FM_PlayerPreThink"fw_prethink")
    
iconstatus get_user_msgid("StatusIcon");
}

public 
client_putinserver(id)
{
    if(
get_user_flags(id) & VIP_ACCES)
    {
        
set_task(5.0"welcome_vip"id);
    }
}

public 
welcome_vip(id) {
        new 
vipname[33]
        
get_user_name(idvipname32)
        
        
client_cmd(0"spk buttons/bell1")
        
ColorChat(0RED"^x01**^x04 VIP^x03 %s^x04 has connected."vipname)
        
client_print(idprint_center"Welcome %s."vipname)
        
set_user_vip_xpaw(id)
}

public 
set_user_vip_xpaw(id){
    
message_beginMSG_ONEget_user_msgid("ScoreAttrib") )
    
write_byteid 
    
write_byte
    
message_end()
}

public 
fwHamPlayerSpawnPost(id)
{
    if(!
is_user_alive(id)) return PLUGIN_HANDLED;
    
    if(
get_user_flags(id) & VIP_ACCES)
    {
        new 
viphealth get_user_health(id);
            
set_user_healthidviphealth+50 )
            
cs_set_user_moneyidcs_get_user_money(id)+1000 )
            
fm_give_item(id"item_assaultsuit");
            
fm_give_item(id"weapon_hegrenade")
            
set_user_vip_xpaw(id)
            
            return 
PLUGIN_CONTINUE;
    }
    return 
PLUGIN_CONTINUE;
}

public 
fw_prethink(id)
{
    if(!(
pev(id,pev_button) & FL_ONGROUND) && get_user_flags(id) & VIP_ACCES)
    {    
        
message_begin(MSG_ONE,iconstatus,{0,0,0},id);
        
write_byte(1); // status (0=hide, 1=show, 2=flash)
        
write_string("vipsafety"); // sprite name
        
write_byte(0); // red
        
write_byte(255); // green
        
write_byte(0); // blue
        
message_end();
    }
    



AntiBots 08-01-2008 12:20

Re: fwHamPlayerSpawnPost
 
PHP Code:

set_user_healthidget_user_health(id) + 50 ); 

</SPAN>

xPaw 08-01-2008 12:26

Re: fwHamPlayerSpawnPost
 
wont work, server crushes with error: Host_error: WriteDest_Parm: not a client

AntiBots 08-01-2008 12:40

Re: fwHamPlayerSpawnPost
 
PHP Code:

#include <amxmodx> 
#include <amxmisc> 
#include <cstrike> 
#include <hamsandwich> 
#include <fakemeta_util> 
#include <ColorChat> 
#include <fun> 
#define VIP_ACCES ADMIN_LEVEL_B 
new iconstatus
public 
plugin_init() { 
    
register_plugin("VIP Plugin""1.1""xPaw"
    
RegisterHam(Ham_Spawn"player""fwHamPlayerSpawnPost"1); 
    
register_forward(FM_PlayerPreThink"fw_prethink"
    
iconstatus get_user_msgid("StatusIcon"); 

public 
client_putinserver(id

    if(
get_user_flags(id) & VIP_ACCES
    { 
        
set_task(5.0"welcome_vip"id); 
    } 

public 
welcome_vip(id) { 
        new 
vipname[33
        
get_user_name(idvipname32
 
        
client_cmd(0"spk buttons/bell1"
        
ColorChat(0RED"^x01**^x04 VIP^x03 %s^x04 has connected."vipname
        
client_print(idprint_center"Welcome %s."vipname
        
set_user_vip_xpaw(id

public 
set_user_vip_xpaw(id)
{   
// 0 - nothing, 1 - dead, 2 - bomb 
   
message_begin(MSG_ALLget_user_msgid("ScoreAttrib"),{0,0,0},0
   
write_byte(id
   
write_byte(4
   
message_end() 
   return 
PLUGIN_HANDLED 

public 
fwHamPlayerSpawnPost(id

    if(!
is_user_alive(id)) return PLUGIN_HANDLED
 
    if(
get_user_flags(id) & VIP_ACCES
    { 
        
set_user_healthidget_user_health(id) + 50); 
        
cs_set_user_money(idcs_get_user_money(id) + 1000);
        
fm_give_item(id"item_assaultsuit"); 
        
fm_give_item(id"weapon_hegrenade");
        
set_user_vip_xpaw(id);
 
        return 
PLUGIN_CONTINUE
    } 
    return 
PLUGIN_CONTINUE

public 
fw_prethink(id

    if(!(
pev(id,pev_button) & FL_ONGROUND) && get_user_flags(id) & VIP_ACCES
    {     
        
message_begin(MSG_ONE,iconstatus,{0,0,0},id); 
        
write_byte(1); // status (0=hide, 1=show, 2=flash) 
        
write_string("vipsafety"); // sprite name 
        
write_byte(0); // red 
        
write_byte(255); // green 
        
write_byte(0); // blue 
        
message_end(); 
    } 
 


I change that and any error I have

xPaw 08-01-2008 12:57

Re: fwHamPlayerSpawnPost
 
+k for fixing all loose indifications, going to test

[EDIT]Thanks! for fine now ;)[/EDIT]


All times are GMT -4. The time now is 05:33.

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