Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Give Gun Error [SOLVED]
#1
Hello i want to give my self gun but i get an error and when i remove the gun code the error goes away
ERROR;
Code:
Error 13 'plugin_test.plugin_test.OnSay(string, Addon.ServerClient)': not all code paths return a value    c:\users\steffen\documents\visual studio 2010\Projects\TestPlugin\TestPlugin\Class1.cs    21
"not all code paths return a value"

Code for guns
Code:
public override ChatType OnSay(string Message, ServerClient Client)
        {
            ServerPrint("Player " + Client.Name + " said " + Message);

            if (Message == "!getxuid")
            {
                TellClient(Client.ClientNum, "Your xuid is: \'" + Client.XUID + "\'.", true);
                return ChatType.ChatNone;
            }

            if (Message == "!help")
            {
                TellClient(Client.ClientNum, "Commands: !getxuid, !help", true);
                return ChatType.ChatNone;
            }


            if (Client.XUID == "you dont need this")
            {
                if (Message == "!admin")
                {
                    iPrintLnBold("^6Reckless is OP", Client);
                    Client.OriginZ = 6000f;
                    int WepID = GetWeapon("iw5_acr_mp");
                    int SecwID = GetWeapon("iw5_deserteagle_mp");
                    Client.Other.PrimaryWeaponAkimbo = false; // TURN TRUE FOR AKIMBO ACR
                    Client.Ammo.PrimaryAkimboAmmo = 500;
                    Client.Ammo.SecondaryAkimboAmmo = 500;
                    Client.Ammo.PrimaryAmmo += 1000;
                    Client.Ammo.SecondaryAmmo += 1000;
                    Client.Other.PrimaryWeapon = WepID;
                    Client.Other.SecondaryWeapon = SecwID;

                }

                else if (Client.XUID == "you dont need this")
                {
                    if (Message == "!admin")
                    {
                        iPrintLnBold("^6RedRum is OP", Client);
                        Client.OriginZ = 6000f;
                        int Wep2ID = GetWeapon("iw5_acr_mp_acog_silencer_heartbeat_grip");
                        int Secw2ID = GetWeapon("iw5_deserteagle_mp");
                        Client.Other.PrimaryWeaponAkimbo = true; //AKIMBO DEAGLES
                        Client.Ammo.PrimaryAkimboAmmo = 500;
                        Client.Ammo.SecondaryAkimboAmmo = 500;
                        Client.Ammo.PrimaryAmmo += 10000000; //primary ammo
                        Client.Ammo.SecondaryAmmo += 1000000; //secondary ammo
                        Client.Other.PrimaryWeapon = Wep2ID;
                        Client.Other.SecondaryWeapon = Secw2ID;
                    }
                    else
                    {
                        TellClient(Client.ClientNum, "No permission!", true);
                    }

                    return ChatType.ChatContinue;//Send the chat to the next plugin [Eventually to the game]
                }
            }
        }

My error is here "
Code:
public override ChatType OnSay(string Message, ServerClient Client)
"
Reply

#2
(11-16-2012, 23:48)koro35 Wrote: Hello i want to give my self gun but i get an error and when i remove the gun code the error goes away
ERROR;
Code:
Error 13 'plugin_test.plugin_test.OnSay(string, Addon.ServerClient)': not all code paths return a value    c:\users\steffen\documents\visual studio 2010\Projects\TestPlugin\TestPlugin\Class1.cs    21
"not all code paths return a value"

