Raised This Month: $442 Target: $400
 110% 

Issue Convert Cvar to argument


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
workes
Junior Member
Join Date: Mar 2020
Old 03-25-2020 , 09:47   Convert Cvar to argument
Reply With Quote #1

Let me start up by saying that I am a complete noob to sourcepawn, so go easy.
I have this code here:
PHP Code:
public OnPluginStart()
{
    
sm_flag CreateConVar("sm_flag""ADMFLAG_ROOT""Flag required to use guiveaway command");
    
GetConVarString(sm_flagzflagsizeof(zflag));
    
    
sm_giveaway_credits CreateConVar("sm_giveaway_credits""5000""Number of credits given.");
    
sm_minplayers CreateConVar("sm_minplayers""5""Minimum players required in the server for the giveaway to happen.");
    
sm_chattag CreateConVar("sm_chattag""[Giveaway]""Chat Tag that appears in front of everything this plugin says.");
    
RegAdminCmd("sm_giveaway"CreditArgumentCommandGiveawaysm_flag"Start giveaway"); //error 130: cannot coerce functions to values
    
AutoExecConfig(true"plugin.zsorteio");
    
LoadTranslations("zgiveaway.phrases");
}

public 
Action:CreditArgument(clientargs)
{
    if (
args 1)
    {
        
ReplyToCommand(client"[Giveaway] Usage: !giveaway <amount>")
        return 
Plugin_Handled;
    }
    
char arg[7];
    
GetCmdArg(1argsizeof(arg));
    
int creditAmount StringToInt(arg);
    
PrintToChat(client"[Giveaway] You are giving away %i."creditAmount);
    
sm_giveaway_credits.IntValue creditAmount;

The goal is to have a command called !giveaway <arg1> where arg1 is the amount of credits to be given away, im getting an error on line 31 "error 130: cannot coerce functions to values". Any ideas?
workes is offline
Silvers
AlliedModders Donor
Join Date: Aug 2010
Location: SpaceX
Old 03-25-2020 , 09:58   Re: Convert Cvar to argument
Reply With Quote #2

https://sm.alliedmods.net/new-api/console/RegAdminCmd

PHP Code:
void RegAdminCmd(const char[] cmdConCmd callbackint adminflags, const char[] description, const char[] groupint flags
The arguments are wrong.
__________________
Silvers is offline
workes
Junior Member
Join Date: Mar 2020
Old 03-25-2020 , 11:20   Re: Convert Cvar to argument
Reply With Quote #3

Alright, which one of the arguments are the arguments for the ingame command ?
workes is offline
Reply


Thread Tools
Display Modes

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 03:36.


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