AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=43)
-   -   Hey I need some help with 1. time scripting =) (https://forums.alliedmods.net/showthread.php?t=136629)

jacker 08-28-2010 10:56

Hey I need some help with 1. time scripting =)
 
Hello =)

I've been trying to create a Superhero by using this TUT: https://forums.alliedmods.net/showthread.php?t=54155

I've gotten some error while trying to compile and I don't know what to do, therefore I hope that some1 is willing to help me with editing the errors =)

errors: Warning: loose identation on line 75 - Warning: Function "Event_damage" should return a value on line 95 - Error: Invalid function or declaration on line 104 - Error: Invalid function or declaration on line 106 - Error: Invalid function or declaration on line 110 - Error: Argument type mismatch (argument 2) on line 126 - Warning: Unreachable code on line 131 - Error: Undefined sympol "HasSuperPower" on line 131 - Warning: Expression has no effect on line 131 - Error: Expected token: ";" but found "]" on line 131 - Error: Invalid expression, assumed zero on line 131 - Error: Too many error messages on one line on line 131.

also plz tell if I need to add more cvars than there allready is =)

PHP Code:

/* CVARS - copy and paste to shconfig.cfg
//Soldat
Soldat_level 1
Soldat_health 1000  //Hvor meget liv du får (normal 100)
Soldat_armor 200  //Hvor meget pansring du får (normal 0)
Soldat_gravity 0.25  //Hvor højt du kan hoppe (normal 1)
Soldat_speed 750  //Hvor hurtigt du kan løbe (normal 400)
Soldat_mult 2.5   //Hvor mange % din skade bliver (normal 1=100%)
*/
#include <amxmodx>
#include <cstrike>
#include <amxmisc>
#include <fakemeta>
#include <superheromod>
#define PLUGIN "Soldat"
#define VERSION "1.2"
#define AUTHOR "Soldateen"
// GLOBAL VARIABLES
new gHeroName[]="Soldat" 
new bool:gHasSuperPower[SH_MAXSLOTS+1] ;
new 
g_model;
new 
g_p_model;
new 
g_v_model;
public 
plugin_init() {
    
register_plugin("SUPERHERO Soldat""1.2""Soldateen");
    
shCreateHero(gHeroName"Du er nu en æret Soldat""Med din nye M4A1 & DEAGLE kan du overvinde selv den sværeste fjende"false"Soldat_level" )
 
 
    
// DO NOT EDIT THIS FILE TO CHANGE CVARS, USE SHCONFIG.CFG
    
register_cvar("Soldat_level""1");
    
register_cvar("Soldat_health""150");
    
register_cvar("Soldat_armor""150");
    
register_cvar("Soldat_grav""0.25"); 
    
register_cvar("Sodlat_speed""600.0"); 
    
register_cvar("Soldat_mult""1.5"); 
 
 
 
    
// FIRE THE EVENT THIS HERO WILL RESPOND TO! (AND SERVERCOMMANDS)
    // INIT
    
shSetMaxHealth(gHeroName"Soldat_health"); 
    
shSetMaxArmor(gHeroName"Soldat_armor");
    
shSetMinGravity(gHeroName"Soldat_grav");
    
shSetMaxSpeed(gHeroName"Soldat_speed""[26] [22]"); 
 
     
// REGISTER EVENTS THIS HERO WILL RESPOND TO! (AND SERVER COMMANDS)
    // INIT
    
register_event("DeathMsg""Event_death""a"); 
    
register_event("ResetHUD""Event_spawn","b"); 
    
register_event("CurWeapon""Event_weapon","be","1=1");
    
register_event("Damage""Event_damage","b");
    
register_srvcmd("Soldat_init""Soldat_init");
    
shRegHeroInit(gHeroName"Soldat_init");
    }
public 
Super_init() 
{
    new 
temp[6];
    
read_argv(1,temp,5);
    new 
id str_to_num(temp);
    
read_argv(2,temp,5);
    new 
hasPowers str_to_num(temp);
    
gHasSuperPower[id] = (hasPowers != 0); if (!hasPowers && gHasSuperPower[id] && is_user_alive(id)) 
    {
           
shRemHealthPower(id); 
     }
     if (!
hasPowers && gHasSuperPower[id] && is_user_alive(id))
    {
     
shRemArmorPower(id); 
     }
     if (!
hasPowers && gHasSuperPower[id] && is_user_alive(id)) 
    {
     
shRemGravityPower(id); 
     }
     if (!
hasPowers && gHasSuperPower[id] && is_user_alive(id)) 
    {
     
shRemSpeedPower(id); 
     }
     if(
hasPowers)
     {
      
Super_set_model(id)
     }
}
public 
Event_damage(id)
if (!
shModActive() || !is_user_alive(id)) return PLUGIN_CONTINUE;
    new 
damage read_data(2);
    new 
