function only returning first character of string
#1

pawn Код:
GetInteriorName(intname[])
{
    for(new i = 0;i < 47;i++)
    {
        if(strfind(Interiors[i][InteriorName], intname, true) != -1)
        printf("%s, Interior Name (Function: GetInteriorName()", Interiors[i][InteriorName]);
        return Interiors[i][InteriorName];
    }
    return -1;
}
Reply
#2

Maybe this?
pawn Код:
GetInteriorName(intname[])
{
    for(new i = 0;i < 47;i++)
    {
        if(strfind(Interiors[i][InteriorName], intname, true) != -1)
        printf("%s, Interior Name (Function: GetInteriorName()", Interiors[i][InteriorName]);
    }
    return Interiors[i][InteriorName];
}
Reply
#3

Nope, it's outside the loop so it wont know what i is.
Reply
#4

This should sort it...
pawn Код:
stock GetInteriorName(intname[])
{
    new name[128];
    for(new i = 0;i < 47;i++)
    {
        if(strfind(Interiors[i][InteriorName], intname, true) != -1) {
            format(name,sizeof(name),"%s", Interiors[i][InteriorName]);
            break;
        }
    }
    return name;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)