Just a quicky - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Just a quicky (
/showthread.php?tid=474822)
Just a quicky -
zT KiNgKoNg - 09.11.2013
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;
}
Re: Just a quicky -
HardRock - 09.11.2013
Show me "EmergencyCallInfo" enum.
Re: Just a quicky -
Konstantinos - 09.11.2013
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.
Re: Just a quicky -
zT KiNgKoNg - 09.11.2013
Sorry, i didn't update them but its still happening. Also the enum has nothing to do with it.
Re: Just a quicky -
Konstantinos - 09.11.2013
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.
Re: Just a quicky -
zT KiNgKoNg - 09.11.2013
FIXED, on my own.