Raised This Month: $ Target: $400
 0% 

Argument Mismatch + Invalid Expression


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
Cyb3rH4Xter
Senior Member
Join Date: May 2009
Location: Sweden
Old 04-14-2011 , 11:28   Argument Mismatch + Invalid Expression
Reply With Quote #1

I have edited a plugin that enables RTV for another plugin, but now I am getting a few errors when compiling this code:

Code:
/*
 *    RockTheVote for Polymorph
 *    Requires Polymorph v0.8.2 or later
 *
 */

#include <amxmodx>
#include <amxmisc>
// #include <polymorph>

native polyn_votemod()

new bool:g_rockedVote[33], g_rockedVoteCnt
new bool:g_hasbeenrocked = false
new RoundCount;

// Cvars
new cvar_rtv_enabled
new cvar_rtv_ratio
new cvar_rtv_show

public plugin_init()
{
    register_plugin("Polymorph: RockTheVote", "1.0", "Fysiks")
    
    register_clcmd("amx_rtv","cmdAdminRTV", ADMIN_MAP, " Manually RockTheVote")
    register_clcmd("admin_rtv","cmdAdminRTV", ADMIN_MAP, " Manually RockTheVote")
    register_clcmd("say rtv", "cmdSayRTV")
    register_clcmd("say rockthevote", "cmdSayRTV")
    
    register_logevent("logevent_RoundStart", 2, "1=Round_Start");
    
    // Cvars
    cvar_rtv_enabled = register_cvar("rtv_enable", "1")    // <0|1>
    cvar_rtv_ratio = register_cvar("rtv_ratio", "0.51")        // Use amx_votemap_ratio?
    cvar_rtv_show = register_cvar("rtv_show", "1")        // Display how many more votes needed to rtv
}

public logevent_RoundStart() {
    RoundCount++;
}

public cmdAdminRTV(id, level, cid)
{
    if(!cmd_access(id,level,cid,1))
        return PLUGIN_HANDLED
    
    if(g_hasbeenrocked)
    {
        client_print(id,print_console,"[RTV] Vote has already been rocked")
    }
    else
    {
        g_hasbeenrocked = true
        new admin_name[32]
        get_user_name(id, admin_name, 31)
        show_activity(id, admin_name, "has RockedTheVote")
        client_print(id,print_console, "[RTV] You have RockedTheVote")
        set_task(3.5,"announce_vote")
        set_task(5.0,"startRockVote")
    }
    // Add functionality to cancel rocked vote.
    return PLUGIN_HANDLED
}

public client_connect(id)
{
    g_rockedVote[id] = false
}

public client_disconnect(id)
{
    if(g_rockedVote[id])
    {
        g_rockedVote[id] = false
        g_rockedVoteCnt--
    }
}

public cmdSayRTV(id)
{
    if(!get_pcvar_num(cvar_rtv_enabled))
        return PLUGIN_CONTINUE // PLUGIN_HANDLED
    
    if(g_hasbeenrocked)
    {
        client_print(id, print_chat, "[RTV] Vote has already been Rocked.")
        return PLUGIN_HANDLED
    }
    
    if(g_rockedVote[id])
    {
        client_print(id, print_chat, "[RTV] You already voted.")
        rtv_remind()
        return PLUGIN_CONTINUE  // PLUGIN_HANDLED for blind?
    }
    
    if( get_pcvar_float("mp_timelimit") != 0 )
    {
        if(get_timeleft() < 240 ) // don't allow rtv 4 minutes before map ends
        {
            client_print(id, print_chat, "[RTV] Too Late to RockTheVote.")
            return PLUGIN_HANDLED
        }
    }
    else if( get_pcvar_float("mp_maxrounds") != 0 )
    {
        new Float:roundsLeft = get_pcvar_float("mp_maxrounds") - RoundCount
        
        if( roundsLeft <= 4) ) // don't allow rtv 4 rounds before map ends
        {
            client_print(id, print_chat, "[RTV] Too Late to RockTheVote.")
            return PLUGIN_HANDLED
        }
    }
    
    // You (id) just voted to rock.
    g_rockedVote[id] = true
    g_rockedVoteCnt++
    client_print(id,print_chat, "[RTV] You chose to RockTheVote")
    
    if( g_rockedVoteCnt >= get_RocksNeeded() )     // Decide if we rock the vote
    {
        g_hasbeenrocked = true
        client_print(0,print_chat, "[RTV] The Vote has been Rocked!")
        set_task(3.5,"announce_vote")
        set_task(5.0,"startRockVote")
    }
    else
    {
        rtv_remind()
    }
    
    return PLUGIN_CONTINUE
}

public startRockVote()
{
    polyn_votemod()
}

get_RocksNeeded()
{
    return floatround(get_pcvar_float(cvar_rtv_ratio) * float(get_realplayersnum()), floatround_ceil);
}

stock get_realplayersnum()
{
    new players[32], playerCnt;
    get_players(players, playerCnt, "ch");
    
    return playerCnt;
}

rtv_remind()
{
    if(get_pcvar_num(cvar_rtv_show))
    {  // Not tested yet.
        client_print(0,print_chat, "[RTV] Need %d more players to RockTheVote.", get_RocksNeeded() - g_rockedVoteCnt)
    }
}

public announce_vote()
{
    client_cmd(0, "spk buttons/blip2")  // Moved here from startRockVote to give heads up
}
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ ansicpg1252\\ deff0\\ deflang1053{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ f0\\ fs16 \n\\ par }
*/
The errors are on line 98, 106, 108, 110.
Would be awesome if somebody told me whats wrong. Am a newbie pawn coder, normally a C# coder
Cyb3rH4Xter 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 19:53.


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