Raised This Month: $ Target: $400
 0% 

Question about Natives


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Whitez
Member
Join Date: Apr 2016
Location: London, UK
Old 05-29-2016 , 15:27   Re: Question about Natives
Reply With Quote #7

So we have the following

Spoiler


I want to add an optional, not mandatory third parameter to the forwards and the native, so i can use the third parameter in the infection bomb to tell in the rewards plugin that the infection was done with the bomb, and to not display the message

Example

Infection Grenade Plugin
PHP Code:


public grenade_explode(ent)
{
// Get attacker
    
new attacker pev(entpev_owner)
    
    
// Infection bomb owner disconnected or not zombie anymore?
    
if (!is_user_connected(attacker) || !zp_core_is_zombie(attacker))
    {
        
// Get rid of the grenade
        
engfunc(EngFunc_RemoveEntityent)
        return;
    }
    
    
// Collisions
    
new victim = -1
    
    
while ((victim engfunc(EngFunc_FindEntityInSpherevictimoriginNADE_EXPLOSION_RADIUS)) != 0)
    {
        
// Only effect alive humans
        
if (!is_user_alive(victim) || zp_core_is_zombie(victim))
            continue;
        
        
// Last human is killed
        
if (zp_core_get_human_count() == 1)
        {
            
ExecuteHamB(Ham_Killedvictimattacker0)
            continue;
        }
        
        
// Turn into zombie
        
zp_core_infect(victimattacker1)
    }

Rewards plugin
PHP Code:

public zp_fw_core_infect_post(victimattackercondition)
{
          if(
condition 1) return

         
// display a message to attacker

Along with this, i want to be able to call the native and like this, in case i don't want to send the extra param -> zp_core_infect(victim, attacker)

Last edited by Whitez; 05-29-2016 at 15:32.
Whitez is offline
 



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 18:36.


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