Raised This Month: $ Target: $400
 0% 

Eror plugin


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
narutopgm
Member
Join Date: Sep 2006
Old 11-01-2008 , 11:03   Eror plugin
Reply With Quote #1

Hello my plugin have got error plz help me =)
(original plugin is smcash)
PHP Code:
#include <sourcemod>
#pragma semicolon 1
#define PLUGIN_VERSION "1.2"
#define YELLOW 0x01
#define GREEN 0x04

public Plugin:myinfo 
{
    
name "16k_round",
    
author "Lowmach1ne",
    
description "16k a chaque round",
    
version PLUGIN_VERSION,
    
url "http://www.eSport-ReVolution.eu"
};

new 
g_iAccount = -1;

public 
OnPluginStart()
{
    
g_iAccount FindSendPropOffs("CCSPlayer""m_iAccount");

    if (
g_iAccount == -1)
    {
        
PrintToServer("[16k_round] - Unable to start, cannot find necessary send prop offsets.");
        return;
    }


    
CreateConVar("sm_16k_version"PLUGIN_VERSION"16k_round Version"FCVAR_PLUGIN|FCVAR_SPONLY|FCVAR_REPLICATED|FCVAR_NOTIFY);
    
    
RegAdminCmd("sm_cash"Command_SmCashADMFLAG_CUSTOM1"sm_cash <name or #userid or all/t/ct> <amount> - Set target's cash to amount.");
    
HookEventEx("player_team"PlayerTeamEventEventHookMode_Post);
    
HookEvent("round_start",RoundStartEventEventHookMode_Post);
}
public 
Action:PlayerTeamEvent(Handle:event, const String:name[], bool:dontBroadcast)
{
 new 
client GetClientOfUserId(GetEventInt(event"userid"));
 if(
IsClientInGame(client))
 {
  
PrintToChat(client,"%c[16k_round]%c Give 16k$ all rounds whis lowmach1ne's plugin.",GREEN,YELLOW);
 }
 return 
Plugin_Continue;
}  
public 
Action:Command_SmCash(clientargs)
{
    if (
args 2)
    {
        
ReplyToCommand(client"[SM] Usage: sm_cash <name or #userid or all/t/ct> <amount>");
        return 
Plugin_Handled;    
    }
    
    new 
String:szArg[65];
    
GetCmdArg(1szArgsizeof(szArg));

    new 
iAmount;
    
decl String:szAmount[64];
    
GetCmdArg(2szAmount64);
    
iAmount StringToInt(szAmount);
    
    if(
iAmount == && szAmount[0] != '0')
    {
        return 
Plugin_Handled;
    }
    
    if(
strcmp(szArg"all"false) == 0)
    {
        new 
iMaxClients GetMaxClients();
        
        for (new 
1<= iMaxClientsi++)
        {
                if (
IsClientInGame(i))
                    
SetMoney(iiAmount);
        }
        
    
    }
    else if(
strcmp(szArg"t"false) == || strcmp(szArg"ct"false) == 0)
    {
        new 
iMaxClients GetMaxClients();
        
        for (new 
1<= iMaxClientsi++)
        {
                if (
IsClientInGame(i))
                {
                    if(
GetClientTeam(i) == (strcmp(szArg"t"false) == 3))
                        
SetMoney(iiAmount);
                }
        }
        
            
    }
    else
    {
        new 
iClients[2];
        new 
iNumClients SearchForClients(szArgiClients2);
    
        if (
iNumClients == 0)
        {

            return 
Plugin_Handled;
        }
        else if (
iNumClients 1)
        {

            return 
Plugin_Handled;
        }
        else if (!
CanUserTarget(clientiClients[0]))
        {

            return 
Plugin_Handled;
        }
        
        
decl String:szName[64];
        
GetClientName(iClients[0], szName64);
        
        
SetMoney(iClients[0], iAmount);
        

    }
        
    return 
Plugin_Handled;
}

public 
SetMoney(clientamount)
{
    if (
g_iAccount != -1)
        
SetEntData(clientg_iAccountamount);
}

public 
GetMoney(client)
{
    if (
g_iAccount != -1)
        return 
GetEntData(clientg_iAccount);

    return 
0;
}
public 
RoundStartEvent(Handle:event,const String:name[],bool:dontBroadcast)
{
 
ServerCommand("sm_cash all 16000");

Eror is:
PHP Code:
L 11/01/2008 15:58:50: [SMNative "IsClientInGame" reportedClient index 0 is invalid
L 11
/01/2008 15:58:50: [SMDisplaying call stack trace for plugin "16k_round.smx":
L 11/01/2008 15:58:50: [SM]   [0]  Line 38, /home/groups/sourcemod/upload_tmp/textCx5N0u.sp::PlayerTeamEvent() 
narutopgm is offline
Lebson506th
Veteran Member
Join Date: Jul 2008
Old 11-01-2008 , 11:11   Re: Eror plugin
Reply With Quote #2

Just add client > 0 && before IsClientInGame

So it says
PHP Code:
if(client && IsClientInGame(client)) 
</span></span>
__________________
My Plugins
Spray Tracer by Nican, maintained by me
Simple TK Manager
DoD:S Admin Weapons

Links
Resistance and Liberation (A HL2 Multiplayer Modification)
Lebson506th is offline
narutopgm
Member
Join Date: Sep 2006
Old 11-01-2008 , 14:30   Re: Eror plugin
Reply With Quote #3

thc but it is for all or just a first ?
narutopgm is offline
Lebson506th
Veteran Member
Join Date: Jul 2008
Old 11-01-2008 , 14:35   Re: Eror plugin
Reply With Quote #4

Just the first one.

The 2nd and 3rd one are in a loop that starts at 1, so it will never be 0
__________________
My Plugins
Spray Tracer by Nican, maintained by me
Simple TK Manager
DoD:S Admin Weapons

Links
Resistance and Liberation (A HL2 Multiplayer Modification)
Lebson506th is offline
narutopgm
Member
Join Date: Sep 2006
Old 11-01-2008 , 14:41   Re: Eror plugin
Reply With Quote #5

oki thx
narutopgm 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 22:27.


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