AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   [Please help me!] (https://forums.alliedmods.net/showthread.php?t=208422)

xing9634 02-13-2013 08:10

[Please help me!]
 
L 02/13/2013 - 21:06:35: [AMXX] Run time error 4: index out of bounds
L 02/13/2013 - 21:06:35: [AMXX] [0] jbk.sma::Fwd_Touch (line 71)

PHP Code:

public Fwd_Touch(id)
{
 if(
foot[id] == 0)
    {
    return 
PLUGIN_CONTINUE
    
}
 if(
is_user_alive(id))
        
set_user_footsteps(id,1)
 return 
FMRES_IGNORED


What's wrong?

YamiKaitou 02-13-2013 08:20

Re: [Please help me!]
 
Rest of the code? Or at least what line is the error on and where is that variable defined.

xing9634 02-13-2013 08:26

Re: [Please help me!]
 
Quote:

Originally Posted by YamiKaitou (Post 1893549)
Rest of the code? Or at least what line is the error on and where is that variable defined.

if(foot[id] == 0)

Backstabnoob 02-13-2013 08:42

Re: [Please help me!]
 
How do you initialize the foot variable?

xing9634 02-13-2013 08:52

Re: [Please help me!]
 
Quote:

Originally Posted by Backstabnoob (Post 1893557)
How do you initialize the foot variable?


foot[id] = 0

YamiKaitou 02-13-2013 09:15

Re: [Please help me!]
 
Please provide the entire code

xing9634 02-13-2013 09:48

Re: [Please help me!]
 
Quote:

Originally Posted by YamiKaitou (Post 1893573)
Please provide the entire code

This is the entire code:
PHP Code:

/* Plugin generated by AMXX-Studio */
#include <amxmodx>
#include <fun>
#include <fakemeta>
#include <unlimited_money>
#define PLUGIN "No Footsteps"
#define VERSION "1.0"
#define AUTHOR "AMXX Community"
new foot[33]
new 
g_dp_access
public plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
register_cvar("dp_cost""1000"
    
register_event("ResetHUD","RoundStart","b")
    
register_clcmd("say /foot","ShowPayForItMenu")
    
register_forward FM_Touch"Fwd_Touch" 
    
g_dp_access register_cvar("amx_dp_access""c");
}
 
public 
ShowPayForItMenu(id) {
                        new 
iAccess[32];
                        
get_pcvar_string(g_dp_accessiAccess31);
                        if(
get_user_flags(id) & read_flags(iAccess) == 0)
                        {
    new 
msg[256]
    
format(msg255"^x04銆恀x03闈欐鍗x01@^x03鎻愮ず^x04銆慯x01瀵逛笉璧?鍙湁^x03浼氬憳^x01鎵嶈兘璐拱^x04銆愰潤姝ュ崱銆慯x04.")
    
client_color(ididmsg)
    return 
PLUGIN_CONTINUE
   
}
   if(!
is_user_alive(id)) {
                        new 
msg[256]
   
format(msg255"^x04銆恀x03闈欐鍗x01@^x03鎻愮ず^x04銆慯x01瀵逛笉璧?鍙湁^x04娲荤潃^x01鎵嶈兘璐拱^x04銆愰潤姝ュ崱銆慯x01.")
   
client_color(ididmsg)
   return 
PLUGIN_HANDLED  
   
}
                        if(
foot[id] > 0){
   new 
msg[256]
   
format(msg255"^x04銆恀x03闈欐鍗x01@^x03鎻愮ず^x04銆慯x01瀵逛笉璧穅x01,浣犲凡璐拱浜哵x04銆愰潤姝ュ崱銆慯x01,涓嶈兘鍐峖x04璐拱^x01浜?")
   
client_color(ididmsg)
                        return 
PLUGIN_CONTINUE
                        
}
   new 
money cs_get_user_money2(id
   new 
dpcost get_cvar_num("dp_cost"
   if(
money dpcost)  { 
   new 
msg[256]
   
format(msg255"^x04銆恀x03闈欐鍗x01@^x03鎻愮ず^x04銆慯x01瀵逛笉璧穅x01,浣犳矑鏈夎冻澶犵殑^x04閲戦挶^x01璐拱^x04銆愰潤姝ュ崱銆慯x01.")
   
client_color(ididmsg)
   } 
                        else
                        {
   
foot[id] = 1
   cs_set_user_money2
(idmoney dpcost)
   new 
player_name[32
   
get_user_name(idplayer_name31)
   new 
msg[256]
   
format(msg255"^x04銆恀x03闈欐鍗x01@^x03鎻愮ず^x04銆慯x01鎭枩^x03%s^x01鎴愬姛璐拱浜嗕竴涓猑x04銆愰潤姝ュ崱銆慯x01,瑕佸皬蹇冨摝!"player_name)
   
client_color(0idmsg)
                        }
   return 
PLUGIN_CONTINUE 
}
public 
Fwd_Touch(id)
{
 if(
foot[id] == 0)
    {
    return 
PLUGIN_CONTINUE
    
}
 if(
is_user_alive(id))
        
set_user_footsteps(id,1)
 return 
FMRES_IGNORED
}  
public 
RoundStart(id)
{
        
foot[id] = 0
}
public 
client_color(playeridcoloridmsg[])
{
 
message_begin(playerid?MSG_ONE:MSG_ALL,get_user_msgid("SayText"),_,playerid
 
write_byte(colorid)
 
write_string(msg)
 
message_end()
}
 
/* AMXX-Studio浠g爜涓嶈兘浣庝笌杩欓噷 杞欢姹夊寲SiMen.K.
*{\\ rtf1\\ ansi\\ ansicpg1252\\ deff0{\\ fonttbl{\\ f0\\ fnil\\ fcharset0 Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang2052\\ f0\\ fs16 \n\\ par }
*/ 


Backstabnoob 02-15-2013 16:53

Re: [Please help me!]
 
Check if id is player in Fwd_Touch


All times are GMT -4. The time now is 20:34.

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