Cerere Modificare Plugin

Modificari necesare ale pluginurilor

Moderators: Moderatori ajutatori, Moderatori, Echipa eXtreamCS.com

Post Reply
BlueR12
Membru, skill 0
Membru, skill 0
Posts: 14
Joined: 24 Apr 2017, 19:29
Detinator Steam: Nu
CS Status: Citesc forumul eXtreamCS.com...!
Fond eXtream: 0
Contact:

03 May 2017, 16:29

Salut EXTREAM !

Am doua probleme

1. Am un plugin Zombi Plague 6.2

Si vreau sa se adauge un meniu puncte

Meniu Curent :

1. Buy Weapons
2. Buy Extra Items
3. Choose Zombie Class
4. Unstruck
5. Join Spectators
6. (Vreau sa se adauge Meniul cu puncte)
points_system.sma
/*

v1.0 - Relase
v2.0 - Added FVault
v3.0 - Added Admin Commands
v4.0 - Added Log Files with Cvar
v5.0 - Added Shop Menu
v6.0 - Added Colored Messages
v7.0 - Added Commas
v8.0 - Fixed Bug's
v8.1 - Fixed More Bugs
v8.2 - Modified Commands
v8.3 - Added MySql

*** By Remus Tucă a.k.a Legendary (IceCreamCandy) ***
*/

#include <amxmodx>
#include <amxmisc>
#include <nvault>
#include <fakemeta>
#include <hamsandwich>
#include <ColorChat>
#include <sqlx>
#include <zombieplague>

#define PLUGIN "ZP Points"
#define VERSION "8.3"
#define AUTHOR "Legendary"

#define is_user_valid_connected(%1) (1 <= %1 <= g_maxplayers && g_isconnected[%1])

#pragma tabsize 0

new Points[32]
new g_isconnected[33]
new g_playername[33][32]
new cvar_logcommands, save_type
new g_maxplayers, g_msgSayText, g_MsgSync, g_vault;
new mysqlx_host, mysqlx_user, mysqlx_db, mysqlx_pass;

new Handle:g_hTuple;

new bool:g_GodMode[33]
new bool:g_Damage[33]
new bool:g_Password[33]

new const szTables[][] =
{
"CREATE TABLE IF NOT EXISTS `mytable` ( `Points` varchar(32) NOT NULL, PRIMARY KEY (`player_id`) ) TYPE=MyISAM;"
}

public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR);

cvar_logcommands = register_cvar("zp_logpoints", "1")
save_type = register_cvar("zp_points_savetype","1"); // Save Points to: 1 = MySQL, 0 = NVault.

mysqlx_host = register_cvar ("zp_points_host", ""); // The host from the db
mysqlx_user = register_cvar ("zp_points_user", ""); // The username from the db login
mysqlx_pass = register_cvar ("zp_points_pass", ""); // The password from the db login
mysqlx_db = register_cvar ("zp_points_dbname", ""); // The database name

register_concmd("zp_points", "datpuncte", ADMIN_CVAR, " - <nume> <puncte>");
register_concmd("zp_take_points", "luatpuncte", ADMIN_CVAR, " - <nume> <puncte>");

register_clcmd("say /shop", "command_Buy");
register_clcmd("say shop", "command_Buy");
register_clcmd("INTRODUCETI_PAROLA", "points_sistem");

register_menucmd(register_menuid("Meniu"), 1023, "BuyMenu")

RegisterHam(Ham_Spawn, "player", "fw_PlayerSpawn_Post", 1)
RegisterHam(Ham_Killed, "player", "fw_PlayerKilled")
RegisterHam(Ham_TakeDamage, "player", "fw_TakeDamage")

g_msgSayText = get_user_msgid("SayText")
g_MsgSync = CreateHudSyncObj()
g_maxplayers = get_maxplayers()

g_vault = nvault_open( "Points System" );

if( g_vault == INVALID_HANDLE)
{
set_fail_state( "nValut returned invalid handle!" );
}

MySQLx_Init()
}

public plugin_natives()
{
register_native( "zp_get_user_points", "native_get_user_points", 1 )
register_native( "zp_set_user_points", "native_set_user_points", 1 )
}

public client_putinserver(id)
{
Points[id] = 0;
LoadData(id)
}

