Raised This Month: $ Target: $400
 0% 

Round Start Error


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
The Specialist
BANNED
Join Date: Nov 2006
Old 12-20-2006 , 22:52   Round Start Error
Reply With Quote #1

Ok Im trying t fix this plugin to get approved. I changed alot of it . But on round start , everyone dies including me then it does the lightning. Can you tell me whas wrong here ?
Thanks

Code:
#include <amxmodx> #include <fakemeta> new g_Switch; new g_TSamari; new g_CTSamari; new sprite; new origin[3]; new Lightning; new VictomOrigin[3]; new AttackerOrigin[3]; new Weapon; new frags; public plugin_init() {  register_plugin("The Samari","0.3","The Specialist");  g_Switch = register_cvar("smr_switch","1");    register_event("HLTV", "RoundStart", "a", "1=0", "2=0");  register_event("CurWeapon","SamariModel","be","1=1");  register_event("Damage" , "SamariDamage" , "be");    register_forward(FM_PlayerPreThink,"MakeSamariSmoke");  Lightning = engfunc(EngFunc_PrecacheModel,"sprites/lgtning.spr");  sprite = engfunc(EngFunc_PrecacheModel,"sprites/steam1.spr");  engfunc(EngFunc_PrecacheModel,"models/v_samari.mdl");  engfunc(EngFunc_PrecacheModel,"models/player/ninja.mdl"); } public RoundStart() {  if(get_pcvar_num(g_Switch))  g_CTSamari = 0;  g_TSamari = 0;    new Terrorist[32],T_num;  get_players(Terrorist,T_num,"ace","TERRORIST");  g_TSamari = Terrorist[random_num(0,T_num-1)];    new CTs[32],CT_num;  get_players(CTs,CT_num,"ace","CT");  g_CTSamari = CTs[random_num(0,CT_num-1)]; } public MakeSamariSmoke(id) {  if((g_CTSamari == id || g_TSamari == id) && ( pev(id,pev_button) &  IN_USE  ))  pev(id,pev_origin,origin);  message_begin(MSG_BROADCAST ,SVC_TEMPENTITY);  write_byte(5);  engfunc(EngFunc_WriteCoord,origin[0]);  engfunc(EngFunc_WriteCoord,origin[1]);  engfunc(EngFunc_WriteCoord,origin[2]);  write_short(sprite);  write_byte(255);  write_byte(0);  message_end();  return FMRES_IGNORED; } public SamariModel(id) {  Weapon = read_data(2)    if((g_CTSamari == id || g_TSamari  == id) && ( Weapon == CSW_KNIFE))  set_pev( id, pev_viewmodel2,"models/v_samari.mdl");  set_pev(id,pev_model,"models/ninja.mdl");  set_pev(id,pev_maxspeed,330.0);  return ; } public SamariDamage(id) {  new Samari_Damage = read_data( 2 ) + 55;  new AttackerID = get_user_attacker( id, Weapon );  new Float:fAHealth;  new Float:fVHealth ;    if((Weapon == CSW_KNIFE) && (AttackerID == g_CTSamari || AttackerID == g_TSamari ) && (is_user_connected(AttackerID)))  pev(AttackerID,pev_health, fAHealth);  pev(id,pev_health, fVHealth);  set_pev(AttackerID,pev_health, fAHealth + fVHealth );  pev(id,pev_origin,VictomOrigin);  pev(AttackerID,pev_origin,AttackerOrigin);    message_begin( MSG_BROADCAST, SVC_TEMPENTITY)  write_byte(8);  write_short(AttackerID);  write_short(id);  write_short(Lightning);  write_byte(0)  write_byte(0);  write_byte(25);  write_byte(30);  write_byte(10);    write_byte(255);  write_byte(255);  write_byte(255)  write_byte(255);  write_byte(0);  message_end();    if ((is_user_alive(id)) && (fVHealth < Samari_Damage))  pev(AttackerID, pev_frags, frags);  set_pev(AttackerID, pev_frags, ++frags);  dllfunc(DLLFunc_ClientKill, id);  return 1; }
The Specialist is offline
Send a message via AIM to The Specialist
Simon Logic
Senior Member
Join Date: Nov 2006
Location: RF
Old 12-21-2006 , 08:32   Re: Round Start Error
Reply With Quote #2

