Raised This Month: $ Target: $400
 0% 

Slay by SteamID


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
shadow.hk
Senior Member
Join Date: Dec 2008
Location: WA, Australia
Old 06-25-2009 , 10:29   Slay by SteamID
Reply With Quote #1

There's probably an obvious reason why this doesn't work, but if anyone could point it out, I'd be extremely grateful

I think the functions are fine, I'm just unsure on how to register the right SteamID.

PHP Code:
#pragma semicolon 1
#include <amxmodx>
#include <hamsandwich>
#define PLUGIN "Slay SteamID"
#define VERSION "0.1"
#define AUTHOR "shadow.hk"
new const SteamID[] = "STEAM_0:0:20240517";
new 
bool:g_iSlay[33], mdlGibssprWhitesprSmokesprLightsprFireg_msgShake;
public 
plugin_precache()
{
 
precache_sound("ambience/thunder_clap.wav");
 
 
mdlGibs precache_model("models/hgibs.mdl");
 
sprWhite precache_model("sprites/white.spr");
 
sprSmoke precache_model("sprites/steam1.spr");
 
sprLight precache_model("sprites/lgtning.spr");
 
sprFire precache_model("sprites/explode1.spr");
}
public 
plugin_init()
{
 
register_plugin(PLUGINVERSIONAUTHOR);
 
 
g_msgShake get_user_msgid("ScreenShake");
 
 
RegisterHam(Ham_Spawn,"player","fwdSpawnPlayer",1);
}
public 
client_authorized(id)
{
 new 
AuthID[64];
 
get_user_authid(id,AuthID,charsmax(AuthID));
 
 if(
equal(AuthID,SteamID))
  
g_iSlay[id] = true;
}
public 
fwdSpawnPlayer(id)
{
 if(
g_iSlay[id])
 {
  static 
name[32];
  
get_user_name(id,name,charsmax(name));
 
  
client_print(0,print_center,"%s was slain for being %s...");
  
slay_lightning(id);
 }
 
 return 
HAM_IGNORED;
}
slay_lightning(index)
{
 new 
iOrigin[3];
 
get_user_origin(indexiOrigin);
 
iOrigin[2]=iOrigin[2]-26;
 
 
message_begin(MSG_ONE,g_msgShake,{0,0,0},index);
 
write_short(1<<14);  // shake amount
 
write_short(1<<14);  // shake lasts this long
 
write_short(1<<14);  // shake noise frequency
 
message_end();
 
 
message_begin(MSG_BROADCAST,SVC_TEMPENTITY,{0,0,0});
 
write_byte(107);  // spherical shower of models, picks from set
 
write_coord(iOrigin[0]); // pos
 
write_coord(iOrigin[1]); 
 
write_coord(iOrigin[2]);
 
write_coord(175);  // (velocity)
 
write_short(mdlGibs);  // (model index)
 
write_short(25);  // (count)
 
write_byte(100);  // (life in 0.1's)
 
message_end();
 
 
slay_explode(iOrigin);
 
message_begin(MSG_BROADCASTSVC_TEMPENTITY);
 
write_byte(TE_BEAMPOINTS);
 
write_coord(iOrigin[0]);
 
write_coord(iOrigin[1]);
 
write_coord(iOrigin[2]);
 
write_coord(iOrigin[0]+150);
 
write_coord(iOrigin[1]+150);
 
write_coord(iOrigin[2]+400);
 
write_short(sprLight);
 
write_byte(1);
 
write_byte(5);
 
write_byte(2);
 
write_byte(20);
 
write_byte(30);
 
write_byte(200);
 
write_byte(200);
 
write_byte(200);
 
write_byte(200);
 
write_byte(200);
 
message_end();
 
 
message_begin(MSG_PVSSVC_TEMPENTITYiOrigin);
 
write_byte(TE_SPARKS);
 
write_coord(iOrigin[0]);
 
write_coord(iOrigin[1]);
 
write_coord(iOrigin[2]);
 
message_end();
 
 
message_begin(MSG_BROADCASTSVC_TEMPENTITY);
 
write_byte(TE_SMOKE);
 
write_coord(iOrigin[0]);
 
write_coord(iOrigin[1]);
 
write_coord(iOrigin[2]);
 
write_short(sprSmoke);
 
write_byte(15);
 
write_byte(10);
 
message_end();
 
 
emit_sound(indexCHAN_AUTO"ambience/thunder_clap.wav"1.0ATTN_NORM0PITCH_NORM);
 
user_silentkill(index);
}
slay_explode(vec1[3])
{
 
message_begin(MSG_BROADCAST,SVC_TEMPENTITY,vec1);
 
write_byte(21);
 
write_coord(vec1[0]);
 
write_coord(vec1[1]);
 
write_coord(vec1[2] + 16);
 
write_coord(vec1[0]);
 
write_coord(vec1[1]);
 
write_coord(vec1[2] + 1936);
 
write_short(sprWhite);
 
write_byte(0);  // startframe 
 
write_byte(0);  // framerate 
 
write_byte(3);  // life 2
 
write_byte(20);  // width 16 
 
write_byte(0);  // noise 
 
write_byte(188); // r 
 
write_byte(220); // g 
 
write_byte(255); // b 
 
write_byte(255); // brightness 
 
write_byte(0);  // speed 
 
message_end();
 
 
message_begin(MSG_BROADCAST,SVC_TEMPENTITY);
 
write_byte(12);
 
write_coord(vec1[0]);
 
write_coord(vec1[1]);
 
write_coord(vec1[2]);
 
write_byte(188); // byte (scale in 0.1's) 188 
 
write_byte(10);  // byte (framerate) 
 
message_end();
 
 
message_begin(MSG_BROADCAST,SVC_TEMPENTITY,vec1);
 
write_byte(3);
 
write_coord(vec1[0]);
 
write_coord(vec1[1]);
 
write_coord(vec1[2]);
 
write_short(sprFire);
 
write_byte(65);  // byte (scale in 0.1's) 188 
 
write_byte(10);  // byte (framerate) 
 
write_byte(0);  // byte flags 
 
message_end();
 
 
message_begin(MSG_BROADCAST,SVC_TEMPENTITY,vec1);
 
write_byte(5);
 
write_coord(vec1[0]);
 
write_coord(vec1[1]);
 
write_coord(vec1[2]);
 
write_short(sprSmoke);
 
write_byte(50);
 
write_byte(10);
 
message_end();

Oh, and any reason why, when I paste the code from the AMXX-Studio that it loses it's indentation?
shadow.hk is offline
Send a message via MSN to shadow.hk
SnoW
Veteran Member
Join Date: Oct 2008
Location: Finland WisdomNuggets: 8
Old 06-25-2009 , 10:31   Re: Slay by SteamID
Reply With Quote #2

Quote:
Originally Posted by shadow.hk View Post
Oh, and any reason why, when I paste the code from the AMXX-Studio that it loses it's indentation?
There is still "little identitation". You are probably using tabs and they are converted to spaces here. So one space is pretty much smaller than one tab.
SnoW is offline
Send a message via MSN to SnoW
xPaw
Retired AMX Mod X Moderator
Join Date: Jul 2008
Old 06-25-2009 , 10:45   Re: Slay by SteamID
Reply With Quote #3

find_player( );
Use "c" flag.
__________________
xPaw is offline
shadow.hk
Senior Member
Join Date: Dec 2008
Location: WA, Australia
Old 06-25-2009 , 11:07   Re: Slay by SteamID
Reply With Quote #4

Quote:
Originally Posted by xPaw View Post
find_player( );
Use "c" flag.
Mind showing me a full example?
shadow.hk is offline
Send a message via MSN to shadow.hk
xPaw
Retired AMX Mod X Moderator
Join Date: Jul 2008
Old 06-25-2009 , 12:50   Re: Slay by SteamID
Reply With Quote #5

new id = find_player( "c", "YOURSTEAMIDHERE" );

if( id > 0 ) {
// blubb
}
__________________
xPaw is offline
tpt
Member
Join Date: Jun 2009
Location: Scripting help section
Old 06-25-2009 , 14:10   Re: Slay by SteamID
Reply With Quote #6

Quote:
Originally Posted by shadow.hk View Post
Oh, and any reason why, when I paste the code from the AMXX-Studio that it loses it's indentation?
User CP -> Edit options -> And change your Message Editor Interface to Standard Editor - Extra formatting controls

That should help.
tpt is offline
Reply


Thread Tools
Display Modes

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 15:28.


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