public client_disconnect(id)
{
if (g_GodMode[id]) g_GodMode[id] = false;
if (g_Damage[id]) g_Damage[id] = false;
if (g_Password[id]) g_Password[id] = false;

SaveData(id)
}

public fw_PlayerSpawn_Post(id)
{
if (g_GodMode[id])
{
g_GodMode[id] = false;
fm_set_user_godmode(id, 1);
}

if (g_Damage[id])
{
g_Damage[id] = false;
}
}

public fw_PlayerKilled(victim, attacker, shouldgib)
{
if (is_user_connected(victim) && g_Damage[victim]) g_Damage[victim] = false
}

public fw_TakeDamage(victim, inflictor, attacker, Float:damage, damage_type)
{
if (g_Damage[attacker])
{
damage *= 2.0;
SetHamParamFloat(4, damage);
}
}

public native_get_user_points(id)
{
return Points[id];
}

public native_set_user_points(id, points)
{
Points[id] += points;
}

public command_Buy(id)
{
new menuBody[2025];
add(menuBody, 2024, "\r| \wMeniu Cumparare \y(Puncte) \r|^n^n");

add(menuBody, 2024, "\r|1|\w God Mode \r(80 Puncte) \y[Runda Urmatoare]^n");
add(menuBody, 2024, "\r|2|\w Damage Dublu \r(40 Puncte) \y[Runda Urmatoare]^n");
add(menuBody, 2024, "\r|3|\w Cumpara \rSlot Rezervat \wpe Server \r(450 Puncte)^n");
add(menuBody, 2024, "\r|4|\w 100 Credite \r(50 Puncte)^n");
add(menuBody, 2024, "\r|5|\w 250 Credite \r(125 Puncte)^n");
add(menuBody, 2024, "\r|6|\w 500 Credite \r(250 Puncte)^n");
add(menuBody, 2024, "\r|7|\w 1,000 Credite \r(500 Puncte) \y[Nou]^n");
add(menuBody, 2024, "\r|8|\w 5,000 Credite \r(2,000 Puncte) \y[Nou]^n^n");
add(menuBody, 2024, "\r|0|\y Anulare^n");
show_menu(id, (1<<0 | 1<<1 | 1<<2 | 1<<3 | 1<<4 | 1<<5 | 1<<6 | 1<<7 | 1<<8 | 1<<9), menuBody, -1, "Meniu");
}