try register_event("Damage" , "SamariDamage" , "be", "2!0", "4!0"), i'm not sure why coordinate x must not equal to 0. Or try just "2!0".

Damage msg can be called when there is no actual damage.

ADDED:

Heh, I wrote in one of my tests a comment:
Quote:
// NOTE: when fall damage is applied coordinates are zero
Memory is unreliable thing.

Last edited by Simon Logic; 12-21-2006 at 08:36.
Simon Logic is offline
Send a message via Skype™ to Simon Logic
The Specialist
BANNED
Join Date: Nov 2006
Old 12-21-2006 , 17:30   Re: Round Start Error
Reply With Quote #3

thats not the problem . The damage event worked on version 0.2 . I didnt change that .
The Specialist is offline
Send a message via AIM to The Specialist
P34nut
AMX Mod X Beta Tester
Join Date: Feb 2006
Location: Netherlands
Old 12-21-2006 , 17:34   Re: Round Start Error
Reply With Quote #4

first:
dont precache stuff in plugin_init()

i dont think itll precache it anyway (itll give a warning: Precaching not allowed)

instead of this: set_pev(id,pev_model,"models/ninja.mdl");
use engfunc(EngFunc_SetModel, id, "models/ninja.mdl"); but if id is a player you need to put ninja in the models/player directory and use cs_set_user_model() (for cs) or other native
__________________
All you need to change the world is one good lie and a river of blood

Last edited by P34nut; 12-21-2006 at 17:38.
P34nut is offline
The Specialist
BANNED
Join Date: Nov 2006
Old 12-21-2006 , 17:47   Re: Round Start Error
Reply With Quote #5

hi Peanut

the engfunc precache in the registery , does work , in fact I got that from Jim Yang .

As for the model , I tried that before , But it kills me right at the begining of the round , right as soon as I spawn , so it doesnt give it a chance to set the model , everyone dies .
The Specialist is offline
Send a message via AIM to The Specialist
P34nut
AMX Mod X Beta Tester
Join Date: Feb 2006
Location: Netherlands
Old 12-21-2006 , 18:03   Re: Round Start Error
Reply With Quote #6

Quote:
Originally Posted by The Specialist View Post
the engfunc precache in the registery , does work , in fact I got that from Jim Yang .
Dont do it its stupid.. precache need to be done at the very first point (mapload)
__________________
All you need to change the world is one good lie and a river of blood
P34nut is offline
jim_yang
Veteran Member
Join Date: Aug 2006
Old 12-22-2006 , 02:57   Re: Round Start Error
Reply With Quote #7

register_event("CurWeapon","SamariModel","be","1=1","2=29")
then you don't need to get weaponid in SamariModel
__________________
Project : CSDM all in one - 99%
<team balancer#no round end#entity remover#quake sounds#fake full#maps management menu#players punishment menu#no team flash#colored flashbang#grenade trails#HE effect#spawn protection#weapon arena#weapon upgrade#auto join#no weapon drop#one name>
jim_yang is offline
The Specialist
BANNED
Join Date: Nov 2006
Old 12-22-2006 , 03:02   Re: Round Start Error
Reply With Quote #8

what is the 2=29 ? weapon id = knife right ? Other then thta does my code look ok ? I fixed it up made flaots where there should have been and took out the for statement i had . (and gave u karma)
The Specialist is offline
Send a message via AIM to The Specialist
Simon Logic
Senior Member
Join Date: Nov 2006
Location: RF
Old 12-22-2006 , 06:05   Re: Round Start Error
Reply With Quote #9

Weapon var should not be global cause u don't need this at all.

Why you're using engfunc(EngFunc_WriteCoord, ...) instead of write_coord()? Is it just cool or required?
Simon Logic is offline
Send a message via Skype™ to Simon Logic
The Specialist
BANNED
Join Date: Nov 2006
Old 12-22-2006 , 06:09   Re: Round Start Error
Reply With Quote #10

If you use fakemeta its the cool thing to do .
The Specialist is offline
Send a message via AIM to The Specialist
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 22:30.


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