Day of Defeat Plugins Community
This site is an archive — everything is readable and downloadable, nothing can be posted. Admin
Archive › Old Forum Threads › Help › Scripting Help › Mega_slap (summin im working on but)
5 posts, 3 people · 808 views Thread Rating: ★★★★★
closedMega_slap (summin im working on but)
Started by blobby on 07-30-2008, 10:26 AM
blobby
started this thread
Posts: 421
Threads: 47
Joined: Apr 2007
07-30-2008, 10:26 AM #1

Hello allrnrnIts been a few months since i did any coding and tbh i forgot the best part of most of it havent got a very good memory any way can some kind person please look over my code below and see if they can spot what im doing wrong because all i seem to get is errors on the compile but it dosent say what line or anythingrnrnThanks for your time and helprnrnBlobbyrnrn

/////////////////////////////////////////////rn//AMX_MEGASLAP made by blobby////////////////rn/////////////////////////////////////////////rn//amx_megaslap <nick>////////////////////////rn/////////////////////////////////////////////rn//amx_megaslapaxis///////////////////////////rn/////////////////////////////////////////////rn//amx_megaslapallies/////////////////////////rn/////////////////////////////////////////////rn//amx_spower <default 90>////////////////////rn/////////////////////////////////////////////rnrn#define MsgTime 3.0rnrn#include <amxmodx>rn#include <amxmisc>rnrnnew bloodspray, blooddroprnpublic slapall(id) {rn   new SPower = get_cvar_num("sv_spower");rn   new plist[32],pnumrn   get_players(plist, pnum ,"a")rn   for(new i=0; i<pnum; i++)rn   user_slap(plist[i],SPower)rn   client_cmd(0,"spk misc/hoe.wav")rn   set_hudmessage( 255, 0, 0, -1.0, -1.0, 0, 6.0, MsgTime, 0.5, 1.5, 4 )rn   show_hudmessage(0, "WooHoo I Bitch Slap Yo Asses")rn   remove_task(id)rn}rnrnpublic plugin_precache(){rn   bloodspray = precache_model("sprites/bloodspray.spr")rn   blooddrop = precache_model("sprites/blood.spr")rn   precache_sound("misc/hoe.wav")rn   return PLUGIN_CONTINUErn} rnrnpublic myfunction(id,level,cid) {rn   if (!cmd_access(id,level,cid,1)) {rn      return PLUGIN_CONTINUErn   }rn   new arg[32]rn   new playerrn   read_argv(1,arg,32)rn   if(arg[0])  {rn   player = cmd_target(id,arg,0)rn   if(!player) return PLUGIN_HANDLEDrn   } else {rn   set_task(0.1,"slapall",id)rnrnrnrn   return PLUGIN_HANDLEDrn   }rn   new name[32]rn   new origin[3]rn   new SPower = get_cvar_num("sv_spower");rn   user_slap(player,SPower)rn   get_user_origin(player,origin)rn   client_cmd(player,"name hoe")rn   blood(origin)rn   set_hudmessage( 255, 0, 0, -1.0, -1.0, 0, 6.0, MsgTime, 0.5, 1.5, 4 )rn   show_hudmessage(player, "You have just been slapped %s", name)rn   new iweapons[32], wpname[32], inum rn   get_user_weapons(player,iweapons,inum) rn   for(new a=0;a<inum;++a){ rn    get_weaponname(iweapons[a],wpname,31) rn		engclient_cmd(player,"drop",wpname) rn	} rn	engclient_cmd(player,"weapon_knife") rnrnrn     rnrn        return PLUGIN_HANDLEDrn}rnrnpublic slap_allaxis() {           rn        new slapdmg = get_cvar_num("sv_slappower"); rn	new team[32], iTotalAXISs;rn	get_players(team,iTotalAXISs,"e", "AXIS");rn	for (new i = 0; i < iTotalAXISs; i++) rn	{		rn        new id = team[i]; rn        new origin[3]rn        user_slap(id,slapdmg);rn        get_user_origin(id,origin)rn        client_cmd(id,"name hoe")rn        blood(origin)rn    } rn        return PLUGIN_HANDLED; rn       }rnrnpublic AXIS_announcements() {rn	new Red = random(256) rn        new Green = random(256) rn        new Blue = random(256)rn        set_hudmessage(Red,Green,Blue,0.03, 0.62, 2, 0.02, 2.0, 0.01, 0.1, 1) rn        show_hudmessage(0, "All Axis Players Have Been Slapped!!!")rn        client_cmd(0,"spk barney/ba_tomb")rn        console_print(0,"All Axis players got beat down")rn        client_print(0,print_chat,"Axis just got beat down like a bunch of bitch's")rn        return PLUGIN_HANDLEDrn}rnrnpublic admin_slapAXIS(id,level,cid){rn	if (!cmd_access(id,level,cid,1)){rn		return PLUGIN_HANDLEDrn}rn        set_task(0.1, "slap_allaxis", 0, "", 0, "a"); rn        set_task(1.0, "AXIS_announcements", 0, "", 1, "a", 0)rn        return PLUGIN_HANDLEDrn } rnrnpublic slap_allallies() {           rn        new slapdmg = get_cvar_num("sv_spower"); rn	new team[32], iTotalALLIESs;rn	get_players(team,iTotalALLIESs,"e", "ALLIES");rn	for (new i = 0; i < iTotalALLIESs; i++) rn	{		rn        new id = team[i];rn        new origin[3]rn        user_slap(id,slapdmg);rn        get_user_origin(id,origin)rn        client_cmd(id,"name hoe")rn        blood(origin)rn       } rn        return PLUGIN_HANDLED; rn       }rnrnpublic ALLIES_announcements() {rn	new Red = random(256) rn        new Green = random(256) rn        new Blue = random(256)rn        set_hudmessage(Red,Green,Blue,0.03, 0.62, 2, 0.02, 2.0, 0.01, 0.1, 1) rn        show_hudmessage(0, "All Allies Players Have Been Pimp Slapped!!!")rn        client_cmd(0,"spk barney/ba_dontmake")rn        console_print(0,"All Allies players got beat down")rn        client_print(0,print_chat,"Allies just got beat down like a bunch of bitch's")rn        return PLUGIN_HANDLEDrn}rnrnpublic admin_slapALLIES(id,level,cid){rn	if (!cmd_access(id,level,cid,1)){rn		return PLUGIN_HANDLEDrn}rnrn    set_task(0.1, "slap_allallies", 0, "", 0, "a"); rn    set_task(1.0, "ALLIES_announcements", 0, "", 1, "a", 0)rn rn    return PLUGIN_HANDLEDrn}rnrnrnrnblood(vec1[3]) {rn   message_begin( MSG_BROADCAST,SVC_TEMPENTITY,vec1)rn   write_byte( 115 )rn   write_coord(vec1[0])rn   write_coord(vec1[1])rn   write_coord(vec1[2] +25)rn   write_short( bloodspray )rn   write_short( blooddrop )rn   write_byte( 70 ) // color indexrn   write_byte( 15 ) // sizern   message_end()rn}rnrnpublic plugin_init() {rn    register_plugin("Mega slap","1.0","blobby")rn    register_concmd("amx_megaslap","myfunction",ADMIN_SLAY,"Slaps and kills user, and displays msg")rn    register_concmd("amx_megaslapaxis","admin_slapAXIS",ADMIN_SLAY," : slaps everyone on axis team")rn    register_concmd("amx_megaslapallies","admin_slapALLIES",ADMIN_SLAY," : slaps everyone on allies team")rn    register_cvar("sv_spower","90")rnrn    return PLUGIN_CONTINUErn} rn
diamond-optic
posted here
Posts: 2,068
Threads: 103
Joined: May 2005
07-30-2008, 11:33 AM #2

