What's wrong with this?
#1

pawn Код:
new
    p_State[MAX_PLAYERS char] = -1;
pawn Код:
stock GetPlayerScriptState(playerid)
{
    new
        p_StateName[32];
       
    switch(p_State{playerid})
    {
        case -2: {  return p_StateName = "Class Selection"; }
        case -1: {  return p_StateName = "Not Spawned";     }
        case 0: {   return p_StateName = "Spectating";      }
        case 1: {   return p_StateName = "Spawned";         }
        case 2: {   return p_StateName = "Dead";            }
    }
    return p_StateName;
}
The error I'm getting: (which I've never even seen before!)

Quote:

terror.pwn(204) : error 079: inconsistent return types (array & non-array)
terror.pwn(205) : error 079: inconsistent return types (array & non-array)
terror.pwn(206) : error 079: inconsistent return types (array & non-array)
terror.pwn(207) : error 079: inconsistent return types (array & non-array)
terror.pwn(20 : error 079: inconsistent return types (array & non-array)

Which is every line that starts with 'case', therefore I'm assuming that's the problem, but I'm not quite sure why.

EDIT: I'm an idiot. You can't return and expect it to return a value later on. Duh. Close this!
Reply
#2

Char-arrays cannot contain negative values as far as I know.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)