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

Run time error


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
RAW_192
Senior Member
Join Date: Feb 2017
Old 07-04-2017 , 03:13   Run time error
Reply With Quote #1

Quote:
public event_roundStart()
{
new ent = -1

while((ent = find_ent_by_class(ent, WEAPONBOX)) > 0)
{
task_remove(ent)
weapon_remove(ent)
}

ent = -1

while((ent = find_ent_by_class(ent, ITEM_CLASSNAME)) > 0)
{
task_remove(ent)
entity_remove(ent)
}

for(new id = 1; id < g_iMaxPlayers; id++)
{
if(!g_bAlive[id])
continue

g_bDefuse[id] = false
g_bFreeLook[id] = false
g_fLastBuy[id] = Float:{0.0, 0.0, 0.0, 0.0}

task_remove(id - TASK_EQUIPAMENT)
task_remove(id - TASK_TEAMBALANCE)
task_remove(id - TASK_DEFUSE)

if(g_bRestarting)
{
task_remove(id)
task_remove(id - TASK_ADRENALINE)

g_bRestarted[id] = true
g_iAdrenaline[id] = 0
g_iAdrenalineUse[id] = 0
}

player_updateSpeed(id)
}
//this is line 4954
for(new iFlagTeam = TEAM_RED; iFlagTeam <= TEAM_BLUE; iFlagTeam++)
{
flag_sendHome(iFlagTeam)

task_remove(g_iFlagEntity[iFlagTeam])

log_message("%s, %s flag returned back to base.", (g_bRestarting ? "Game restarted" : "New round started"), g_szTeamName[iFlagTeam])
}

if(g_bRestarting)
{
g_iScore = {0,0,0}
g_bRestarting = false
}
}


PHP Code:
L 07/04/2017 02:58:52: [FUNInvalid player 5
L 07
/04/2017 02:58:52: [AMXXDisplaying debug trace (plugin "jctf.amxx"version "1.34d")
L 07/04/2017 02:58:52: [AMXXRun time error 10native error (native "set_user_maxspeed")
L 07/04/2017 02:58:52: [AMXX]    [0jctf-new.sma::player_updateSpeed (line 5454)
L 07/04/2017 02:58:52: [AMXX]    [1jctf-new.sma::event_roundStart (line 4954)
L 07/04/2017 02:59:14: [FUNInvalid player 5
L 07
/04/2017 02:59:14: [AMXXDisplaying debug trace (plugin "jctf.amxx"version "1.34d")
L 07/04/2017 02:59:14: [AMXXRun time error 10native error (native "set_user_maxspeed")
L 07/04/2017 02:59:14: [AMXX]    [0jctf-new.sma::player_updateSpeed (line 5454)
L 07/04/2017 02:59:14: [AMXX]    [1jctf-new.sma::event_roundStart (line 4954)
L 07/04/2017 02:59:46: [FUNInvalid player 5
L 07
/04/2017 02:59:46: [AMXXDisplaying debug trace (plugin "jctf.amxx"version "1.34d")
L 07/04/2017 02:59:46: [AMXXRun time error 10native error (native "set_user_maxspeed")
L 07/04/2017 02:59:46: [AMXX]    [0jctf-new.sma::player_updateSpeed (line 5454)
L 07/04/2017 02:59:46: [AMXX]    [1jctf-new.sma::event_roundStart (line 4954)
L 07/04/2017 03:00:25: [FUNInvalid player 2
L 07
/04/2017 03:00:25: [AMXXDisplaying debug trace (plugin "jctf.amxx"version "1.34d")
L 07/04/2017 03:00:25: [AMXXRun time error 10native error (native "set_user_maxspeed")
L 07/04/2017 03:00:25: [AMXX]    [0jctf-new.sma::player_updateSpeed (line 5454)
L 07/04/2017 03:00:25: [AMXX]    [1jctf-new.sma::event_roundStart (line 4954

Last edited by RAW_192; 07-04-2017 at 03:14.
RAW_192 is offline
CrazY.
Veteran Member
Join Date: May 2015
Location: SP, Brazil
Old 07-04-2017 , 22:51   Re: Run time error
Reply With Quote #2

Code:
while((ent = find_ent_by_class(ent, ITEM_CLASSNAME)) > 0)
?

Why not?
Code:
while ((ent = find_ent_by_class(-1, ITEM_CLASSNAME)) if (is_valid_ent(ent)) remove_entity(ent)


Quote:
[FUN] Invalid player 5
Probrably you didn't check if the user is alive.
__________________









Last edited by CrazY.; 07-04-2017 at 22:55.
CrazY. is offline
Craxor
Veteran Member
Join Date: Jan 2016
Location: Romania
Old 07-05-2017 , 01:12   Re: Run time error
Reply With Quote #3

The error says that the player is not valid, it can mean that user with Index '5' doesn't not exit or (i'm not sure at this hour because i'm very sleepy) it is not alive, as CrazY say you can add an is_user_alive() filter.

But i'm giving you an friendly advice and say that you should give-up checking for players with this method:

PHP Code:
for(new id 1id g_iMaxPlayersid++)

Better use get_players() also in that way you can also use the flag "a" and leave is_user_alive().
__________________
Project: Among Us
Craxor is offline
Send a message via ICQ to Craxor
Natsheh
Veteran Member
Join Date: Sep 2012
Old 07-05-2017 , 01:55   Re: Run time error
Reply With Quote #4

There isnt enough code provided....

And Crazy its unnecessary to check if entity is valid...
Since find ent returns a vaild entities id if its above 0

And as craxor said it would be better if you looped throw get players instead of get maxplayers , it would better to loop throw all maxplayers if you wanted to reset players arrays.... And not execute .actions on them
__________________
@Jailbreak Main Mod v2.7.0 100%
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !


Last edited by Natsheh; 07-05-2017 at 01:56.
Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
CrazY.
Veteran Member
Join Date: May 2015
Location: SP, Brazil
Old 07-05-2017 , 10:15   Re: Run time error
Reply With Quote #5

Quote:
And Crazy its unnecessary to check if entity is valid...
Since find ent returns a vaild entities id if its above 0
Aah, ok.
__________________








CrazY. is offline
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 03:13.


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