Here is a code with apparently no syntax mistake according to a compiler that refuses to compile
Did it happen to you? did you solve it and do you see the same mistake you did in my code? if so you can help me! (p.s, 99% chance it has to do with my changelevel function)
#include maps/mp/_utility;
#include maps/mp/gametypes/_weapons;
main()
{
SetGametypeSetting("prematchperiod",0);
onplayerconnect();
}
onplayerconnect(){
for ( ;; ){
level waittill( "connected", player );
player thread unlimitedAmmo();
player thread onplayerspawned();
}
}
unlimitedAmmo(){
for ( ;; ){
if (self isFiring() && self attackButtonPressed()){
current_weapon = self getCurrentWeapon();
ClipSize = WeaponClipSize(current_weapon);
CurrentClip = self GetWeaponAmmoClip(current_weapon);
if (CurrentClip < ClipSize){
self setWeaponAmmoClip(current_weapon, ClipSize);
}}
wait 0.05;
}
}
onplayerspawned()
{
level endon( "game_ended" );
self endon( "disconnect" );
for(;;)
{
self waittill( "spawned_player" );
self thread openclassgenerator();
self thread changelevel();
wait 0.05;
}
}
openclassgenerator()
{
for(;;)
{
if(self useButtonPressed() && self attackButtonPressed())
{
self IPrintLn( "menu is opened: do !dsr !an94 and !msmc in chat text" );
self thread choseClassSet();
}
wait 0.3;
}
}
choseClassSet() {
i = 1;
while ( i == 1 ){
level waittill( "say", message, player, isHidden );
if ( message == "!dsr"){
self TakeAllWeapons();
self GiveWeapon("dsr50_mp+swayreduc+fmj", 0);
self GiveWeapon("knife_held_mp", 0);
i--;
} else if ( message == "!msmc"){
self TakeAllWeapons();
self GiveWeapon("insas_mp+stalker+fastads", 0);
self GiveWeapon("knife_held_mp", 0);
i--;
} else if (message == "!an94") {
self TakeAllWeapons();
self GiveWeapon("an94_mp+stalker+reflex+fastads");
self GiveWeapon("knife_held_mp", 0);
i--;
} else if (message == "!pdw") {
self TakeAllWeapons();
self GiveWeapon("pdw57_mp+stalker+fastads");
self GiveWeapon("knife_held_mp", 0);
i--;
} else if (message == "!mp7") {
self TakeAllWeapons();
self GiveWeapon("mp7_mp+stalker+fastads");
self GiveWeapon("knife_held_mp", 0);
i--;
} else if (message == "!ksg") {
self TakeAllWeapons();
self GiveWeapon("ksg_mp+stalker+fastads");
self GiveWeapon("knife_held_mp", 0);
i--;
}
}
}
changelevel() {
while (true) {
mapRotate = level waittill( "say", message, player, isHidden);
switch(mapRotate) {
case !mp_village:
SetDvar( "sv_mapRotationCurrent", "mp_village");
break;
}
}
}