public BuyMenu(id, key)
{
new name[32];
get_user_name(id, name, 31);

switch(key)
{
case 0:
{
if (Points[id] >= 80)
{
g_GodMode[id] = true;
set_hudmessage(25, 10, 250, -1.0, 0.7, 1, 0.0, 5.0, 1.0, 1.0, -1)
ShowSyncHudMsg(0, g_MsgSync, "%s a cumparat God Mode!", name)
zp_colored_print(0, "^1[^4Points^1] ^4%s ^1a cumparat ^3God Mode^1.", name);
Points[id] -= 80
}
else
zp_colored_print(id, "^1[^4Points^1] Nu ai destule ^3Puncte^1! Iti trebuie^4 80 Puncte^1.");
}
case 1:
{
if (Points[id] >= 40)
{
g_Damage[id] = true;
set_hudmessage(25, 250, 10, -1.0, 0.7, 1, 0.0, 5.0, 1.0, 1.0, -1)
ShowSyncHudMsg(0, g_MsgSync, "%s a cumparat Damage Dublu!", name)
zp_colored_print(0, "^1[^4Points^1] ^4%s ^1a cumparat ^3Damage Dublu^1.", name);
Points[id] -= 40
}
else
zp_colored_print(id, "^1[^4Points^1] Nu ai destule ^3Puncte^1! Iti trebuie^4 40 Puncte^1.");
}
case 2:
{
if (Points[id] >= 450)
{
if (get_user_flags(id) & ADMIN_RESERVATION)
{
zp_colored_print(id, "^1[^4Points^1] ^3Tu ai deja, of of.");
return PLUGIN_HANDLED;
}
else
{
g_Password[id] = true;
client_cmd(id, "messagemode INTRODUCETI_PAROLA");
zp_colored_print(id, "^1[^4Points^1] Va rugam introduceti o parola si apasati ^4ENTER^1.");
zp_colored_print(id, "^1[^4Points^1] Va rugam introduceti o parola si apasati ^4ENTER^1.");
zp_colored_print(id, "^1[^4Points^1] Va rugam introduceti o parola si apasati ^4ENTER^1.");
zp_colored_print(id, "^1[^4Points^1] Va rugam introduceti o parola si apasati ^4ENTER^1.");
}
}
else
zp_colored_print(id, "^1[^4Points^1] Nu ai destule ^3Puncte^1! Iti trebuie^4 450 Puncte^1.");
}
case 3:
{
if (Points[id] >= 50)
{
zp_set_user_ammo_packs(id, 100)
zp_colored_print(0, "^1[^4Points^1] ^4%s ^1a cumparat^3 100 Credite^1.", name);
Points[id] -= 50
}
else
zp_colored_print(id, "^1[^4Points^1] Nu ai destule ^3Puncte^1! Iti trebuie^4 50 Puncte^1.");
}
case 4:
{
if (Points[id] >= 125)
{
zp_set_user_ammo_packs(id, 250)
zp_colored_print(0, "^1[^4Points^1] ^4%s ^1a cumparat^3 250 Credite^1.", name);
Points[id] -= 125
}
else
zp_colored_print(id, "^1[^4Points^1] Nu ai destule ^3Puncte^1! Iti trebuie^4 125 Puncte^1.");
}
case 5:
{
if (Points[id] >= 250)
{
zp_set_user_ammo_packs(id, 500)
zp_colored_print(0, "^1[^4Points^1] ^4%s ^1a cumparat^3 500 Credite^1.", name);
Points[id] -= 250
}
else
zp_colored_print(id, "^1[^4Points^1] Nu ai destule ^3Puncte^1! Iti trebuie^4 250 Puncte^1.");
}
case 6:
{
if (Points[id] >= 500)
{
zp_set_user_ammo_packs(id, 1000)
zp_colored_print(0, "^1[^4Points^1] ^4%s ^1a cumparat^3 1,000 Credite^1.", name);
Points[id] -= 500
}
else
zp_colored_print(id, "^1[^4Points^1] Nu ai destule ^3Puncte^1! Iti trebuie^4 500 Puncte^1.");
}
case 7:
{
if (Points[id] >= 2000)
{
zp_set_user_ammo_packs(id, 5000)
zp_colored_print(0, "^1[^4Points^1] ^4%s ^1a cumparat^3 5,000 Credite^1.", name);
Points[id] -= 2000
}
else
zp_colored_print(id, "^1[^4Points^1] Nu ai destule ^3Puncte^1! Iti trebuie^4 2,000 Puncte^1.");
}
default:
{
return PLUGIN_CONTINUE;
}
}
return PLUGIN_CONTINUE;
}

public points_sistem(id)
{
if (get_user_flags(id) & ADMIN_RESERVATION)
{
zp_colored_print(id, "^1[^4Points^1] ^3Tu ai deja, of of.")
return PLUGIN_HANDLED;
}

if(g_Password[id])
return PLUGIN_HANDLED;

new name[32];
get_user_name(id, name, 31);

new password[35];
read_args(password, 34);
remove_quotes(password);

Points[id] -= 450

g_Password[id] = false;

client_print(id, print_console, "[Points] Nick: %s | Parola: %s", name, password);
client_print(id, print_console, "[Points] Pentru a te conecta pe Server scrie in consola: setinfo _pw ^"%s^"", name, password);

set_hudmessage(175, 200, 0, -1.0, 0.7, 1, 0.0, 5.0, 1.0, 1.0, -1)
ShowSyncHudMsg(0, g_MsgSync, "%s a cumparat Slot Rezervat pe Server!", name)

zp_colored_print(0, "^1[^4Points^1] ^4%s ^1a cumparat ^3Slot Rezervat^1 pe Server.", name);
server_cmd("amx_addadmin ^"%s^" ^"b^" ^"%s^" ^"a^"", name, password);
server_cmd("amx_reloadadmins")

if (get_pcvar_num(cvar_logcommands))
{
log_to_file("Points.log", "%s a cumparat Slot. Parola este %s", name, password);
}

server_exec();
return PLUGIN_HANDLED;
}

public datpuncte(id, level, cid)
{
if (!cmd_access(id, level, cid, 2))
{
return PLUGIN_HANDLED
}

new arg[32]
read_argv(1, arg, 31)

new player = cmd_target(id, arg, CMDTARGET_ALLOW_SELF)

if (!player)
return PLUGIN_HANDLED

new spower[32], name2[32], name[32]

get_user_name(id, name, 31)
get_user_name(player, name2, 31)

read_argv(2, spower, 31)

new arg2 = str_to_num(spower)

if(arg2 < 0)
{
client_print(id, print_console, "[Zombie Legendary] Nu poti sa trimiti Numere Negative.");
ColorChat(id, RED, "^4[Zombie Legendary]^3 Nu poti sa trimiti ^4Numere Negative^3.")
return PLUGIN_HANDLED;
}

static PointsString[16];
AddCommas(arg2, PointsString, 15);

if(arg2 == 0)
{
if (player == id)
{
Points[id] = 0;
ColorChat(id, RED, "^4[Zombie Legendary]^3 Ti-ai setat ^4Punctele ^3pe^4 0^3.")
client_print(id, print_console, "[Zombie Legendary] Ti-ai setat Punctele pe 0.");

if(get_pcvar_num(cvar_logcommands))
{
log_to_file("ZombiePlagueLegendary.log", "Admin-ul %s si-a setat Punctele pe 0.", name);
}
}
else
{
Points[player] = 0;
ColorChat(id, RED, "^4[Zombie Legendary]^3 I-ai setat pe^4 0 ^3Punctele^3 lui ^4%s^3.", name2)
ColorChat(player, RED, "^4[Zombie Legendary]^3 Admin-ul ^4%s ^3ti-a setat ^4Punctele ^3pe^4 0^3.", name)
client_print(id, print_console, "[Zombie Legendary] I-ai setat pe 0 Punctele lui %s.", name2);

if(get_pcvar_num(cvar_logcommands))
{
log_to_file("ZombiePlagueLegendary.log", "Admin-ul %s i-a setat pe 0 Punctele lui %s.", name, name2);
}
}
}
else
{
if (player == id)
{
Points[id] += arg2;
ColorChat(id, RED, "^4[Zombie Legendary]^3 Ti-ai bagat ^4%s Puncte^3.", PointsString)
client_print(id, print_console, "[Zombie Legendary] Ti-ai bagat %s Puncte.", PointsString);

if(get_pcvar_num(cvar_logcommands))
{
log_to_file("ZombiePlagueLegendary.log", "Admin-ul %s si-a bagat %s Puncte.", name, PointsString);
}
}
else
{
Points[player] += arg2;
ColorChat(id, RED, "^4[Zombie Legendary]^3 I-ai dat ^4%s Puncte^3 lui ^4%s^3.", PointsString, name2)
ColorChat(player, RED, "^4[Zombie Legendary]^3 Adminul ^4%s ^3ti-a dat ^4%s Puncte^3.", name, PointsString)
client_print(id, print_console, "[Zombie Legendary] I-ai dat %s Puncte lui %s.", PointsString, name2);

if(get_pcvar_num(cvar_logcommands))
{
log_to_file("ZombiePlagueLegendary.log", "Admin-ul %s i-a dat %s Puncte lui %s.", name, PointsString, name2);
}
}
}

SaveData(id)
return PLUGIN_HANDLED;
}

