Raised This Month: $ Target: $400
 0% 

Solved Block event/forward default procedure


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
cmndrfello
Junior Member
Join Date: Jan 2022
Old 01-06-2022 , 01:55   Block event/forward default procedure
Reply With Quote #1

Hello!
I've got another feature that I want to work on which blocks the player from switching teams, in a way that doesn't revert him to his old team, rather not switching him teams in the first place.

I found that in DoD, "PTeam" is an event that is called when the player tries to switch teams.

Is there a way to overwrite / block the default procedure of the event? So that a custom function that is registered on the event will block the team switch from happening?

PHP Code:
register_event("PTeam""dod_onswitchteams""""")

public 
dod_onswitchteams(id)
{
   if(
variable == desired_value)
   {
      
//In theory this will stop the event from proceeding and nothing will happen
      
return EVENT_BLOCKED
   
}
   
//If skipped, the event will continue and user will switch teams
   
return EVENT_CONTINUE

Could something like this be even possible with events? or could this be done with forwards? or with hamsandwich?
Because I've noticed that there are return types such as PLUGIN_HANDLED, PLUGIN_CONTINUE but I can't seem to get them to work. (At least with my past attempts) Though I feel like my problem could be solved with those returns values in someway

Last edited by cmndrfello; 01-06-2022 at 16:01.
cmndrfello 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 11:36.


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