AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Error With pfn_touch (https://forums.alliedmods.net/showthread.php?t=192320)

deadman909 08-08-2012 23:40

Error With pfn_touch
 
Can anybody tell me what is wrong with this code. I keep getting the errors at the bottom. The plugin is doing what it is suppose to but for some reason I get these errors which from time to time seem to make server CRASH.


PHP Code:

L 08/08/2012 20:35:29Invalid player id 133
L 08
/08/2012 20:35:29: [AMXXDisplaying debug trace (plugin "presents.amxx")
L 08/08/2012 20:35:29: [AMXXRun time error 10native error (native "client_print")
L 08/08/2012 20:35:29: [AMXX]    [0presents.sma::pfn_touch (line 265

Line 265 is: client_print(ptd, print_chat, "[AMXX] YAY I found an Item on the Floor with $%d Dollars", addmoney)


PHP Code:

L 08/08/2012 18:45:59: [CSTRIKEPlayer out of range (104)
L 08/08/2012 18:45:59: [AMXXDisplaying debug trace (plugin "presents.amxx")
L 08/08/2012 18:45:59: [AMXXRun time error 10native error (native "cs_get_user_money")
L 08/08/2012 18:45:59: [AMXX]    [0presents.sma::pfn_touch (line 267

Line 267 is: cs_set_user_money(ptd, totalmoney)

ConnorMcLeod 08-09-2012 01:07

Re: Error With pfn_touch
 
ptd can be other entities than players.
You would have better to use register_touch("xmas_present", "player", "XMasPresent_Touch")

public XMasPresent_Touch(present, player)

deadman909 08-09-2012 09:49

Re: Error With pfn_touch
 
Hmm thanks. The way you told me fixed that error. But now I get this errors for this other part of the code.
Code:

[AMXX] Displaying debug trace (plugin "presents.amxx")
[AMXX] Run time error 4: index out of bounds
[AMXX]    [0] presents.sma::CreateEnt (line 223)
[AMXX]    [1] presents.sma::event_RoundStarted (line 141)

This is: [AMXX] [1] presents.sma::event_RoundStarted (line 141)
Line 141 is: CreateEnt(origins[a])
PHP Code:

public event_RoundStarted()
{
    if(!
isLoaded)
        return 
PLUGIN_CONTINUE
        
    
new ab
        
    
for(0totalOriginsa++)
    {
        for(
0PRESENTAMOUNTb++)
        {
            
CreateEnt(origins[a])
        }
    }
    
    return 
PLUGIN_CONTINUE


This is: [AMXX] [0] presents.sma::CreateEnt (line 223)
Line 223 is: CreateEnt(origins[a])
I am pretty sure that it has something to do with the cmd_Spawn because it gives me this error when I compile it: NewPlugin.sma(195) : warning 213: tag mismatch
Line 195 is: set_task(2.5, "CreateEnt", 0, curOrigin, 3)

I tried fixing it by putting: set_task(2.5, "CreateEnt") instead but although it compiles with no errors. It still gives me the errors in the Log.


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

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