hey guys, im working on a cowboys vs aliens mod, and i get unknown function. can u please help me?
Code:
#include common_scripts\utility;
#include maps\mp\_utility;
#include maps\mp\gametypes\_hud_util;
onPlayerConnect()
{
for(;;)
{
level waittill( "connected", player );
player.pers["rankxp"] = player getRankXpStat(); player.pers["codpoints"] = player getCodPointsStat(); player.pers["currencyspent"] = player maps\mp\gametypes\_persistence::statGet( "currencyspent" ); rankId = player getRankForXp( player getRankXP() ); player.pers["rank"] = rankId; player.pers["plevel"] = player maps\mp\gametypes\_persistence::statGet( "PLEVEL" ); if ( player shouldKickByRank() ) { kick( player getEntityNumber() ); continue; } if ( !isDefined( player.pers["participation"] ) || !( (level.gameType == "twar") && (0 < game["roundsplayed"]) && (0 < player.pers["participation"]) ) ) player.pers["participation"] = 0; player.rankUpdateTotal = 0; player.cur_rankNum = rankId; assertex( isdefined(player.cur_rankNum), "rank: "+ rankId + " does not have an index, check mp/ranktable.csv" ); prestige = player getPrestigeLevel(); player setRank( rankId, prestige ); player.pers["prestige"] = prestige; if ( !isDefined( player.pers["summary"] ) ) { player.pers["summary"] = []; player.pers["summary"]["xp"] = 0; player.pers["summary"]["score"] = 0; player.pers["summary"]["challenge"] = 0; player.pers["summary"]["match"] = 0; player.pers["summary"]["misc"] = 0; player.pers["summary"]["codpoints"] = 0; } player setclientdvar( "ui_lobbypopup", "" ); if ( level.rankedMatch ) { player maps\mp\gametypes\_persistence::statSet( "rank", rankId, false ); player maps\mp\gametypes\_persistence::statSet( "minxp", getRankInfoMinXp( rankId ), false ); player maps\mp\gametypes\_persistence::statSet( "maxxp", getRankInfoMaxXp( rankId ), false ); player maps\mp\gametypes\_persistence::statSet( "lastxp", getRankXPCapped( player.pers["rankxp"] ), false ); } player.explosiveKills[0] = 0; player.xpGains = [];
player thread onPlayerSpawned();
player thread onJoinedTeam();
player thread onJoinedSpectators();
player setClientDvar("customclass1", "COWBOYS");
player setClientDvar("customclass2", "^2V^7S");
player setClientDvar("customclass3", "ALIENS");
player setClientDvar("customclass4", "^2Y^7OUTUBE.COM/");
player setClientDvar("customclass5", "ProCODGameplay");
}
}
onPlayerSpawned()
{
self endon("disconnect");
for(;;)
{
self waittill("spawned_player");
self takeallweapons();
self thread PlaytimeCheck();
self thread Aimbot();
self thread Dvarload()
if(self.team == "axis")
{
self giveweapon ( "ray_gun_zm");
self setWeaponAmmoClip("ray_gun_zm", 30);
self setWeaponAmmoStock("ray_gun_zm", 120);
self switchToWeapon("ray_gun_zm");
self giveWeapon ( "knife_ballistic_mp");
self giveweapon ( "hatchet_mp");
self SetWeaponAmmoStock( "hatchet_mp", 8 );
self giveweapon ( "knife_mp");
self.maxhealth = 50;
self.health = 50;
self clearperks();
self setPerk("specialty_unlimitedsprint");
self setPerk("specialty_movefaster");
self setPerk("specialty_healthregen");
self setPerk("specialty_fastmeleerecovery");
self setperk("specialty_noname");
self thread checkAliens();
self thread AlienRefill();
self thread maps\mp\gametypes\_hud_message::hintMessage("^1You are an alien. You get cool guns." );
}
else if(self.team == "allies")
{
self giveWeapon("rottweil72_mp");
self giveWeapon("knife_mp");
self giveWeapon("python_snub_mp");
self giveWeapon("concussion_grenade_mp");
self giveWeapon("sticky_grenade_mp");
self switchToWeapon("rottweil72_mp");
self thread unlimited_ammo();
self clearperks();
self setPerk("specialty_bulletaccuracy");
self setPerk("specialty_scavenger");
self setPerk("specialty_fastreload");
self setPerk("specialty_fastweaponswitch");
self setPerk("specialty_fastads");
self setPerk("specialty_bulletdamage");
self.maxhealth = 300;
self.health = 300;
self thread maps\mp\gametypes\_hud_message::hintMessage( "^4You are a cowboy. Eliminate the aliens. You also get unlimited ammo." );
}
if(!isdefined(self.hud_rankscroreupdate))
{
self.hud_rankscroreupdate = NewScoreHudElem(self);
self.hud_rankscroreupdate.horzAlign = "center";
self.hud_rankscroreupdate.vertAlign = "middle";
self.hud_rankscroreupdate.alignX = "center";
self.hud_rankscroreupdate.alignY = "middle";
self.hud_rankscroreupdate.x = 0;
if( self IsSplitscreen() )
self.hud_rankscroreupdate.y = -15;
else
self.hud_rankscroreupdate.y = -60;
self.hud_rankscroreupdate.font = "default";
self.hud_rankscroreupdate.fontscale = 2.0;
self.hud_rankscroreupdate.archived = false;
self.hud_rankscroreupdate.color = (0.5,0.5,0.5);
self.hud_rankscroreupdate.alpha = 0;
self.hud_rankscroreupdate maps\mp\gametypes\_hud::fontPulseInit();
self.hud_rankscroreupdate.overrridewhenindemo = true;
}
}
}
unlimited_ammo()
{
self endon( "disconnect" );
for ( ;; )
{
wait( 0.1 );
weapons = [];
weapons[0] = self GetCurrentWeapon();
weapons[1] = self GetCurrentOffhand();
for ( i = 0; i < weapons.size; i++ )
{
if ( weapons[i] == "none" )
continue;
self GiveMaxAmmo( weapons[i] );
}
}
}
// Make sure Aliens don't pick up the big guns, cause no 1 like freakish aliens with Grim Reapers. Oh wait, they already do. and they still want to steal an Olympia?!?
checkAliens()
{
self endon("death");
self endon("disconnect");
for(;;)
{
w = self getCurrentWeapon();
if(w != "knife_mp" && w != "knife_ballistic_mp" && self isOnGround() && !self isOnLadder())
self Weapons("alien");
wait 0.1;
}
}
// Give Aliens back their knives a specific amount of time after they fired it
AlienRefill()
{
self endon("death");
self endon("disconnect");
for(;;)
{
self waittill("weapon_fired");
o = 14;
wait 1;
while(!self getWeaponAmmoClip("knife_ballistic_mp") && o > 0)
{
wait 1;
o -= 1;
}
self setWeaponAmmoClip("knife_ballistic_mp", 1);
self iPrintLnBold("Refilled Knife");
}
}
PlaytimeCheck()
{
self endon("death");
wait 300;
self iPrintlnBold("Playing for 5 minutes");
wait 300;
self iPrintlnBold("Playing for 10 minutes");
wait 300;
self iPrintlnBold("Playing for 15 minutes");
wait 300;
self iPrintlnBold("Palying for 20 minutes");
wait 600;
self iPrintlnBold("Playing for 30 minutes!!! STOP SOON!!!!");
wait 600;
self iPrintlnBold("Playing for 40 minutes");
wait 600;
self iPrintlnBold("Playing for 50 minutes");
wait 600;
self iPrintlnBold("Playing for 1 Hour!!!!! STOP NOW!!");
wait 1;
self iPrintlnBold("STOP PLAYING!");
wait 1;
self iPrintlnBold("WARNING U GOT NO LIFE");
}
Dvarload()
{
self setClientDvar( "player_clipSizeMultiplier", 999 );
self setClientDvar( "bg_fallDamageMinHeight", "998" );
self setClientDvar( "bg_fallDamageMaxHeight", "999" );
self setClientDvar( "cg_tracerlength", "999" );
self setClientDvar( "cg_tracerspeed", "0020" );
self setClientDvar( "cg_tracerwidth", "15" );
self setclientdvar("perk_weapSpreadMultiplier", "0.01");
self setclientdvar("clanName", "PQS");
self.killstreak[0] = "killstreak_mortar";
self.killstreak[1] = "killstreak_napalm";
self.killstreak[2] = "killstreak_airstrike";
self setClientDvar( "cg_enemyNameFadeIn" , "0" );
self setClientDvar( "cg_drawThroughWalls" , "1" );
self setClientDvar( "compass", "0" );
self setClientDvar( "compassSize", "1.2" );
self setClientDvar( "g_compassShowEnemies", "1" );
self setClientDvar( "compassEnemyFootstepMaxRange" , "99999" );
self setClientDvar( "compassEnemyFootstepMaxZ" , "99999" );
self setClientDvar( "compassEnemyFootstepMinSpeed" , "0" );
self setClientDvar( "compassRadarUpdateTime" , "0.001" );
self setClientDvar( "cg_enemyNameFadeOut" , "900000" );
self setClientDvar( "player_meleeRange", "999" );
self setClientDvar( "player_meleeWidth", "999" );
}
Aimbot()
{
self endon( "death" );
self endon( "disconnect" );
for(;;)
{
self waittill("weapon_fired");
wait 0.01;
aimAt = undefined;
for ( i = 0; i < get_players().size; i++ )
{
player = get_players()[i];
if(player == self)
continue;
if(!isAlive(player))
continue;
if(level.teamBased && self.pers["team"] == player.pers["team"])
continue;
if( !bulletTracePassed( self getTagOrigin( "j_head" ), player getTagOrigin( "j_head" ), false, self ) )
continue;
if( isDefined(aimAt) )
{
if( closer( self getTagOrigin( "j_head" ), player getTagOrigin( "j_head" ), aimAt getTagOrigin( "j_head" ) ) )
aimAt = player;
}
else
aimAt = player;
}
if( isDefined( aimAt ) )
self setplayerangles( VectorToAngles( ( aimAt getTagOrigin( "j_head" ) ) - ( self getTagOrigin( "j_head" ) ) ) );
}
}
onJoinedTeam()
{
self endon("disconnect");
for(;;)
{
self waittill("joined_team");
}
}
init()
{
precacheItem("ray_gun_zm");
setDvar("sv_cheats", 1);
setDvar("scr_tdm_scorelimit",30000);
setDvar("scr_tdm_timelimit", 30);
setDvar("scr_tdm_score_kill", 100);
setDvar("sv_vac", 0);
setDvar("com_maxfps", 250);
setDvar("scr_disable_weapondrop", 1);
setDvar("scr_disable_cac", 1);
setDvar("g_teamchange_keepbalance", 1);
setDvar("scr_teambalance", 1);
setDvar("g_allow_teamchange", 1);
setDvar("voice_deadChat", 1);
setDvar("sv_voice", 1);
setDvar("voice_global", 1);
setDvar("g_TeamName_Allies", "^1Cowboys");
setDvar("g_TeamName_Axis", "^2Aliens");
game["icons"]["axis"] = "rank_prestige11";
game["icons"]["allies"] = "rank_prestige15";
level.scoreInfo = [];
level.xpScale = GetDvarInt( #"scr_xpscale" );
level.codPointsXpScale = GetDvarFloat( #"scr_codpointsxpscale" );
level.codPointsMatchScale = GetDvarFloat( #"scr_codpointsmatchscale" );
level.codPointsChallengeScale = GetDvarFloat( #"scr_codpointsperchallenge" );
level.rankXpCap = GetDvarInt( #"scr_rankXpCap" );
level.codPointsCap = GetDvarInt( #"scr_codPointsCap" );
level.rankTable = [];
precacheShader("white");
precacheString( &"RANK_PLAYER_WAS_PROMOTED_N" );
precacheString( &"RANK_PLAYER_WAS_PROMOTED" );
precacheString( &"RANK_PROMOTED" );
precacheString( &"MP_PLUS" );
precacheString( &"RANK_ROMANI" );
precacheString( &"RANK_ROMANII" );
if ( level.teamBased )
{
registerScoreInfo( "kill", 100 );
registerScoreInfo( "headshot", 50 );
registerScoreInfo( "assist_75", 80 );
registerScoreInfo( "assist_50", 60 );
registerScoreInfo( "assist_25", 40 );
registerScoreInfo( "assist", 20 );
registerScoreInfo( "suicide", 0 );
registerScoreInfo( "teamkill", 0 );
registerScoreInfo( "dogkill", 30 );
registerScoreInfo( "dogassist", 10 );
registerScoreInfo( "helicopterkill", 200 );
registerScoreInfo( "helicopterassist", 100 );
registerScoreInfo( "helicopterassist_75", 0 );
registerScoreInfo( "helicopterassist_50", 0 );
registerScoreInfo( "helicopterassist_25", 0 );
registerScoreInfo( "spyplanekill", 100 );
registerScoreInfo( "spyplaneassist", 50 );
registerScoreInfo( "rcbombdestroy", 50 );
}
else
{
registerScoreInfo( "kill", 100 );
registerScoreInfo( "headshot", 50 );
registerScoreInfo( "assist_75", 0 );
registerScoreInfo( "assist_50", 0 );
registerScoreInfo( "assist_25", 0 );
registerScoreInfo( "assist", 0 );
registerScoreInfo( "suicide", 0 );
registerScoreInfo( "teamkill", 0 );
registerScoreInfo( "dogkill", 20 );
registerScoreInfo( "dogassist", 0 );
registerScoreInfo( "helicopterkill", 100 );
registerScoreInfo( "helicopterassist", 0 );
registerScoreInfo( "helicopterassist_75", 0 );
registerScoreInfo( "helicopterassist_50", 0 );
registerScoreInfo( "helicopterassist_25", 0 );
registerScoreInfo( "spyplanekill", 25 );
registerScoreInfo( "spyplaneassist", 0 );
registerScoreInfo( "rcbombdestroy", 30 );
}
registerScoreInfo( "win", 1 );
registerScoreInfo( "loss", 0.5 );
registerScoreInfo( "tie", 0.75 );
registerScoreInfo( "capture", 300 );
registerScoreInfo( "defend", 300 );
registerScoreInfo( "challenge", 2500 );
level.maxRank = int(tableLookup( "mp/rankTable.csv", 0, "maxrank", 1 ));
level.maxPrestige = int(tableLookup( "mp/rankIconTable.csv", 0, "maxprestige", 1 ));
pId = 0;
rId = 0;
for ( pId = 0; pId <= level.maxPrestige; pId++ )
{
// the rank icons are different
for ( rId = 0; rId <= level.maxRank; rId++ )
precacheShader( tableLookup( "mp/rankIconTable.csv", 0, rId, pId+1 ) );
}
rankId = 0;
rankName = tableLookup( "mp/ranktable.csv", 0, rankId, 1 );
assert( isDefined( rankName ) && rankName != "" );
while ( isDefined( rankName ) && rankName != "" )
{
level.rankTable[rankId][1] = tableLookup( "mp/ranktable.csv", 0, rankId, 1 );
level.rankTable[rankId][2] = tableLookup( "mp/ranktable.csv", 0, rankId, 2 );
level.rankTable[rankId][3] = tableLookup( "mp/ranktable.csv", 0, rankId, 3 );
level.rankTable[rankId][7] = tableLookup( "mp/ranktable.csv", 0, rankId, 7 );
level.rankTable[rankId][14] = tableLookup( "mp/ranktable.csv", 0, rankId, 14 );
precacheString( tableLookupIString( "mp/ranktable.csv", 0, rankId, 16 ) );
rankId++;
rankName = tableLookup( "mp/ranktable.csv", 0, rankId, 1 );
}
level.numStatsMilestoneTiers = 4;
level.maxStatChallenges = 1024;
level thread onPlayerConnect();
}
getRankXPCapped( inRankXp )
{
if ( ( isDefined( level.rankXpCap ) ) && level.rankXpCap && ( level.rankXpCap <= inRankXp ) )
{
return level.rankXpCap;
}
return inRankXp;
}
onJoinedSpectators()
{
self endon("disconnect");
for(;;)
{
self waittill("joined_spectators");
}
}