Raised This Month: $ Target: $400
 0% 

A Question About "return PLUGIN_HANDLED" & "return PLUGIN_CONTINUE"


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
Jess98
Junior Member
Join Date: Apr 2018
Old 11-26-2018 , 08:58   A Question About "return PLUGIN_HANDLED" & "return PLUGIN_CONTINUE"
Reply With Quote #1

I'm in a logic error with those two ones..

I'll try to explain on my plugin..

This is my plugin, it spawns players when they write "/spawn" in say or say_team and if player has enough money for it.

Code:
#include <amxmodx>
#include <cstrike>

new gMoney

#define PLUGIN "Spawn Players With a Command"
#define VERSION "1.0"
#define AUTHOR "Jess"

#define SERVER_INFORMATION "Vengeance"

public plugin_init() {

       register_plugin(PLUGIN, VERSION, AUTHOR)

       register_clcmd("say /spawn", "Event_Spawn")
       register_clcmd("say_team /spawn", "Event_Spawn")

       gMoney = register_cvar("necessary_money", "10000")
}

public Event_Spawn(id) {

       if(is_user_alive(id))
       {
             client_print_color(id, id, "^04[%s]: ^3You Already Alive, You Can't Spawn Yourself", SERVER_INFORMATION)
             return PLUGIN_HANDLED
       }

       if(!is_user_alive(id))
       {
             if(cs_get_user_money(id) < get_pcvar_num(gMoney))
             { 
                   client_print_color(id, id, "^4[%s]: ^3You Don't Have Enough Money to Spawn Yourself", SERVER_INFORMATION)
                   return PLUGIN_HANDLED
             }
             else if(cs_get_user_money(id) >= get_pcvar_num(gMoney))
             {
                   cs_set_user_money(id, cs_get_user_money(id) - get_pcvar_num(gMoney))
                   cs_user_spawn(id)
                   client_print_color(id, id, "^4[%s]: ^3You Have Spawned Yourself!", SERVER_INFORMATION)
             }
       }
       return PLUGIN_HANDLED
}
---

I put the code "return PLUGIN_HANDLED" under this line as you see:

Code:
 
if(is_user_alive(id))
{
      client_print_color(id, id, "^04[%s]: ^3You Already Alive, You Can't Spawn Yourself", SERVER_INFORMATION)
      return PLUGIN_HANDLED
}
What does it do in there? Does it stop the task of this line, just that? What there happens if I write "return PLUGIN_CONTINUE" instead of it?

Or.. I put the same return code at the end of "Event_Spawn" Public. What also does it do in there, it stops the plugin when all tasks done, is it right? Can't be sure.
Jess98 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 07:35.


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