How to make a function that returns a string
#1

Hello,

I am working on a property script, and have made a function, but it does not compile,

I am trying to make it so that it returns "Nobody"

pawn Код:
stock GetPropertyOwnerName(property[])
{
    new file[256],name[24];
   
    format(file,sizeof(file),"gamemode/config/properties/%s.txt",property);
    if(strcmp(dini_Get(file,"Property_Owner"),"AnUnusableSA-MPName"))
    {
        new str[7] = "Nobody";
        return str;
    }
    format(name,sizeof(name),"%s",dini_Get(file,"Property_Owner"));
    return name;//line 235
}
This is the error I am receiving:
Код:
(235) : error 047: array sizes do not match, or destination array is too small
although if i delete "return str" the error goes away.

It is really doing my head in, if anyone could help i would appreciate it.
Reply


Messages In This Thread
How to make a function that returns a string - by mrcoolballs - 24.06.2012, 09:53
Re: How to make a function that returns a string - by MP2 - 24.06.2012, 10:02

Forum Jump:


Users browsing this thread: 1 Guest(s)