Raised This Month: $51 Target: $400
 12% 

Zp Donate Ap Modification


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
NEXO.
Member
Join Date: May 2016
Location: Pakistan
Old 10-26-2020 , 19:10   Zp Donate Ap Modification
Reply With Quote #1

Hello guys, i want this zp donate ap to work like if someone donates ammo to someone it sends a hud message, i want this to client_print when someone donates to someone instead of hud like !g[ZP] ETC has donated etc ammo to etc person.

Thanks

Quote:
/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <amxmisc>
#include <zombieplague>

#define PLUGIN "[ZP] Donate Ammo Packs"
#define VERSION "1.0"
#define AUTHOR "r1laX , PomanoB"

new g_UserTotalAmmo[33]
new g_CvarAllowDonate
new SayText


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

g_CvarAllowDonate = register_cvar("zp_stats_allow_donate", "1")

register_clcmd("say", "handleSay")
register_clcmd("say_team", "handleSay")

register_event("HLTV", "RoundStart", "a", "1=0", "2=0")

SayText = get_user_msgid("SayText")

}

public RoundStart()
{
if (get_pcvar_num(g_CvarAllowDonate))
set_task(2.2, "MsgOnRoundStart")

}

public MsgOnRoundStart()
{
if(get_pcvar_num(g_CvarAllowDonate))
client_printcolor(0, "!g[ZP] !yTo donate others Ammo Packs, type !g/donate")

}

public handleSay(id)
{
new args[64]

read_args(args, charsmax(args))
remove_quotes(args)

new arg1[16]
new arg2[32]

strbreak(args, arg1, charsmax(arg1), arg2, charsmax(arg2))
if (get_pcvar_num(g_CvarAllowDonate) && equal(arg1,"/donate", 7))
donate(id, arg2)

}

public donate(id, arg[])
{
new to[32], count[10]
strbreak(arg, to, 31, count, 9)

if (!to[0] || !count[0])
{
client_printcolor(id, "!g[ZP] !yUsage: say /donate <name> <amount>")
return
}
new ammo_sender = zp_get_user_ammo_packs(id)
new ammo
if (equal(count, "all"))
ammo = ammo_sender
else
ammo = str_to_num(count)
if (ammo <= 0)
{
client_printcolor(id, "!g[ZP] !yWrong ammo quantity!")
return
}
ammo_sender -= ammo
if (ammo_sender < 0)
{
ammo+=ammo_sender
ammo_sender = 0

}
new reciever = cmd_target(id, to, (CMDTARGET_ALLOW_SELF))
if (!reciever || reciever == id)
{
client_printcolor(id, "!g[ZP] !yPlayer !g%s !yhas not been found on the server!", to)
return
}

zp_set_user_ammo_packs(reciever, zp_get_user_ammo_packs(reciever) + ammo)
g_UserTotalAmmo[reciever] += ammo
zp_set_user_ammo_packs(id, ammo_sender)
new aName[32], vName[32]

get_user_name(id, aName, 31)
get_user_name(reciever, vName, 31)

set_hudmessage(255, 0, 0, -1.0, 0.3, 0, 6.0, 6.0)
show_hudmessage(0, "%s donated %d Ammo Packs to %s!", aName, ammo, vName)

}

stock client_printcolor(const id, const input[], any:...)
{
new count = 1, players[32]
static msg[191]
vformat(msg, 190, input, 3)

replace_all(msg, 190, "!g", "^4") // Green Color
replace_all(msg, 190, "!y", "^1") // Default Color
replace_all(msg, 190, "!t", "^3") // Team Color

if (id) players[0] = id; else get_players(players, count, "ch")
{
for ( new i = 0; i < count; i++ )
{
if ( is_user_connected(players[i]) )
{
message_begin(MSG_ONE_UNRELIABLE, SayText, _, players[i])
write_byte(players[i]);
write_string(msg);
message_end();
}
}
}
}
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1033\\ f0\\ fs16 \n\\ par }
*/

Last edited by NEXO.; 10-26-2020 at 19:10.
NEXO. is offline
Mankled
Senior Member
Join Date: Oct 2019
Old 10-30-2020 , 01:10   Re: Zp Donate Ap Modification
Reply With Quote #2

PHP Code:
/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <amxmisc>
#include <zombieplague>

#define PLUGIN "[ZP] Donate Ammo Packs"
#define VERSION "1.0"
#define AUTHOR "r1laX , PomanoB"

new g_UserTotalAmmo[33]
new 
g_CvarAllowDonate
new SayText


public plugin_init() {
register_plugin(PLUGINVERSIONAUTHOR)

g_CvarAllowDonate register_cvar("zp_stats_allow_donate""1")

register_clcmd("say""handleSay")
register_clcmd("say_team""handleSay")

register_event("HLTV""RoundStart""a""1=0""2=0")

SayText get_user_msgid("SayText")

}

public 
RoundStart()
{
if (
get_pcvar_num(g_CvarAllowDonate))
set_task(2.2"MsgOnRoundStart")

}

public 
MsgOnRoundStart()
{
if(
get_pcvar_num(g_CvarAllowDonate))
client_printcolor(0"!g[ZP] !yTo donate others Ammo Packs, type !g/donate")

}

public 
handleSay(id)
{
new 
args[64]

read_args(argscharsmax(args))
remove_quotes(args)

new 
arg1[16]
new 
arg2[32]

strbreak(argsarg1charsmax(arg1), arg2charsmax(arg2))
if (
get_pcvar_num(g_CvarAllowDonate) && equal(arg1,"/donate"7))
donate(idarg2)

}

public 
donate(idarg[])
{
new 
to[32], count[10]
strbreak(argto31count9)

if (!
to[0] || !count[0])
{
client_printcolor(id"!g[ZP] !yUsage: say /donate <name> <amount>")
return
}
new 
ammo_sender zp_get_user_ammo_packs(id)
new 
ammo
if (equal(count"all"))
ammo ammo_sender
else
ammo str_to_num(count)
if (
ammo <= 0)
{
client_printcolor(id"!g[ZP] !yWrong ammo quantity!")
return
}
ammo_sender -= ammo
if (ammo_sender 0)
{
ammo+=ammo_sender
ammo_sender 
0

}
new 
reciever cmd_target(idto, (CMDTARGET_ALLOW_SELF))
if (!
reciever || reciever == id)
{
client_printcolor(id"!g[ZP] !yPlayer !g%s !yhas not been found on the server!"to)
return
}

zp_set_user_ammo_packs(recieverzp_get_user_ammo_packs(reciever) + ammo)
g_UserTotalAmmo[reciever] += ammo
zp_set_user_ammo_packs
(idammo_sender)
new 
aName[32], vName[32]

get_user_name(idaName31)
get_user_name(recievervName31)

client_printcolor(0"!g[ZP] !y%s donated %d Ammo Packs to %s!"aNameammovName)

}

stock client_printcolor(const id, const input[], any:...)
{
new 
count 1players[32]
static 
msg[191]
vformat(msg190input3)

replace_all(msg190"!g""^4"// Green Color
replace_all(msg190"!y""^1"// Default Color
replace_all(msg190"!t""^3"// Team Color

if (idplayers[0] = id; else get_players(playerscount"ch")
{
for ( new 
0counti++ )
{
if ( 
is_user_connected(players[i]) )
{
message_begin(MSG_ONE_UNRELIABLESayText_players[i])
write_byte(players[i]);
write_string(msg);
message_end();
}
}
}


Last edited by Mankled; 10-30-2020 at 01:11.
Mankled is offline
Reply



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 21:55.


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