public luatpuncte(id, level, cid)
{
if (!cmd_access(id, level, cid, 2))
{
return PLUGIN_HANDLED
}

new arg[32]

read_argv(1, arg, 31)
new player = cmd_target(id, arg, CMDTARGET_ALLOW_SELF)

if (!player)
return PLUGIN_HANDLED

new spower[32], name2[32], name[32]

get_user_name(id, name, 31)
get_user_name(player, name2, 31)

read_argv(2, spower, 31)

new arg2 = str_to_num(spower)

if(Points[player] < arg2)
{
ColorChat(id, RED, "^4[Zombie Legendary]^3 Suma data depaseste numarul de ^4Puncte ^3ale ^4Jucatorului ^3(^4%d^3).", Points[player]);
client_print(player, print_console, "[Zombie Legendary] Suma data depaseste numarul de Puncte ale Jucatorului (%d).", Points[player]);
return PLUGIN_HANDLED;
}

if(arg2 <= 0)
{
client_print(id, print_console, "[Zombie Legendary] Nu poti sa iei mai putin de 1 Punct.");
ColorChat(id, RED, "^4[Zombie Legendary]^3 Nu poti sa iei mai putin de^4 1 Punct^3.")
return PLUGIN_HANDLED;
}

static PointsString[16];
AddCommas(arg2, PointsString, 15);

if (player == id)
{
Points[id] -= arg2
ColorChat(id, RED, "^4[Zombie Legendary]^3 Ti-ai luat ^4%s Puncte^3.", PointsString)
client_print(id, print_console, "[Zombie Legendary] Ti-ai luat %s Puncte.", PointsString);

if (get_pcvar_num(cvar_logcommands))
{
log_to_file("ZombiePlagueLegendary.log", "Admin-ul %s si-a luat %s Puncte.", name, PointsString);
}
}
else
{
Points[player] -= arg2
ColorChat(id, RED, "^4[Zombie Legendary]^3 I-ai luat ^4%s Puncte^3 lui ^4%s^3.", PointsString, name2)
ColorChat(player, RED, "^4[Zombie Legendary]^3 Adminul ^4%s ^3ti-a luat ^4%s Puncte^3.", name, PointsString)
client_print(id, print_console, "[Zombie Legendary] I-ai luat %s Puncte lui %s.", PointsString, name2);

if (get_pcvar_num(cvar_logcommands))
{
log_to_file("ZombiePlagueLegendary.log", "Admin-ul %s i-a luat %s Puncte lui %s.", name, PointsString, name2);
}
}

SaveData(id)
return PLUGIN_HANDLED;
}

stock fm_set_user_godmode(index, godmode = 0) {
set_pev(index, pev_takedamage, godmode == 1 ? DAMAGE_NO : DAMAGE_AIM);

return 1;
}

public MySQLx_Init()
{
if ( !get_pcvar_num(save_type) )
return;

new szHost[64], szUser[32], szPass[32], szDB[128];

get_pcvar_string( mysqlx_host, szHost, charsmax( szHost ) );
get_pcvar_string( mysqlx_user, szUser, charsmax( szUser ) );
get_pcvar_string( mysqlx_pass, szPass, charsmax( szPass ) );
get_pcvar_string( mysqlx_db, szDB, charsmax( szDB ) );

g_hTuple = SQL_MakeDbTuple( szHost, szUser, szPass, szDB );

for ( new i = 0; i < sizeof szTables; i++ )
{
SQL_ThreadQuery( g_hTuple, "QueryCreateTable", szTables)
}
}

public QueryCreateTable( iFailState, Handle:hQuery, szError[ ], iError, iData[ ], iDataSize, Float:fQueueTime )
{
if( iFailState == TQUERY_CONNECT_FAILED
|| iFailState == TQUERY_QUERY_FAILED )
{
log_amx( "%s", szError );

return;
}
}

SaveData(id)
{
new szAuth[33];
get_user_authid( id , szAuth , charsmax(szAuth) );

if(!get_pcvar_num(save_type))
{
static Nume[32], Date[32];

format(Nume, 31, "__%s__", g_playername[id])
format(Date, 31, "%i", Points[id])

nvault_set(g_vault, Nume, Date)
}
else
{
static szQuery[ 128 ];

formatex( szQuery, 127, "REPLACE INTO `mytable` ('Points') VALUES ('%s', '%d');", szAuth , Points[id] );

SQL_ThreadQuery( g_hTuple, "QuerySetData", szQuery);
}
}

LoadData(id)
{
new szAuth[33];
get_user_authid( id , szAuth , charsmax(szAuth) );

if(!get_pcvar_num(save_type))
{
static Nume[32], Date[32];

format(Nume, 31, "__%s__", g_playername[id])
format(Date, 31, "%i", Points[id])

nvault_get(g_vault, Nume, Date, 31)

Points[id] = str_to_num(Date)
}
else
{
static szQuery[ 128 ], iData[ 1 ];
formatex( szQuery, 127, "SELECT `Points` FROM `mytable` WHERE ( `player_id` = '%s' );", szAuth );

iData[ 0 ] = id;
SQL_ThreadQuery( g_hTuple, "QuerySelectData", szQuery, iData, 1 );
}
}