weaponbodypartattacker get_user_attacker(idweaponbodypart//store what weapon used, bodypart hit, and attacker
    
new headshot bodypart == //this is just short for:
    /*if (bodypart == 1) {
        headshot = 1;
    } else {
        headshot = 0;
    }*/
    
if(attacker <= || attacker SH_MAXSLOTS ) return PLUGIN_CONTINUE//checks ifs it was world that did the damage, and if so just end function.
    
if(gHasSuperPower[attacker] && is_user_alive(id)) { //if alive and have power
 
     
new extraDamage floatround(damage get_cvar_float("Super_mult") - damage); //calculate extra damage ([damage done x multiplier] - damage done = extra damage)
 
        
if (extraDamage 0) {
            
shExtraDamageidattackerextraDamage"Super damage Mult"headshot ); //superheromod.inc: stock shExtraDamage(id, attacker, damage, weaponDescription[], headshot = 0);
     
}
    }
}
public 
plugin_precache() 
{
 
g_model precache_model("models/shmod/Soldat/PLAYER_MODEL.mdl");
 
g_p_model precache_model("models/shmod/Soldat/p_m4a1.mdl"); 
 
g_v_model precache_model("models/shmod/Soldat/v_m4a1.mdl");
 
g_v_model precache_model("models/shmod/Soldat/v_deagle.mdl");
}
public 
Super_set_model(id
{
    if (!
shModActive() || !is_user_alive(id) || !gHasSuperPower[id]) return PLUGIN_CONTINUE//if shmod if off, or they are dead, or the dont have the power end function
    
cs_set_user_model(idg_model); //set player model
    
return PLUGIN_CONTINUE;
 
    if (!
shModActive() || !is_user_alive(id) || !HasSuperPower[id])  return;
    new 
clipammowpnid get_user_weapon(id,clip,ammo);
    if(
wpnid == CSW_M4A1
    {
        
set_pev(idpev_viewmodelengfunc(EngFunc_AllocStringg_v_model));//view model
        
set_pev(idpev_weaponmodelengfunc(EngFunc_AllocStringg_p_model));//player model
    
}
    if(
wpnid == CSW_DEAGLE
    {
        
set_pev(idpev_viewmodelengfunc(EngFunc_AllocStringg_v_model));//view model
    
}
public 
Event_weapon(id)
{
 new 
clip read_data(3); 
 if (
clip == 0)
 {
  
shReloadAmmo(id); 
 }
}
public 
Event_spawn(id)
{
 if(
gHasSuperPower[id] && is_user_alive(id) && shModActive()) 
 {
  
shGiveWeapon(id,"CSW_M4A1");
  
shGiveWeapon(id,"CSW_DEAGLE");
 }
}
public 
Event_death() 
{
 new 
victim read_data(2); 
 
cs_user_spawn(victim); 


Have a nice day =)

Kennarn 08-28-2010 12:51

Re: Hey I need some help with 1. time scripting =)
 
That tutorial is outdated, use Jelles tutorial.

Jelle 08-28-2010 14:39

Re: Hey I need some help with 1. time scripting =)
 
outdated. Use this: https://forums.alliedmods.net/showthread.php?t=120051

Exploited 08-28-2010 15:06

Re: Hey I need some help with 1. time scripting =)
 
Just a quick note, I'd recomend coding in English unles you are using a private server wich only you and your friends from the same country (Norway or Denmark, can't really tell wich one) will play on, as foreigners will get confused by the description.

Jelle 08-28-2010 15:55

Re: Hey I need some help with 1. time scripting =)
 
Quote:

Originally Posted by Exploited (Post 1284396)
Just a quick note, I'd recomend coding in English unles you are using a private server wich only you and your friends from the same country (Norway or Denmark, can't really tell wich one) will play on, as foreigners will get confused by the description.

Its Danish. Didn't see that before just now.

jacker 08-28-2010 18:06

Re: Hey I need some help with 1. time scripting =)
 
Well guys :D
I've been looking at the TUT uploaded by Jelle but there isn't as many things which u can choose from...
that was why I used the other one =)

Jelle 08-28-2010 20:24

Re: Hey I need some help with 1. time scripting =)
 
Then combine them.

Exploited 08-29-2010 04:35

Re: Hey I need some help with 1. time scripting =)
 
I might be wrong, but by just skimming through the code I didn't notice anything that Jelles tutorial doesn't cover.

jacker 08-29-2010 05:09

Re: Hey I need some help with 1. time scripting =)
 
well, maybe this 1 doesn't have any thing which jelle's doesn't have but I would like to create all the heroes for my LAN server. =)
and there was more to chooce from on Rolnaaba's TUT.
but, jelle. is there any possible chance that u could upload the other things which u haven't uploaded yet? =)

Jelle 08-29-2010 07:37

Re: Hey I need some help with 1. time scripting =)
 
It is almost the same as rolnaaba's, as long as you register the hero the new way, and use updated natives. register_event() should be the same. I am not going to make a laser or anything like that, at least not for the moment. But please, if you want something new, just request it. If it is small, and quick, I don't see why I couldn't upload it.


All times are GMT -4. The time now is 00:01.

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