ItsMods
Help ERROR STRING - Printable Version

+- ItsMods (https://www.itsmods.com)
+-- Forum: Archive (https://www.itsmods.com/Forum-Archive.html)
+--- Forum: Archive (https://www.itsmods.com/Forum-Archive--64.html)
+--- Thread: Help ERROR STRING (/Thread-Help-ERROR-STRING.html)



ERROR STRING - koro35 - 11-20-2012

Code:
string mapname; if (Message == "!map " + mapname) { ServerCommand("map " + mapname); }
and i get error Use of unassibled local variable mapname.

i dont want full source but guide on howto fix ive heard that i can do
string mapname = String.Empty; im not sure if it will work tho


RE: ERROR STRING - JariZ - 11-20-2012

Code:
if(Message.SubString(0, 4) == "!map") ServerCommand("map "+Message.SubString(4));



RE: ERROR STRING - koro35 - 11-20-2012

Thanks ill try it

Still errors
Code:
Error 14 'string' does not contain a definition for 'SubString' and no extension method 'SubString' accepting a first argument of type 'string' could be found (are you missing a using directive or an assembly reference?) C:\mw3server\plugins\Class1.cs 204
im sorry im not good with C#


RE: ERROR STRING - JariZ - 11-20-2012

woops, that should be 'Substring' instead of 'SubString'