Code for guns
Code:
public override ChatType OnSay(string Message, ServerClient Client)
        {
            ServerPrint("Player " + Client.Name + " said " + Message);

            if (Message == "!getxuid")
            {
                TellClient(Client.ClientNum, "Your xuid is: \'" + Client.XUID + "\'.", true);
                return ChatType.ChatNone;
            }

            if (Message == "!help")
            {
                TellClient(Client.ClientNum, "Commands: !getxuid, !help", true);
                return ChatType.ChatNone;
            }


            if (Client.XUID == "you dont need this")
            {
                if (Message == "!admin")
                {
                    iPrintLnBold("^6Reckless is OP", Client);
                    Client.OriginZ = 6000f;
                    int WepID = GetWeapon("iw5_acr_mp");
                    int SecwID = GetWeapon("iw5_deserteagle_mp");
                    Client.Other.PrimaryWeaponAkimbo = false; // TURN TRUE FOR AKIMBO ACR
                    Client.Ammo.PrimaryAkimboAmmo = 500;
                    Client.Ammo.SecondaryAkimboAmmo = 500;
                    Client.Ammo.PrimaryAmmo += 1000;
                    Client.Ammo.SecondaryAmmo += 1000;
                    Client.Other.PrimaryWeapon = WepID;
                    Client.Other.SecondaryWeapon = SecwID;

                }

                else if (Client.XUID == "you dont need this")
                {
                    if (Message == "!admin")
                    {
                        iPrintLnBold("^6RedRum is OP", Client);
                        Client.OriginZ = 6000f;
                        int Wep2ID = GetWeapon("iw5_acr_mp_acog_silencer_heartbeat_grip");
                        int Secw2ID = GetWeapon("iw5_deserteagle_mp");
                        Client.Other.PrimaryWeaponAkimbo = true; //AKIMBO DEAGLES
                        Client.Ammo.PrimaryAkimboAmmo = 500;
                        Client.Ammo.SecondaryAkimboAmmo = 500;
                        Client.Ammo.PrimaryAmmo += 10000000; //primary ammo
                        Client.Ammo.SecondaryAmmo += 1000000; //secondary ammo
                        Client.Other.PrimaryWeapon = Wep2ID;
                        Client.Other.SecondaryWeapon = Secw2ID;
                    }
                    else
                    {
                        TellClient(Client.ClientNum, "No permission!", true);
                    }

                    return ChatType.ChatContinue;//Send the chat to the next plugin [Eventually to the game]
                }
            }
        }

My error is here "
Code:
public override ChatType OnSay(string Message, ServerClient Client)
"

Write
return ChatType.ChatContinue;
before your last }
[Image: compiling.png][Image: aLKA8og_460sa.gif]
Reply

#3
Thanks it worked
Reply

#4
Can you release the whole code?
Reply

#5
me???
Reply



Possibly Related Threads…
Thread Author Replies Views Last Post
  Help error when run mod mr.apple 9 6,639 09-24-2013, 21:49
Last Post: Nekochan
  Help [C#] WebClient how to know real url [solved] narkos 21 12,978 09-09-2013, 15:21
Last Post: surtek
Information Help How to edit new derived entry? (Solved) SSonic70 1 2,737 08-20-2013, 15:29
Last Post: Nekochan
  Help COD mw3 Error Couln't load image 3_cursor3:s Paylgs 2 14,291 07-18-2013, 18:46
Last Post: Nekochan
  Mod Error! help please Brandeeno 2 4,059 07-11-2013, 21:06
Last Post: Brandeeno
  Help xkmod error Domino29 2 4,456 07-11-2013, 20:07
Last Post: Brandeeno
  Help mw3 addon error [HARD] Tony. 2 4,473 06-08-2013, 00:32
Last Post: master131
  Help Freaking weird error when starting server!!!! Misterio 5 4,947 04-23-2013, 01:47
Last Post: Misterio
  d3d9 error magnuze 3 4,345 04-09-2013, 14:26
Last Post: NyZzE
  Help Server Script Compile Error when loading ExtremeBunkerMaker lolmoon 3 3,929 04-09-2013, 03:11
Last Post: lolmoon

Forum Jump:


Users browsing this thread:
3 Guest(s)

Forum Powered By MyBB, Theme by © 2002-2024 Melroy van den Berg.