crash pawn
#1

hi I've add new function in my script but when a try to compile , I receive pawn librarie has stoped to working :

the function

Quote:
PHP код:
public GetDoorLock(houseId)
{
    if(
gHouseVar[houseId][hLocked] == 0) return "Ouverte";
    else return 
"Fermйe";

Reply
#2

You can't return constant strings like that, but you can return arrays.

pawn Код:
public GetDoorLock(houseId)
{
    if(gHouseVar[houseId][hLocked] == 0)
    {
        new szStr[] = "Ouverte";
        return szStr;
    }
    new szStr[] = "Fermйe";
    return szStr;
}
Reply
#3

its send me an other error : public functions may not return arrays. so i must use stock??
Reply
#4

Yeah sorry i completely forgot about that, make it a stock.

If you use it, it doesn't have to be a stock function.
pawn Код:
GetDoorLock(houseId)
{
    if(gHouseVar[houseId][hLocked] == 0)
    {
        new szStr[] = "Ouverte";
        return szStr;
    }
    new szStr[] = "Fermйe";
    return szStr;
}
If you make a function stock, you are just telling the compiler that, if it is not used; leave it out of compilation.
Reply
#5

ok thx;
but plz can you explain me why we can't return string in public function??
Reply
#6

ahh ok thanks.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)