public QuerySelectData( iFailState, Handle:hQuery, szError[ ], iError, iData[ ], iDataSize, Float:fQueueTime )
{
if( iFailState == TQUERY_CONNECT_FAILED
|| iFailState == TQUERY_QUERY_FAILED )
{
log_amx( "%s", szError );

return;
}
else
{
new id = iData[ 0 ];

new ColPoints = SQL_FieldNameToNum(hQuery, "Points")

while (SQL_MoreResults(hQuery))
{
Points[id] = SQL_ReadResult(hQuery, ColPoints);

SQL_NextRow(hQuery)
}
}
}
public QuerySetData( iFailState, Handle:hQuery, szError[ ], iError, iData[ ], iDataSize, Float:fQueueTime )
{
if( iFailState == TQUERY_CONNECT_FAILED
|| iFailState == TQUERY_QUERY_FAILED )
{
log_amx( "%s", szError );

return;
}
}

AddCommas( iNum , szOutput[] , iLen )
{
static szTmp[15] ,iOutputPos, iNumPos, iNumLen

szTmp[0]='^0',iOutputPos=iNumPos=iNumLen=0

if ( iNum < 0 )
{
szOutput[ iOutputPos++ ] = '-'
iNum = abs( iNum )
}
iNumLen = num_to_str(iNum, szTmp, charsmax(szTmp))

if ( iNumLen <= 3 )
{
iOutputPos += copy( szOutput[ iOutputPos ] , iLen , szTmp )
}
else
{
while ( ( iNumPos < iNumLen ) && ( iOutputPos < iLen ) )
{
szOutput[ iOutputPos++ ] = szTmp[ iNumPos++ ]

if( ( iNumLen - iNumPos ) && !( ( iNumLen - iNumPos ) % 3 ) )
{
szOutput[ iOutputPos++ ] = ','
}
}
szOutput[ iOutputPos ] = EOS
}
return iOutputPos
}

zp_colored_print(target, const message[], any:...)
{
static buffer[512], i, argscount
argscount = numargs()

if (!target)
{
static player
for (player = 1; player <= g_maxplayers; player++)
{
if (!g_isconnected[player])
continue;

static changed[5], changedcount
changedcount = 0

for (i = 2; i < argscount; i++)
{
if (getarg(i) == LANG_PLAYER)
{
setarg(i, 0, player)
changed[changedcount] = i
changedcount++
}
}

vformat(buffer, charsmax(buffer), message, 3)
message_begin(MSG_ONE_UNRELIABLE, g_msgSayText, _, player)
write_byte(player)
write_string(buffer)
message_end()

for (i = 0; i < changedcount; i++)
setarg(changed, 0, LANG_PLAYER)
}
}
else
{
vformat(buffer, charsmax(buffer), message, 3)
message_begin(MSG_ONE, g_msgSayText, _, target)
write_byte(target)
write_string(buffer)
message_end()
}
}


2. Vreau sa arata cate puncte ai
Exemplu :
Am cam asa pe server (Healt , Ammo Packs , Armor ,(Aici vreau sa arata „Points”)

Uitai si zombie plague 6.2

http://www.girlshare.ro/3489822961.9

Multumesc anticipat !

Si daca se poate,sa se salveze in nvault..
Last edited by Truth* on 16 May 2017, 22:50, edited 1 time in total.
Reason: Mutat in sectiunea corespunzatoare.
RoyalServer
BlueR12
Membru, skill 0
Membru, skill 0
Posts: 14
Joined: 24 Apr 2017, 19:29
Detinator Steam: Nu
CS Status: Citesc forumul eXtreamCS.com...!
Fond eXtream: 0
Contact:

06 May 2017, 11:30

Cineva ???
User avatar
Legendary.
Membru, skill 0
Membru, skill 0
Posts: 22
Joined: 24 Dec 2016, 14:39
Detinator Steam: Da
SteamID: 76561198294003783
Fond eXtream: 0
Location: Bermudes Triangle
Contact:

03 Aug 2017, 01:03

Asta e pluginul meu, morr :))
@MzQ*

Mai multe informatii aici: https://www.freakz.ro/forum/PLUGIN-ZP-P ... 36343.html
Post Reply

Return to “Modificari pluginuri”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 5 guests