Raised This Month: $32 Target: $400
 8% 

[SM] Exception reported: Client index 1000 is invalid (arg 4)


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Cruze
Veteran Member
Join Date: May 2017
Old 09-13-2018 , 08:13   [SM] Exception reported: Client index 1000 is invalid (arg 4)
Reply With Quote #1

PHP Code:
#include <sourcemod>
#include <csgo_colors>
#include <sdktools>
#include <store>

#pragma semicolon 1


ConVar gc_iMinPlayer;

ConVar gc_sTag;
char g_sTag[32];


public 
Plugin myinfo = {
    
name "zGiveaway",
    
author "Black Flash, fix by shanapu",
    
description "Giveaway plugin compatible with zephyrus store.",
    
version "2.1",
    
url "www.terra2.forumeiros.com"
}

public 
void OnPluginStart()
{
    
gc_iMinPlayer CreateConVar("sm_giveaway_minplayers""1""Minimum players required in the server for the giveaway.");

    
RegAdminCmd("sm_giveaway"CommandGiveawayCreditsADMFLAG_ROOT"Start store credits giveaway");
 
}

public 
void OnConfigsExecuted()
{
    
gc_sTag FindConVar("sm_store_chat_tag");
    
gc_sTag.GetString(g_sTagsizeof(g_sTag));
}

public 
Action CommandGiveawayCredits(int clientint args)
{
    if(!
IsValidClient(client) || !IsClientInGame(client))
    {
        return 
Plugin_Handled;
    }
    if(
args != 1)
    {
        
CReplyToCommand(client"%s Usage: \x04sm_giveaway \x02<amount>"g_sTag);
        return 
Plugin_Handled;
    }
    if(
GetClientCount() > gc_iMinPlayer.IntValue)
    {
        
char buffer[512];
        
GetCmdArg(1buffersizeof(buffer));
        
int gStoreCreds StringToInt(buffer);

        
int random GetRandomPlayer();
        if (
IsValidClient(random))
        {
            
Store_SetClientCredits(randomStore_GetClientCredits(random) + gStoreCreds);
        }
        
CPrintToChatAll("%s Player: {green}%L {default}won %L credits in the the giveaway!"g_sTagrandomgStoreCreds);
    }
    else
    {
        
CPrintToChat(client"%s To do a giveaway, the server must contain at least {green}%s {default}players."g_sTaggc_iMinPlayer.IntValue);
    }
    return 
Plugin_Handled;
}
    
stock int GetRandomPlayer()
{
    
int[] clients = new int[MaxClients];
    
int clientCount;

    for (
int i 1<= MaxClientsi++) if (IsValidClient(i))
    {
        if (
IsPlayerAlive(i))
        {
            
clients[clientCount++] = i;
        }
    }
    
    return (
clientCount == 0) ? -clients[GetRandomInt(0clientCount-1)];
}
bool IsValidClient(clientbool bAllowBots truebool bAllowDead true)
{
    if(!(
<= client <= MaxClients) || !IsClientInGame(client) || (!IsFakeClient(client) && !bAllowBots) || IsClientSourceTV(client) || IsClientReplay(client) || (!bAllowDead && !IsPlayerAlive(client)))
    {
        return 
false;
    }
    return 
true;

Help please
__________________
Taking paid private requests! Contact me
Cruze is offline
Cruze
Veteran Member
Join Date: May 2017
Old 09-13-2018 , 08:15   Re: [SM] Exception reported: Client index 1000 is invalid (arg 4)
Reply With Quote #2

Code:
L 09/13/2018 - 17:40:01: [SM] Exception reported: Client index 1000 is invalid (arg 4)
L 09/13/2018 - 17:40:01: [SM] Blaming: cgiveaway.smx
L 09/13/2018 - 17:40:01: [SM] Call stack trace:
L 09/13/2018 - 17:40:01: [SM]   [0] VFormat
L 09/13/2018 - 17:40:01: [SM]   [1] Line 128, C:\Users\Downloads\Sourcemod Latest\scripting\include\csgo_colors.inc::CPrintToChatAll
L 09/13/2018 - 17:40:01: [SM]   [2] Line 59, C:\Users\Downloads\Sourcemod Latest\scripting\cgiveaway.sp::CommandGiveawayCredits
__________________
Taking paid private requests! Contact me
Cruze is offline
Kailo
Senior Member
Join Date: Sep 2014
Location: Moscow, Russia
Old 09-13-2018 , 08:21   Re: [SM] Exception reported: Client index 1000 is invalid (arg 4)
Reply With Quote #3

Quote:
Originally Posted by Cruze View Post
Code:
L 09/13/2018 - 17:40:01: [SM] Exception reported: Client index 1000 is invalid (arg 4)
L 09/13/2018 - 17:40:01: [SM] Blaming: cgiveaway.smx
L 09/13/2018 - 17:40:01: [SM] Call stack trace:
L 09/13/2018 - 17:40:01: [SM]   [0] VFormat
L 09/13/2018 - 17:40:01: [SM]   [1] Line 128, C:\Users\Downloads\Sourcemod Latest\scripting\include\csgo_colors.inc::CPrintToChatAll
L 09/13/2018 - 17:40:01: [SM]   [2] Line 59, C:\Users\Downloads\Sourcemod Latest\scripting\cgiveaway.sp::CommandGiveawayCredits
Replace "won %L credits" to "won %i credits".
https://wiki.alliedmods.net/Format_C...mat_Specifiers
Kailo is offline
Cruze
Veteran Member
Join Date: May 2017
Old 09-13-2018 , 08:42   Re: [SM] Exception reported: Client index 1000 is invalid (arg 4)
Reply With Quote #4

Quote:
Originally Posted by Kailo View Post
Replace "won %L credits" to "won %i credits".
https://wiki.alliedmods.net/Format_C...mat_Specifiers
my bad, thanks!
__________________
Taking paid private requests! Contact me
Cruze 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 07:17.


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