Just a quicky
#1

I've got a problem on a new function i've started to create and its returning (CHECK CODE) on compile yet i've done the same thing before on another stock.

Код:
C:\Users\Lil' J\Music\SAMP\RP\gamemodes\Scratch.pwn(2783) : error 033: array must be indexed (variable "location")
C:\Users\Lil' J\Music\SAMP\RP\gamemodes\Scratch.pwn(2784) : error 033: array must be indexed (variable "reason")
pawn Код:
case DIALOG_PLAYER_911_REASON:
        {
            if(response)
            {
                if(GetPVarInt(playerid, "IsCalling911") == 1)
                {
                    new location[100];
                    GetPVarString(playerid, "Calling911_Location", location, 100);
                    AddEmergencyCall(playerid, location, inputtext);      
                }
            }            
        }

stock AddEmergencyCall(playerid, location[], reason[])
{
    for(new i =0; i < MAX_EMERGENCY_CALLS; i++)
    {
        if(i > MAX_EMERGENCY_CALLS) return SendClientMessage(playerid, COLOR_LIGHTRED, "[Dispatch]: All our officers are currently involved in situtations, please call back later.");

        if(EmergencyCallInfo[i][CallSlotUsed] == 0)
        {
            EmergencyCallInfo[i][CallID] = i;
            format(EmergencyCallInfo[i][Caller], 50, "%s", GetRolePlayName(playerid));
            format(EmergencyCallInfo[i][location], 100, "%s", cloc);
            format(EmergencyCallInfo[i][reason], 100, "%s", cres);
            break;
        }
    }
    return true;  
}
Reply
#2

Show me "EmergencyCallInfo" enum.
Reply
#3

pawn Код:
format(EmergencyCallInfo[i][location], 100, "%s", cloc);
format(EmergencyCallInfo[i][reason], 100, "%s", cres);
Don't use the same name for the parameters of AddEmergencyCall and for the enum of EmergencyCallInfo.
Reply
#4

Sorry, i didn't update them but its still happening. Also the enum has nothing to do with it.
Reply
#5

Quote:
Originally Posted by zT KiNgKoNg
Посмотреть сообщение
[..] Also the enum has nothing to do with it.
stock AddEmergencyCall(playerid, location[], reason[])

EmergencyCallInfo[i][location], 100, "%s", cloc);
EmergencyCallInfo[i][reason], 100, "%s", cres);

Using location and reason in EmergencyCallInfo is like those exists as indexes in the enum EmergencyCallInfo uses while they're at the same time the name of the parameters (AddEmergencyCall).

Think again what you want to do until you understand the mistake you did.
Reply
#6

FIXED, on my own.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)