Raised This Month: $ Target: $400
 0% 

Solved [CS:GO] Plugin Crashing Server - Need help!


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
Di3Z1E
Member
Join Date: May 2018
Old 12-27-2018 , 14:30   [CS:GO] Plugin Crashing Server - Need help!
Reply With Quote #1

Hey,
I made a plugin that supposed to allow players to make a vote for Headshots only in-game.
Code compiled with 1 warning, but crashing the server...

disclaimer:
i'm not pro, just a dude who plays around and sometimes make tiny cool stuff

PHP Code:
#include <sourcemod>
#include <sdkhooks>
#include <colors_csgo>

public Plugin myinfo =
{
    
name "HS Mode Only Via Vote",
    
author "Di3Z1E",
    
description "Allowing the players to initiate a vote for Headshots Only.",
    
version "1.00",
    
url ""
};

bool votedone=false;
int countyes=0;
int countno=0;



public 
void OnPluginStart()
{
    
RegConsoleCmd("sm_hso"Command_HSonly"Start Vote For Head Shot Mode Only");
}

public 
Action Command_HSonly(int clientint args)
{
     
    
PrintToChat(client" \x10[המחתרת]\x01 Launched HS Mode Only Vote!")
    return 
Plugin_Handled;
}  

public 
Action votemenu(int clientint args)
{
    
char menuinfo[255];
    
Format(menuinfosizeof(menuinfo), "Activate Only Headshots mode?"client);
    
Menu hsonly = new Menu(votemenuhs);
    
hsonly.SetTitle(menuinfo);
    
    
Format(menuinfosizeof(menuinfo), "Yes"client);
    
hsonly.AddItem("yes"menuinfo);
    
    
Format(menuinfosizeof(menuinfo), "No"client);
    
hsonly.AddItem("no"menuinfo);
    
    
hsonly.ExitButton true;
    
hsonly.Display(clientMENU_TIME_FOREVER);
    return 
Plugin_Handled;
}


public 
int votemenuhs(Menu hsonlyMenuAction actionint clientint selection)
{
    
char info[32];
    
hsonly.GetItem(selectioninfosizeof(info));
    
    if (
strcmp(info"yes") == 0)
    {
        
countyes++;
    }
    
    else if (
strcmp(info"no") == 0)
    {
        
countno++;
    }
    else if (
action == MenuAction_End)
    {
        
delete hsonly;
    }
    
    if (
countyes>(countno+countyes)/2)
    {
        
ServerCommand("sm_rcon mp_damage_headshot_only 1");
        
votedone=true;
    }
    else if (
countno>(countno+countyes/2))
    {
        
ServerCommand("sm_rcon mp_damage_headshot_only 0");
        
votedone=true;
    }
}


public 
void OnMapStart()
{
    
votedone=false;
    
countno=0;
    
countyes=0;

edit:
set it to php instead of code

Last edited by Di3Z1E; 12-30-2018 at 07:22.
Di3Z1E 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 23:09.


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