ランキング
検索
詳細検索 Ctrl + K 検索を開く

FiveM投票プラグイン

Top-Gamesの投票システムをFiveMサーバーに簡単に統合し、プレイヤーにリアルタイムで報酬を提供します。

FiveM対応
リアルタイム
フレームワーク対応

インストール

1
プラグインのダウンロード

私たちのGitHubリポジトリからプラグインの最新版をダウンロードします。

v3をダウンロード
2
resourcesフォルダにコピー

cfx-vote-pluginフォルダの内容を展開し、サーバーのresources/voteディレクトリにコピーします。

resources/vote
3
トークンの取得

Top-Gamesパネルからトークンを取得します。

4
server.cfgの設定

server.cfgファイルに以下の行を追加します:

ensure vote
set vote_token "YOUR_TOKEN_HERE"
5
プラグインの有効化

Top-Gamesパネルで「Vote Plugin v3」を有効にします。「接続性テスト」をクリックしてプラグインをテストし、投票をシミュレートできます。

設定と使用方法

投票イベント

プレイヤーがサーバーに投票すると、プラグインが自動的にonPlayerVoteイベントをトリガーします。

vote-handler.lua
-- 基本的な使用例
AddEventHandler('onPlayerVote', function(playername, date)
    print('新しい投票を受け取りました!')
    print('プレイヤー: ' .. playername)
    print('日付: ' .. date)
    
    -- ここに報酬ロジックを追加してください
end)
Example with QBCore Framework
vote-rewards-qbcore.lua
-- Example with QBCore Framework
local QBCore = exports['qb-core']:GetCoreObject()

AddEventHandler('onPlayerVote', function(playerId, date)
    local Player = QBCore.Functions.GetPlayerByCitizenId(playerId)
    
    if Player then
        -- マネー報酬
        Player.Functions.AddMoney('cash', 1000, "vote-reward")
        
        -- Item reward
        Player.Functions.AddItem('lockpick', 5, false, "vote-reward")
        
        -- プレイヤー通知
        TriggerClientEvent('QBCore:Notify', Player.PlayerData.source, '投票ありがとうございます!+$1000', 'success', 8000)
        
        -- グローバルメッセージ
        TriggerClientEvent('chat:addMessage', -1, {
            color = {255, 194, 14},
            multiline = true,
            args = {"[VOTE]", Player.PlayerData.charinfo.firstname .. " " .. Player.PlayerData.charinfo.lastname .. " がサーバーに投票しました!"}
        })
    else
        -- Offline player handling
        print("Player " .. playerId .. " not found (offline?)")
    end
end)
Example with Qbox Framework
vote-rewards-qbox.lua
-- Example with Qbox Framework
AddEventHandler('onPlayerVote', function(playerId, date)
    local player = exports.qbx_core:GetPlayer(playerId)
    
    if player then
        -- マネー報酬
        player.Functions.AddMoney('cash', 1000, "vote-reward")
        
        -- Item reward
        exports.ox_inventory:AddItem(player.PlayerData.source, 'lockpick', 5)
        
        -- プレイヤー通知
        exports.qbx_core:Notify(player.PlayerData.source, '投票ありがとうございます!+$1000', 'success', 8000)
        
        -- グローバルメッセージ
        TriggerClientEvent('chat:addMessage', -1, {
            color = {0, 162, 255},,
            multiline = true,
            args = {"[VOTE]", player.PlayerData.charinfo.firstname .. " " .. player.PlayerData.charinfo.lastname .. " がサーバーに投票しました!"}
        })
    else
        -- Offline player handling
        print("Player " .. playerId .. " not found (offline?)")
    end
end)

トラブルシューティング

  • フォルダがresources/に正しく配置されているか確認してください
  • server.cfgensure voteの行があるか確認してください
  • サーバーを完全に再起動してください

  • server.cfgのトークンが正しいか確認してください
  • Top-Gamesパネルで「Vote Plugin v3」を有効にしてください
  • サーバーがインターネットからアクセス可能か確認してください

  • AddEventHandlerの構文を確認してください
  • ハンドラーを含むスクリプトが正しく読み込まれているか確認してください
  • デバッグに簡単なprint()でテストしてください
情報
バージョン: v3(最新)
互換性: FiveM
フレームワーク: ESX, QBCore, Qbox
ライセンス: オープンソース
サポート

お困りですか?私たちのチームがサポートいたします。