Member
|
06-22-2019
, 14:20
[Error] Plugin time reward credits
|
#1
|
i have this plugin for 5 min played giving 15 credits ..
Code:
/* Plugin generated by AMXX-Studio */
#include <amxmodx>
//#include <CC_ColorChat>
//#include <fcs>
#define PLUGIN "FCS PlayedTime Reward"
#define VERSION "1.2.0" // 1.x.x noi verificari/imbunatatiri
#define TASK_pentru 06091993
enum Color
{
NORMAL = 1, // Culoarea care o are jucatorul setata in cvar-ul scr_concolor.
GREEN, // Culoare Verde.
TEAM_COLOR, // Culoare Rosu, Albastru, Gri.
GREY, // Culoarea Gri.
RED, // Culoarea Rosu.
BLUE, // Culoarea Albastru.
}
new TeamName[ ][ ] =
{
"",
"TERRORIST",
"CT",
"SPECTATOR"
}
//--| Furien Credits System .inc file
/*
* Returns a players credits
*
* @param client - The player index to get points of
*
* @return The credits client
*
*/
native fcs_get_user_credits(client);
/*
* Sets <credits> to client
*
* @param client - The player index to set points to
* @param credits - The amount of credits to set to client
*
* @return The credits of client
*
*/
native fcs_set_user_credits(client, credits);
/*
* Adds <credits> points to client
*
* @param client - The player index to add points to
* @param credits - The amount of credits to add to client
*
* @return The credits of client
*
*/
stock fcs_add_user_credits(client, credits)
{
return fcs_set_user_credits(client, fcs_get_user_credits(client) + credits);
}
/*
* Subtracts <credits> from client
*
* @param client - The player index to subtract points from
* @param credits - The amount of credits to substract from client
*
* @return The credits of client
*
*/
stock fcs_sub_user_credits(client, credits)
{
return fcs_set_user_credits(client, fcs_get_user_credits(client) - credits);
}
//--| End of Furien Credits System .inc file
new const g_szTag[ ] = "[Furien Credits]";
new g_iCvarPTREnable;
new g_iCvarPTRMinutes;
new g_iCvarPTRCredits;
new g_iUserTime[ 33 ];
public plugin_init( )
{
register_plugin( PLUGIN, VERSION, "Askhanar" );
g_iCvarPTREnable = register_cvar( "fcs_pentru_enable", "1" );
g_iCvarPTRMinutes = register_cvar( "fcs_pentru_minutes", "5" );
g_iCvarPTRCredits = register_cvar( "fcs_pentru_credits", "15" );
set_task( 1.0, "task_Time", TASK_pentru, _, _, "b", 0 );
// Add your code here...
}
public client_putinserver( id )
{
if( is_user_bot( id ) || is_user_hltv( id ) )
return PLUGIN_CONTINUE;
g_iUserTime[ id ] = 0;
return PLUGIN_CONTINUE;
}
public client_disconnect( id )
{
if( is_user_bot( id ) || is_user_hltv( id ) )
return PLUGIN_CONTINUE;
g_iUserTime[ id ] = 0;
return PLUGIN_CONTINUE;
}
public task_PTRFunction( )
{
if( get_pcvar_num( g_iCvarPTREnable ) != 1 )
return;
static iPlayers[ 32 ];
static iPlayersNum;
get_players( iPlayers, iPlayersNum, "ch" );
if( !iPlayersNum )
return;
static id, i;
for( i = 0; i < iPlayersNum; i++ )
{
id = iPlayers[ i ];
g_iUserTime[ id ]++;
new iTime;
iTime = get_pcvar_num( g_iCvarPTRMinutes ) ;
if( g_iUserTime[ id ] >= iTime * 60 )
{
g_iUserTime[ id ] -= iTime * 60;
new iCredits = get_pcvar_num( g_iCvarPTRCredits );
fcs_add_user_credits( id, iCredits );
ColorChat( id, RED, "^x04%s^x01 Ai primit^x03 %i^x01 credite pentru^x03 %i^x01 minute jucate!",
g_szTag, iCredits, iTime );
}
}
}
ColorChat( id, Color:iType, const msg[ ], { Float, Sql, Result, _}:... )
{
// Daca nu se afla nici un jucator pe server oprim TOT. Altfel dam de erori..
if( !get_playersnum( ) ) return;
new szMessage[ 256 ];
switch( iType )
{
// Culoarea care o are jucatorul setata in cvar-ul scr_concolor.
case NORMAL: szMessage[ 0 ] = 0x01;
// Culoare Verde.
case GREEN: szMessage[ 0 ] = 0x04;
// Alb, Rosu, Albastru.
default: szMessage[ 0 ] = 0x03;
}
vformat( szMessage[ 1 ], 251, msg, 4 );
// Ne asiguram ca mesajul nu este mai lung de 192 de caractere.Altfel pica server-ul.
szMessage[ 192 ] = '^0';
new iTeam, iColorChange, iPlayerIndex, MSG_Type;
if( id )
{
MSG_Type = MSG_ONE_UNRELIABLE;
iPlayerIndex = id;
}
else
{
iPlayerIndex = CC_FindPlayer( );
MSG_Type = MSG_ALL;
}
iTeam = get_user_team( iPlayerIndex );
iColorChange = CC_ColorSelection( iPlayerIndex, MSG_Type, iType);
CC_ShowColorMessage( iPlayerIndex, MSG_Type, szMessage );
if( iColorChange ) CC_Team_Info( iPlayerIndex, MSG_Type, TeamName[ iTeam ] );
}
CC_ShowColorMessage( id, const iType, const szMessage[ ] )
{
static bool:bSayTextUsed;
static iMsgSayText;
if( !bSayTextUsed )
{
iMsgSayText = get_user_msgid( "SayText" );
bSayTextUsed = true;
}
message_begin( iType, iMsgSayText, _, id );
write_byte( id )
write_string( szMessage );
message_end( );
}
CC_Team_Info( id, const iType, const szTeam[ ] )
{
static bool:bTeamInfoUsed;
static iMsgTeamInfo;
if( !bTeamInfoUsed )
{
iMsgTeamInfo = get_user_msgid( "TeamInfo" );
bTeamInfoUsed = true;
}
message_begin( iType, iMsgTeamInfo, _, id );
write_byte( id );
write_string( szTeam );
message_end( );
return 1;
}
CC_ColorSelection( id, const iType, Color:iColorType)
{
switch( iColorType )
{
case RED: return CC_Team_Info( id, iType, TeamName[ 1 ] );
case BLUE: return CC_Team_Info( id, iType, TeamName[ 2 ] );
case GREY: return CC_Team_Info( id, iType, TeamName[ 0 ] );
}
return 0;
}
CC_FindPlayer( )
{
new iMaxPlayers = get_maxplayers( );
for( new i = 1; i <= iMaxPlayers; i++ )
if( is_user_connected( i ) )
return i;
return -1;
}
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ ansicpg1252\\ deff0{\\ fonttbl{\\ f0\\ froman\\ fcharset0 Times New Roman;}}\n{\\ colortbl ;\\ red0\\ green0\\ blue0;}\n\\ viewkind4\\ uc1\\ pard\\ cf1\\ lang11274\\ f0\\ fs24 \n\\ par }
*/
Show my running , but no work...
I giving errors in logs
Code:
L 06/22/2019 - 20:59:23: Function is not present (function "task_Time") (plugin "TimeReward.amxx")
L 06/22/2019 - 20:59:23: [AMXX] Displaying debug trace (plugin "TimeReward.amxx", version "1.2.0")
L 06/22/2019 - 20:59:23: [AMXX] Run time error 10: native error (native "set_task")
..Thank you in advance
|
|