Raised This Month: $51 Target: $400
 12% 

[CSGO] Advanced AutoRespawn


Post New Thread Reply   
 
Thread Tools Display Modes
Author
B2SX
Member
Join Date: Dec 2015
Location: Israel
Plugin ID:
5995
Plugin Version:
Plugin Category:
General Purpose
Plugin Game:
Counter-Strike: GO
Plugin Dependencies:
    Servers with this Plugin:
     
    Plugin Description:
    Advanced AutoRespawn for CSGO
    Old 01-18-2018 , 11:05   [CSGO] Advanced AutoRespawn
    Reply With Quote #1

    Options:
    Player Voting by using the command: /votear
    Admin Vote for Enabling AutoRespawn
    Menual Usage
    Timer for Auto Disbaling
    Spawn Protection
    Pastebin Link:https://pastebin.com/W9HeRYZR
    Attached Files
    File Type: sp Get Plugin or Get Source (AdvancedAutoRespawn.sp - 993 views - 8.8 KB)
    __________________
    ◆ Developer - C++,C#,Python,VB.NET,Java,SQF,AS 3.0,AS 2.0,SP,Pawn,LUA
    Steam Link

    Last edited by B2SX; 01-18-2018 at 11:09.
    B2SX is offline
    xFlane
    AlliedModders Donor
    Join Date: Nov 2017
    Location: Israel
    Old 01-19-2018 , 05:06   Re: [CSGO] Advanced AutoRespawn
    Reply With Quote #2

    Code:
     
        char String1[128];
        Handle menu = CreateMenu(MenuHandelr);
        SetMenuTitle(menu, "[AutoRespawn] Main Menu");
    Every time you open a handle, you have to close it or it is a memory leak.

    Code:
    public int MenuHandelr(Menu menu, MenuAction action, int client, int itemNum)
    {
        if (action != MenuAction_Select || !IsClientConnected(client))
            return 1;
       
        switch (itemNum)
        {
    -------------->

    Code:
    public int MenuHandelr(Menu menu, MenuAction action, int client, int itemNum)
    {
    	if (action == MenuAction_End )
    	{
    		delete menu;
    	}
    	else if(action == MenuAction_Select)
    	{
    		switch (itemNum)
    		{
    There's no reason the player will be disconnected if he pressed the menu.

    And same for the vote menu, delete it in the callback.

    There's also another bugs i can see in the code, but make sure to test them.

    -
    Code:
    CreateTimer(float(sec), DisableAutoRespawn, client);
    Close the timer if someone changed the ar option, or it will keep timer handle for free.

    -
    Code:
    gi_ARVotesNeeded = RoundToFloor(float(gi_ARVoters) * 0.5);
    gi_ARVoters is always 0, so the needed votes amount will be always 0.

    -
    Code:
    if (gi_ARVotes >= gi_ARVotesNeeded)
    {
    EnableAutoRespawn();
    }
    If someone votes for ar before an ar was activated, the required votes number is always 0.

    -
    If player quits after he voted his vote will remain, also if player quits the game without voting and the votes before he left was 9/10 it should start.
    __________________
    Taking private requests.
    xFlane is offline
    B2SX
    Member
    Join Date: Dec 2015
    Location: Israel
    Old 01-19-2018 , 10:13   Re: [CSGO] Advanced AutoRespawn
    Reply With Quote #3

    Quote:
    Originally Posted by xFlane View Post
    Code:
     
        char String1[128];
        Handle menu = CreateMenu(MenuHandelr);
        SetMenuTitle(menu, "[AutoRespawn] Main Menu");
    Every time you open a handle, you have to close it or it is a memory leak.

    Code:
    public int MenuHandelr(Menu menu, MenuAction action, int client, int itemNum)
    {
        if (action != MenuAction_Select || !IsClientConnected(client))
            return 1;
       
        switch (itemNum)
        {
    -------------->

    Code:
    public int MenuHandelr(Menu menu, MenuAction action, int client, int itemNum)
    {
    	if (action == MenuAction_End )
    	{
    		delete menu;
    	}
    	else if(action == MenuAction_Select)
    	{
    		switch (itemNum)
    		{
    There's no reason the player will be disconnected if he pressed the menu.

    And same for the vote menu, delete it in the callback.

    There's also another bugs i can see in the code, but make sure to test them.

    -
    Code:
    CreateTimer(float(sec), DisableAutoRespawn, client);
    Close the timer if someone changed the ar option, or it will keep timer handle for free.

    -
    Code:
    gi_ARVotesNeeded = RoundToFloor(float(gi_ARVoters) * 0.5);
    gi_ARVoters is always 0, so the needed votes amount will be always 0.

    -
    Code:
    if (gi_ARVotes >= gi_ARVotesNeeded)
    {
    EnableAutoRespawn();
    }
    If someone votes for ar before an ar was activated, the required votes number is always 0.

    -
    If player quits after he voted his vote will remain, also if player quits the game without voting and the votes before he left was 9/10 it should start.
    thanks, gonna fix and upload a a new version
    __________________
    ◆ Developer - C++,C#,Python,VB.NET,Java,SQF,AS 3.0,AS 2.0,SP,Pawn,LUA
    Steam Link
    B2SX 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 15:05.


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