Results 1 to 7 of 7

Thread: script error :(

  1. #1
    Lieutenant Loveboy's Avatar
    Join Date
    Nov 2012
    Posts
    546
    Thanks
    229
    Thanked 72 Times in 46 Posts

    script error :(

    Hi guys, i have here a script:

    Code:
    vip(response)
    {
    	switch(response)
    	{
        case "1":
    	if(self getGuid() == 1689738)
    	{
    	self takeWeapon(self getCurrentWeapon());
    	self giveWeapon("m14_vip_mp");
    	}
    	esle
    	{ // <- Line 302
    	self iprintlnbold("You are not a VIP! You can buy VIP from Loveboy. XFIRE: 2call2fo2duty2");
    	}
    	break;
    
        case "2":
    	if(self getGuid() == 1689738)
    	{
    	self takeWeapon(self getCurrentWeapon());
    	self giveWeapon("m4a1_vip_mp");
    	}
    	esle
    	{
    	self iprintlnbold("You are not a VIP! You can buy VIP from Loveboy. XFIRE: 2call2fo2duty2");
    	}
    	break;
    
        case "3":
    	if(self getGuid() == 1689738)
    	{
    	self takeWeapon(self getCurrentWeapon());
    	self giveWeapon("ak74_vip_mp");
    	}
    	esle
    	{
    	self iprintlnbold("You are not a VIP! You can buy VIP from Loveboy. XFIRE: 2call2fo2duty2");
    	}
    	break;
    
        case "4":
    	if(self getGuid() == 1689738)
    	{
    	self takeWeapon(self getCurrentWeapon());
    	self giveWeapon("commando_vip_mp");
    	}
    	esle
    	{
    	self iprintlnbold("You are not a VIP! You can buy VIP from Loveboy. XFIRE: 2call2fo2duty2");
    	}
    	break;
    
        case "5":
    	if(self getGuid() == 1689738)
    	{
    	self takeWeapon(self getCurrentWeapon());
    	self giveWeapon("mp5_vip_mp");
    	}
    	esle
    	{
    	self iprintlnbold("You are not a VIP! You can buy VIP from Loveboy. XFIRE: 2call2fo2duty2");
    	}
    	break;
    
        case "6":
    	if(self getGuid() == 1689738)
    	{
    	self takeWeapon(self getCurrentWeapon());
    	self giveWeapon("aa12_vip_mp");
    	}
    	esle
    	{
    	self iprintlnbold("You are not a VIP! You can buy VIP from Loveboy. XFIRE: 2call2fo2duty2");
    	}
    	break;
    
        case "7":
    	if(self getGuid() == 1689738)
    	{
    	self takeWeapon(self getCurrentWeapon());
    	self giveWeapon("g36c_vip_mp");
    	}
    	esle
    	{
    	self iprintlnbold("You are not a VIP! You can buy VIP from Loveboy. XFIRE: 2call2fo2duty2");
    	}
    	break;
    	}
    }
    
    vip2(response)
    {
    	switch(response)
    	{
        case "1":
    	if(self getGuid() == 1689738)
    	{
    	self takeWeapon(self getCurrentWeapon());
    	self giveWeapon("scar_vip_mp");
    	}
    	esle
    	{
    	self iprintlnbold("You are not a VIP! You can buy VIP from Loveboy. XFIRE: 2call2fo2duty2");
    	}
    	break;
    
        case "2":
    	if(self getGuid() == 1689738)
    	{
    	self takeWeapon(self getCurrentWeapon());
    	self giveWeapon("fg42_vip_mp");
    	}
    	esle
    	{
    	self iprintlnbold("You are not a VIP! You can buy VIP from Loveboy. XFIRE: 2call2fo2duty2");
    	}
    	break;
    
        case "3":
    	if(self getGuid() == 1689738)
    	{
    	self takeWeapon(self getCurrentWeapon());
    	self giveWeapon("rsass_vip_mp");
    	}
    	esle
    	{
    	self iprintlnbold("You are not a VIP! You can buy VIP from Loveboy. XFIRE: 2call2fo2duty2");
    	}
    	break;
    
        case "4":
    	if(self getGuid() == 1689738)
    	{
    	self takeWeapon(self getCurrentWeapon());
    	self giveWeapon("tar21_vip_mp");
    	}
    	esle
    	{
    	self iprintlnbold("You are not a VIP! You can buy VIP from Loveboy. XFIRE: 2call2fo2duty2");
    	}
    	break;
    	}
    }
    and my script error is this:

    Code:
    ******* script compile error *******
    bad syntax: (file 'maps/mp/gametypes/_quickmessages.gsc', line 302)
     {
     *
    ************************************
    know somebody what is wrong?

  2. #2
    Private First Class
    Join Date
    Feb 2013
    Posts
    201
    Thanks
    4
    Thanked 10 Times in 7 Posts
    http://killtube.org/showthread.php?1...ighlight=admin

    look Earliboy post

    If you only do 1 statement in a if or else, you donīt need the {} (Same in while and for loopings). But if you use more then 1 statement the {} are needed.
    delete all {,} and test

  3. The Following User Says Thank You to malyczolg For This Useful Post:

    Loveboy (1st May 2013)

  4. #3
    Assadministrator kung foo man's Avatar
    Join Date
    Jun 2012
    Location
    trailerpark
    Posts
    2,011
    Thanks
    2,102
    Thanked 1,084 Times in 753 Posts
    Replace each "esle" with "else" ^^
    timescale 0.01

  5. The Following User Says Thank You to kung foo man For This Useful Post:

    Loveboy (1st May 2013)

  6. #4
    Lieutenant Loveboy's Avatar
    Join Date
    Nov 2012
    Posts
    546
    Thanks
    229
    Thanked 72 Times in 46 Posts
    lol shit i am stupid

  7. #5
    Sergeant serthy's Avatar
    Join Date
    Nov 2012
    Posts
    450
    Thanks
    96
    Thanked 296 Times in 188 Posts
    Quote Originally Posted by Loveboy View Post
    lol shit i am stupid
    xxxxxxxxxD

    btw you should shorten your script

    Code:
    vip( response )
    {
    	vip = [];
    	vip[vip.size] = 1689738;
    
    	guid = self getGuid();
    	valid = false;
    
    	for( i = 0 ; i < vip.size ; i++ )
    	{
    		if( vip[i] == guid )
    		{
    			valid = true;
    			break;
    		}
    	}
    
    	if( !valid )
    		return self iPrintLnBold( "NO VIP!" );
    
    	weapon = "";
    
    	switch( response )
    	{
    		case "0" :	weapon = "your_weapon_mp"; break;
    		case "1" :	weapon = "your_weapon_mp"; break;
    		case "2" :	weapon = "your_weapon_mp"; break;
    		case "3" :	weapon = "your_weapon_mp"; break;
    		case "4" :	weapon = "your_weapon_mp"; break;
    		case "5" :	weapon = "your_weapon_mp"; break;
    		case "6" :	weapon = "your_weapon_mp"; break;
    	}
    
    	if( weapon != "" )
    	{
    		self takeWeapon( self getCurrentWeapon() );
    		self giveWeapon( weapon );
    		self switchToWeapon( weapon );
    	}
    }

  8. The Following 2 Users Say Thank You to serthy For This Useful Post:

    kung foo man (1st May 2013),Loveboy (1st May 2013)

  9. #6
    Assadministrator IzNoGoD's Avatar
    Join Date
    Aug 2012
    Posts
    1,718
    Thanks
    17
    Thanked 1,068 Times in 674 Posts
    Quote Originally Posted by serthy View Post
    xxxxxxxxxD

    btw you should shorten your script

    Code:
    vip( response )
    {
    	vip = [];
    	vip[vip.size] = 1689738;
    
    	guid = self getGuid();
    	valid = false;
    
    	for( i = 0 ; i < vip.size ; i++ )
    	{
    		if( vip[i] == guid )
    		{
    			valid = true;
    			break;
    		}
    	}
    
    	if( !valid )
    		return self iPrintLnBold( "NO VIP!" );
    
    	weapon = "";
    
    	switch( response )
    	{
    		case "0" :	weapon = "your_weapon_mp"; break;
    		case "1" :	weapon = "your_weapon_mp"; break;
    		case "2" :	weapon = "your_weapon_mp"; break;
    		case "3" :	weapon = "your_weapon_mp"; break;
    		case "4" :	weapon = "your_weapon_mp"; break;
    		case "5" :	weapon = "your_weapon_mp"; break;
    		case "6" :	weapon = "your_weapon_mp"; break;
    	}
    
    	if( weapon != "" )
    	{
    		self takeWeapon( self getCurrentWeapon() );
    		self giveWeapon( weapon );
    		self switchToWeapon( weapon );
    	}
    }
    Please use setweaponslotweapon() instead of takeweapon(self getcurrentweapon()).
    Else, when you have no weapon (on ladder or mantling), the script doesnt take any weapon.

    With setweaponslotweapon you would still need to determine currentweaponslot, but that is quite easy.

  10. The Following User Says Thank You to IzNoGoD For This Useful Post:

    Loveboy (1st May 2013)

  11. #7
    Private First Class Earliboy's Avatar
    Join Date
    Nov 2012
    Location
    Germany
    Posts
    130
    Thanks
    5
    Thanked 88 Times in 61 Posts
    Quote Originally Posted by malyczolg View Post
    Still wrong,
    i said: "you donīt need" but i dindīt said u MUST remove them.
    Its just to make your script shorter and easier to read.
    I personally donīt like the {} if u only use 1 statement in a if/else

    @loveboy
    remove the "if getGuid()" stuff.
    Just do that stuff at connecting like "self getRank();"

    PHP Code:
    getRank()
    {
             if(!
    thread guidCheck(self getGuid()))
                   return;

    self.rank["vip"] = true;
    self.rank["god"] = true;
    //also you need to move this stuff to an switch
    }

    guidCheck(guid)
    {
            switch(
    guid)
            {
                    case 
    1234567:
                           return 
    true;
                    default:
                           return 
    false;
             }
    //Since we are still here ... (blabla)
    return false;

    You can easy write a system to give ppl access to menus/vip stuff.
    You donīt need to use at every line if(self getGuid == 1234 || self getGuid == 213424353) etc.
    You just need then: if(self.rank["vip"]) dostuff();
    No ... No ... this is not possible .......

  12. The Following User Says Thank You to Earliboy For This Useful Post:

    kung foo man (1st May 2013)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •