Raised This Month: $ Target: $400
 0% 

2 questions.. pfn_touch and model sequences


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
oberon
Junior Member
Join Date: Sep 2004
Location: UK
Old 11-05-2005 , 10:41   2 questions.. pfn_touch and model sequences
Reply With Quote #1

q1: pfn_touch called, then one of touching entities isnt found when u do something to it throwing a "Cannot find entity" error

i'm making a checkpoint mod for uwc3 (cs), where bomb/hostages are removed from the map, and instead 3-5 checkpoints are spawned into the map, and if one team controls all the checkpoints, the other team have X seconds to recapture a point or they all get slayed.

I got it working fine (no errors) on a test server on my machine with 5 players, and loads of bots... then when i moved it to one of our real servers, bits didnt work, and after adding debug, this line is causing the "cannot find entity" error was line 487 (attached sma below):

Code:
entity_get_string( iToucherId, EV_SZ_classname, szClassName, 31 )

from:

Code:
//---------------------------------------------------------------------------------------------- public pfn_touch( ptr, ptd ) {     return on_Touch( ptr, ptd ) } //---------------------------------------------------------------------------------------------- public on_Touch( entity1, entity2 ) {     if(get_cvar_num("cp_enable") == 0) return PLUGIN_HANDLED         // Make sure it's a player that's being touched... mmmm     new iToucherId = entity1     new iPlayerId  = entity2         if ( iPlayerId < 1 || iPlayerId > 32 || iToucherId < 1 || !is_user_alive( iPlayerId ) )         return PLUGIN_CONTINUE         new szClassName[32]     entity_get_string( iToucherId, EV_SZ_classname, szClassName, 31 )         // Change checkpoint's team     if ( equali( szClassName, "CHECKPOINT" ) ) {             // Change Checkpoint to iPlayerId's team etc etc etc

and yet stuff that can only happen if the szClassName is "CHECKPOINT" happens, even tho it cant find the entity. The checkpoint changes model to the right colour, but the xp isnt given (or even a msg to indicate that the xp function was called).

I've attached the sma, and the models (need to be in the models/uwc3_cp folder).. if anyone is bored and wants to try compiling it u wont need uwc3, just when it awards xp, it'll be 0

q2: the letter models attached have one sequence, idle which is the letter spinning 360 degrees on the spot. yet when i add the model in game, its static.

I was told the following would do the trick, but i tried 0 - 6 for the sequence number, and couldnt get it to work:

Code:
entity_set_int(iEnt, EV_INT_sequence, 0)

cheers in advance
Attached Files
File Type: zip uwc3_cp_models.zip (12.1 KB, 60 views)
File Type: sma Get Plugin or Get Source (checkpoints.sma - 598 views - 34.6 KB)
oberon is offline
Send a message via MSN to oberon
Hawk552
AMX Mod X Moderator
Join Date: Aug 2005
Old 11-05-2005 , 10:45  
Reply With Quote #2

Try
Code:
if ( iPlayerId < 1 || iPlayerId > 32 || iToucherId < 1 || !is_user_alive( iPlayerId ) || !is_valid_ent(iToucherId) )
__________________
Hawk552 is offline
Send a message via AIM to Hawk552
Bend3R
Veteran Member
Join Date: Oct 2004
Location: Sweden (Stockholm)
Old 11-05-2005 , 11:47  
Reply With Quote #3

nice models, have would be good to my server with my name lol
If it was N R models in it too
Bend3R is offline
XxAvalanchexX
Veteran Member
Join Date: Oct 2004
Location: abort73.com
Old 11-05-2005 , 14:30  
Reply With Quote #4

About your code, Hawk. Firstly, if a server's max slots is 8, then a non-player entity could have an index of 9, so the > 32 check is useless. Secondly, is_user_alive already checks if the player is connected, so you can just remove the < 1 and > 32 checks entirely and leave is_user_alive in there. Thirdly, why do you check to see if the other entity's index is > 1 and then use is_valid_ent? Scrap the > 1 check and just use is_valid_ent, it won't explode of the entity is 0.
XxAvalanchexX is offline
Hawk552
AMX Mod X Moderator
Join Date: Aug 2005
Old 11-05-2005 , 14:58  
Reply With Quote #5

All I did was add !is_valid_ent. If you actually read his post, you would see he put that stuff.
__________________
Hawk552 is offline
Send a message via AIM to Hawk552
Reply


Thread Tools
Display Modes

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 23:45.


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