This site is a testing version, but all data is shared with the live forum.


Raised This Month: $ Target: $400
 0% 

Register_touch


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Mxnn
Veteran Member
Join Date: Aug 2009
Location: AT MY HOME
Old 01-05-2010 , 14:13   Register_touch
Reply With Quote #1

I need help with this.. I use the same method as OneEyed on his Soccerjam plugin and my plugin didn't works..
I put this:
PHP Code:
public plugin_init () {

             
register_touch("Package""player""PackageTouched")
}

public 
PackageTouched(TPackageplayer) {
             
client_print(playerprint_chat"ASDSAD")

I tried instead of "Package" "cycler_sprite" (is my entity) but nothing..

When i touch the entity i transfer it (? <-- i traduce this with google traductor
Why didn't works?
Mxnn is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 01-05-2010 , 15:22   Re: Register_touch
Reply With Quote #2

So, "Package" is the entity classname, are you sure ? The code is right though. So all I see is you did not set the classname.
__________________
Arkshine is offline
Mxnn
Veteran Member
Join Date: Aug 2009
Location: AT MY HOME
Old 01-05-2010 , 17:35   Re: Register_touch
Reply With Quote #3

Yes, i put this when i created it
PHP Code:
            package create_entity("cycler_sprite")
            
entity_set_string(packageEV_SZ_classname,"Package")
            
entity_set_model(packagePACKAGEMODEL)
            
entity_set_origin(packageoriginp)
            
entity_set_int(packageEV_INT_solidSOLID_BBOX)
            
DispatchSpawn(package
Mxnn is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 01-05-2010 , 17:36   Re: Register_touch
Reply With Quote #4

Try to set a size.
__________________
Arkshine is offline
xPaw
Retired AMX Mod X Moderator
Join Date: Jul 2008
Old 01-05-2010 , 18:02   Re: Register_touch
Reply With Quote #5

You can try SOLID_TRIGGER.
__________________
xPaw is offline
Mxnn
Veteran Member
Join Date: Aug 2009
Location: AT MY HOME
Old 01-05-2010 , 19:24   Re: Register_touch
Reply With Quote #6

Hmm nothing..
It's rare because i put the same stuff as OneEyed and in my plugin didn't work, in yours yes..
Mxnn is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 01-05-2010 , 19:28   Re: Register_touch
Reply With Quote #7

Show the whole code.
__________________
Arkshine is offline
Mxnn
Veteran Member
Join Date: Aug 2009
Location: AT MY HOME
Old 01-05-2010 , 20:17   Re: Register_touch
Reply With Quote #8

PHP Code:
public plugin_init () {

             
register_touch("Package""player""PackageTouched")
             
register_logevent("RoundStart"2"1=Round_Start")
}

public 
PackageTouched(TPackageplayer) {
             
client_print(playerprint_chat"ASDSAD")
}

public 
RoundStart() {
          
HidingPackage()
}

HidingPackage() {
    
    if (
file_exists(szFile)) {
        new 
Floatoriginp[3], Floatoriginfp[3], Floatoriginfp1[3], data[20], FileLines file_size(szFile1)
        new 
LineP random_num(1FileLines), x[5], y[5], z[5], Line=0LineFP=0LineFP1=0
        
new charcount
        
//Get random line for Fake Package #1
        
do 
        
LineFP=random_num(1FileLines)
        while(
LineFP == LineP);
        
//Get random line for Fake Package #2
        
do
        
LineFP1=random_num(1FileLines)
        while(
LineFP1 == LineP || LineFP1 == LineFP);
        
        
//Getting coordinates
        
for (Line=0Line<=FileLinesLine++) {
            
            if (
Line == LineP) {
                
read_file(szFileLinedata19charcount)
                
strtok(datax4data19' ')
                
strtok(datay4z4' ')
                
originp[0] = str_to_num(x) + 0.0 
                originp
[1] = str_to_num(y) + 0.0
                originp
[2] = str_to_num(z) + 0.0
            
}
            else if (
Line == LineFP) {
                
read_file(szFileLinedata19charcount)
                
strtok(datax4data19' ')
                
strtok(datay4z4' ')
                
originfp[0] = str_to_num(x) + 0.0 
                originfp
[1] = str_to_num(y) + 0.0
                originfp
[2] = str_to_num(z) + 0.0
            
}
            else if (
Line == LineFP1) {
                
read_file(szFileLinedata19charcount)
                
strtok(datax4data19' ')
                
strtok(datay4z4' ')
                
originfp1[0] = str_to_num(x) + 0.0 
                originfp1
[1] = str_to_num(y) + 0.0
                originfp1
[2] = str_to_num(z) + 0.0
            
}
        }
        
        new 
Float:MinBox[3], Float:MaxBox[3]
        
MinBox[0] = -15.0
        MinBox
[1] = -15.0
        MinBox
[2] = 0.0
        MaxBox
[0] = 15.0
        MaxBox
[1] = 15.0
        MaxBox
[2] = 12.0
        
        
if(!find_ent_by_class(-1"Package")) {
            
package create_entity("cycler_sprite")
            
entity_set_string(packageEV_SZ_classname,"Package")
            
entity_set_model(packagePACKAGEMODEL)
            
entity_set_origin(packageoriginp)
            
entity_set_size(packageMinBoxMaxBox)
            
entity_set_int(packageEV_INT_solidSOLID_TRIGGER)
            
DispatchSpawn(package)
        }
        
        if(!
find_ent_by_class(-1"FPackage")) {
            
fpackage create_entity("cycler_sprite")
            
entity_set_string(fpackageEV_SZ_classname,"FPackage")
            
entity_set_model(fpackageFAKE_PACKAGEMODEL)
            
entity_set_origin(fpackageoriginfp)
            
entity_set_size(fpackageMinBoxMaxBox)
            
entity_set_int(fpackageEV_INT_solidSOLID_TRIGGER)
            
DispatchSpawn(fpackage)
        }
        
        if(!
find_ent_by_class(-1"FPackage1")) {
            
fpackage1 create_entity("cycler_sprite")
            
entity_set_string(fpackage1EV_SZ_classname,"FPackage1")
            
entity_set_model(fpackage1FAKE_PACKAGEMODEL)
            
entity_set_origin(fpackage1originfp1)
            
entity_set_size(fpackage1MinBoxMaxBox)
            
entity_set_int(fpackage1EV_INT_solidSOLID_TRIGGER)
            
DispatchSpawn(fpackage1)
        }
    }

That is all the code about that entities.. I create 3 entities and i took the coordinates from a file which have respawns (i took it from csdm)
Then i transform the origins in numbers and then i create it..

package, fpackage, fpackage1 are 3 global vars. PACKAGEMODEL & FAKE_PACKAGEMODEL are the models of the packages..
Mxnn is offline
wrecked_
Veteran Member
Join Date: Jan 2010
Location: New York (GMT-5)
Old 02-02-2010 , 15:45   Re: Register_touch
Reply With Quote #9

I think you need to make HidingPackage() a public function. Not too sure though.
__________________
[ Paid Requests ]
DO NOT PM ME ABOUT BLOCKMAKER
NO PRIVATE SUPPORT
wrecked_ is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 02-03-2010 , 12:43   Re: Register_touch
Reply With Quote #10

Quote:
Originally Posted by wrecked_ View Post
I think you need to make HidingPackage() a public function. Not too sure though.
Not at all.
__________________
- tired and retired -

- my plugins -
ConnorMcLeod 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 01:03.


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