AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   someone can help me??i'am noob..(about native) (https://forums.alliedmods.net/showthread.php?t=76678)

etet 08-28-2008 13:55

someone can help me??i'am noob..(about native)
 
i wanna to know how can i add native work on this mod and can finish compile.

i don't know this 2 line code~
where i should put in??

Code:

native ryu_get_money(id)
native ryu_set_money(id, iMoney, iFlash)

this is a native~

that all,sorry for my poor english thx very mush: )


Code:

/**
 * teambets.sma
 * Adds team betting. After dying, a player can bet on which team will win.
 * Ported from SM to AMXX by Teyut.
 */
#include <amxmodx>
#include <cstrike>
#pragma semicolon 1
#define PLUGIN_NAME    "Team Bets"
#define PLUGIN_VERSION "1.4"
#define PLUGIN_AUTHOR  "ferret"
#define BET_AMOUNT 0
#define BET_WIN 1
#define BET_TEAM 2
/* TODO: stop using hard-coded max players count and use dynamic array instead. */
#define MAXPLAYERS 32
new g_bEnabled = false;
new g_iPlayerBetData[MAXPLAYERS + 1][3];
new bool:g_bPlayerBet[MAXPLAYERS + 1] = {false, ...};
new bool:g_bOneVsMany = false;
new g_iOneVsManyPot;
new g_iOneVsManyTeam;
new g_hAmxBet;
new g_hAmxBetDeadOnly;
new g_hAmxBetOneVsMany;
new g_hAmxBetAnnounce;
public plugin_init()
{
  register_plugin(PLUGIN_NAME, PLUGIN_VERSION, PLUGIN_AUTHOR);
 
  register_dictionary("teambets.txt");
  register_cvar("amx_teambets_version", PLUGIN_VERSION, FCVAR_SERVER|FCVAR_SPONLY); /*TeamBets Version*/
  register_clcmd("say", "Command_Say");
  register_clcmd("say_team", "Command_Say");
  g_hAmxBet = register_cvar("amx_bet", "1"); /*Enable team betting? (0 off, 1 on, def. 1)*/
  g_hAmxBetDeadOnly = register_cvar("amx_bet_deadonly", "1"); /*Only dead players can bet. (0 off, 1 on, def. 1)*/
  g_hAmxBetOneVsMany = register_cvar("amx_bet_onevsmany", "0");  /*The winner of a 1 vs X fight gets the losing pot (def. 0)*/
  g_hAmxBetAnnounce = register_cvar("amx_bet_announce", "0");  /*Announce 1 vs 1 situations (0 off, 1 on, def. 0)*/
  register_event("SendAudio", "Event_RoundEnd", "a", "2=%!MRAD_terwin", "2=%!MRAD_ctwin", "2=%!MRAD_rounddraw");
  register_event("DeathMsg", "Event_PlayerDeath", "a");
  set_task(1.0, "CheckConVar_AmxBet", _, _, _, "b");
  g_bEnabled = true;
  server_print("[itbet] - Loaded");
}
public CheckConVar_AmxBet()
{
  g_bEnabled = (get_pcvar_num(g_hAmxBet) == 1);
}
public Command_Say(client)
{
  if (!g_bEnabled)
    return PLUGIN_CONTINUE;
  new szText[192], iTextLen;
  read_args(szText, sizeof(szText) - 1);
  szText[sizeof(szText) - 1] = 0;
  iTextLen = strlen(szText);
  if(iTextLen < 2)
    return PLUGIN_CONTINUE;
  /* Strips trailling quote */
  szText[iTextLen - 1] = 0;
  new szVerb[16], szTeam[16], szAmount[16];
  parse(szText[1], szVerb, sizeof(szVerb) - 1, szTeam, sizeof(szTeam) - 1, szAmount, sizeof(szAmount) - 1);
  szVerb[sizeof(szVerb) - 1] = 0;
  szTeam[sizeof(szTeam) - 1] = 0;
  szAmount[sizeof(szAmount) - 1] = 0;
  if (strcmp(szVerb, "bet", 1) != 0)
    return PLUGIN_CONTINUE;
  if (g_bPlayerBet[client])


zwfgdlc 08-29-2008 00:05

Re: someone can help me??i'am noob..(about native)
 
Code:
/**  * teambets.sma  * Adds team betting. After dying, a player can bet on which team will win.  * Ported from SM to AMXX by Teyut.  */ #include <amxmodx> #include <cstrike> native ryu_get_money(id) native ryu_set_money(id, iMoney, iFlash) #pragma semicolon 1 #define PLUGIN_NAME    "Team Bets" #define PLUGIN_VERSION "1.4" #define PLUGIN_AUTHOR  "ferret" #define BET_AMOUNT 0 #define BET_WIN 1 #define BET_TEAM 2 /* TODO: stop using hard-coded max players count and use dynamic array instead. */ #define MAXPLAYERS 32 new g_bEnabled = false; new g_iPlayerBetData[MAXPLAYERS + 1][3]; new bool:g_bPlayerBet[MAXPLAYERS + 1] = {false, ...}; new bool:g_bOneVsMany = false; new g_iOneVsManyPot; new g_iOneVsManyTeam; new g_hAmxBet; new g_hAmxBetDeadOnly; new g_hAmxBetOneVsMany; new g_hAmxBetAnnounce; public plugin_init() {   register_plugin(PLUGIN_NAME, PLUGIN_VERSION, PLUGIN_AUTHOR);     register_dictionary("teambets.txt");   register_cvar("amx_teambets_version", PLUGIN_VERSION, FCVAR_SERVER|FCVAR_SPONLY); /*TeamBets Version*/   register_clcmd("say", "Command_Say");   register_clcmd("say_team", "Command_Say");   g_hAmxBet = register_cvar("amx_bet", "1"); /*Enable team betting? (0 off, 1 on, def. 1)*/   g_hAmxBetDeadOnly = register_cvar("amx_bet_deadonly", "1"); /*Only dead players can bet. (0 off, 1 on, def. 1)*/   g_hAmxBetOneVsMany = register_cvar("amx_bet_onevsmany", "0");  /*The winner of a 1 vs X fight gets the losing pot (def. 0)*/   g_hAmxBetAnnounce = register_cvar("amx_bet_announce", "0");  /*Announce 1 vs 1 situations (0 off, 1 on, def. 0)*/   register_event("SendAudio", "Event_RoundEnd", "a", "2=%!MRAD_terwin", "2=%!MRAD_ctwin", "2=%!MRAD_rounddraw");   register_event("DeathMsg", "Event_PlayerDeath", "a");   set_task(1.0, "CheckConVar_AmxBet", _, _, _, "b");   g_bEnabled = true;   server_print("[itbet] - Loaded"); }

Teyut 08-29-2008 15:04

Re: someone can help me??i'am noob..(about native)
 
1 Attachment(s)
See the attachments.

You also need to load the "Ryu MoneyX" plugin on your server if you want the native calls to work. I didn't find the source code for that plugin (probably because I can't read Chinese), but if it's not distributed, I wouldn't use it if I where you (there's probably an alternative open source plugin available on the AMXX board).

zwfgdlc 08-29-2008 15:19

Re: someone can help me??i'am noob..(about native)
 
2 Attachment(s)
Here is your plugin .

etet 08-30-2008 05:59

Re: someone can help me??i'am noob..(about native)
 
ok is work,thanks very mush sir!


All times are GMT -4. The time now is 03:09.

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