Simple Plugin Problems

Misanthropist
🌠 Staff
🌈 Beta Tester
β˜… Black Lounger β˜…
βœ”οΈ HL Verified
πŸš‚ Steam Linked
πŸ’» Oldtimer
Joined
Sep 18, 2003
Messages
1,406
Best answers
1
Location
Perth, Australia
OK, Im working on a transformation plugin, which works quite well for the most part, but for some reason doing something as [apparently] simple as changing beam sprites is just doing my head in.

Ive scoured the web about this and my syntax is correct, i cant see anything wrong with it, but it just wont compile. AlliedMods isnt very helpful, and from what Ive seen im not doing anything any different. Please please help while I have a shred of sanity left!

Ive got most of the ESF constants sussed out, and have an idea on manipulating them. Ive only posted code here relevant to sprites.


Code:
public plugin_init() {
    register_plugin("blah", "blah", "blah")
    
    // register beam attack
    register_message( get_user_msgid( "EETrail" ), "BeamAttack" )

    return PLUGIN_CONTINUE;
}


new RedBeamHead
new RedBeamStart
new RedBeamTrail

public plugin_precache() {
    
       
    // WHY DOES THIS HATE ME?
    RedBeamHead = precache_model("sprites/redattacka.spr")
    RedBeamStart = precache_model("sprites/redattackastart.spr")
    RedBeamTrail = precache_model("sprites/redtrail.spr")
    
}


// COMPILER HATES ANY REFERENCE TO REDBEAMHEAD ETC
public BeamAttack(id)

{

    new playerID = get_msg_arg_int(1);
    new clip
    new ammo
    new weaponID = get_user_weapon( playerID, clip, ammo )
   
    // CHANGE GENERIC BEAM IF TRANSFORMED
    if (weaponID == 4 && PlayerTransformed[id])
    {
        set_msg_arg_int( 4, ARG_SHORT, RedBeamStart) // beam start a
        set_msg_arg_int( 5, ARG_SHORT, RedBeamStart) // beam start b
        set_msg_arg_int( 6, ARG_SHORT, RedBeamHead) // beam head a
        set_msg_arg_int( 7, ARG_SHORT, RedBeamHead) // beam head b
        set_msg_arg_int( 8, ARG_SHORT, RedBeamTrail) // trail
        set_msg_arg_int( 9, ARG_BYTE, get_msg_arg_int(9) * 10 ) // size
    }
   

    return PLUGIN_CONTINUE;

}


// THIS WORKS FOR THE MOST PART, BIT DODGY BUT NOT REALLY FUSSED ATM
public client_PostThink(id) // 
{
    // Check Class is Goku
    new playerClass = entity_get_int(id, EV_INT_playerclass)
    if(PlayerTransformed[id] && playerClass == 2) { 
        
     
        new ent, Float:origin[3];
        entity_get_vector(id,EV_VEC_origin,origin);
        
        // Change BlueCharge into RedCharge
        while((ent = find_ent_in_sphere(ent,origin,64.0)) != 0) {
            new model[32];
            entity_get_string(ent,EV_SZ_model,model,31);
            if(containi(model,"sprites/bluecharge.spr") != -1) {
                entity_set_model(ent,"sprites/redcharge.spr");
            }
            
        }
    }
    
    
    return PLUGIN_CONTINUE
}


What am i doing wrong?
 
Last edited:
Former Forcepit Member :(
βœ”οΈ HL Verified
πŸ’» Oldtimer
Joined
Aug 21, 2006
Messages
1,717
Best answers
0
Location
korriban
the problem is you need a space between ( and "
 
Last edited:
Misanthropist
🌠 Staff
🌈 Beta Tester
β˜… Black Lounger β˜…
βœ”οΈ HL Verified
πŸš‚ Steam Linked
πŸ’» Oldtimer
Joined
Sep 18, 2003
Messages
1,406
Best answers
1
Location
Perth, Australia
Haha thanks, an unexpected but understandable convention.
It allows it to compile but it doesnt change the gen beam spites. The gen-charge is fine though...
 
Former Forcepit Member :(
βœ”οΈ HL Verified
πŸ’» Oldtimer
Joined
Aug 21, 2006
Messages
1,717
Best answers
0
Location
korriban
Haha thanks, an unexpected but understandable convention.
It allows it to compile but it doesnt change the gen beam spites. The gen-charge is fine though...
so its working now if so then i should let you know i dont have a lot of knowlage in pawn
 
Misanthropist
🌠 Staff
🌈 Beta Tester
β˜… Black Lounger β˜…
βœ”οΈ HL Verified
πŸš‚ Steam Linked
πŸ’» Oldtimer
Joined
Sep 18, 2003
Messages
1,406
Best answers
1
Location
Perth, Australia
Well it compiles without errors now thanks to you, but the beam attack sprites arent effected by the function.

Code:
public BeamAttack(id)

{

    new playerID = get_msg_arg_int(1);
    new clip
    new ammo
    new weaponID = get_user_weapon( playerID, clip, ammo )
   
    // CHANGE GENERIC BEAM IF TRANSFORMED
    if (weaponID == 4 && PlayerTransformed[playerID])
    {
        set_msg_arg_int( 4, ARG_SHORT, RedBeamStart) // beam start a
        set_msg_arg_int( 5, ARG_SHORT, RedBeamStart) // beam start b
        set_msg_arg_int( 6, ARG_SHORT, RedBeamHead) // beam head a
        set_msg_arg_int( 7, ARG_SHORT, RedBeamHead) // beam head b
        set_msg_arg_int( 8, ARG_SHORT, RedBeamTrail) // trail
        set_msg_arg_int( 9, ARG_BYTE, get_msg_arg_int(9) * 10 ) // size
    }
   

    return PLUGIN_CONTINUE;

}

This is the convention for changing the sprites of an attack, but it has no effect for me. Ill experiment a little more...
 
Former Forcepit Member :(
βœ”οΈ HL Verified
πŸ’» Oldtimer
Joined
Aug 21, 2006
Messages
1,717
Best answers
0
Location
korriban
try putting a space between ( and weapon id that might help and the same for the )
 
Misanthropist
🌠 Staff
🌈 Beta Tester
β˜… Black Lounger β˜…
βœ”οΈ HL Verified
πŸš‚ Steam Linked
πŸ’» Oldtimer
Joined
Sep 18, 2003
Messages
1,406
Best answers
1
Location
Perth, Australia
No the space seems to only be relevant at the precache, anywhere else it hasnt appeared to matter. At first I assumed it was just neat formatting, now i just find it weird and picky lol. Ive managed to fix my beam thing anyhow, typical typo in the condition. Cheers for your help ^_^
 
Former Forcepit Member :(
βœ”οΈ HL Verified
πŸ’» Oldtimer
Joined
Aug 21, 2006
Messages
1,717
Best answers
0
Location
korriban
No the space seems to only be relevant at the precache, anywhere else it hasnt appeared to matter. At first I assumed it was just neat formatting, now i just find it weird and picky lol. Ive managed to fix my beam thing anyhow, typical typo in the condition. Cheers for your help ^_^
no problem glad i could help ya
 

Users who are viewing this thread

Top Bottom