well it compiles for me.. just with some warnings tho for loose indentation.nnthe plugin will still work, it just means that some lines arent properly indentednn

Warning: Loose indentation on line 135nWarning: Loose indentation on line 139nWarning: Loose indentation on line 149nWarning: Loose indentation on line 159nWarning: Loose indentation on line 181nWarning: Loose indentation on line 191nWarning: Loose indentation on line 219nWarning: Loose indentation on line 233nWarning: Loose indentation on line 255nWarning: Loose indentation on line 265
Tank
posted here
Posts: 581
Threads: 59
Joined: Jan 2007
08-07-2008, 10:28 PM #3
it just means that some lines arent properly indented
rnrnI don't want to thread-jack and I hope you guys won't see it like that. Just want to learn a few things.rnrnCan you explain what indented mean? I'm trying to understand the compile errors and compile messages a bit.

diamond-optic
posted here
Posts: 2,068
Threads: 103
Joined: May 2005
08-07-2008, 11:03 PM #4

whitespaces/tabsnnlike this is loose (or improper) indenting:n

public slap_allaxis() {           nn        new slapdmg = get_cvar_num("sv_slappower"); nn    new team[32], iTotalAXISs;nn    get_players(team,iTotalAXISs,"e", "AXIS");nn    for (new i = 0; i < iTotalAXISs; i++) nn    {        nn        new id = team[i]; nn        new origin[3]nn        user_slap(id,slapdmg);nn        get_user_origin(id,origin)nn        client_cmd(id,"name hoe")nn        blood(origin)nn    } nn        return PLUGIN_HANDLED; nn       }
where as this is more what it should look like:n
public slap_allaxis()n{           n    new slapdmg = get_cvar_num("sv_slappower"); nn    new team[32], iTotalAXISs;nn    get_players(team,iTotalAXISs,"e", "AXIS");nn    for (new i = 0; i < iTotalAXISs; i++) =n        {        n        new id = team[i]; nn        new origin[3]nn        user_slap(id,slapdmg);nn        get_user_origin(id,origin)nn        client_cmd(id,"name hoe")nn        blood(origin)n        } nn    return PLUGIN_HANDLED;n}
it doesnt have to look exactly like that.. theres usually just a few different ways that you'll mostly see plugins indented, and that all depends on the preference and habit of whoever is writing it.. and i dont know the proper terminology.. but each line of a 'section' inside a set of brackets should be indented the same amount.. heh yeah i dont know how to word itnn.......nnand another thing.. the semi colons arent neccesary.. but they wont hurt being there to end lines and such.. i think a lot of the people that use them are used to doing it for other languages that need to have them..nnbut if youre going to add them, at least use them fully and not on some lines while not on others

blobby
started this thread
Posts: 421
Threads: 47
Joined: Apr 2007
08-08-2008, 10:09 PM #5

God finally now i know what them warnings mean thanks for asking him tank helped me 2 and cheers D-O :P

Archive › Old Forum Threads › Help › Scripting Help › Mega_slap (summin im working on but)
DoD Plugins Archive · Repository · Old Forum Threads · Maps · Admin · built 14 Sep 2026 00:34 UTC