15.02.2017, 01:36
(
Последний раз редактировалось Dayrion; 15.02.2017 в 03:08.
)
The problem is when I'm using this format :
Where I add .(parameter) = value - I have those warnings:
When I use default format (where each parameter are specified), I don't have any warn.
I've "type" 2 times in 2 different functions declared as parameter.
EDIT:
It's exactly this command which give me warnings.
As you can see I've 2 lines with GiveDrugWithOptions. If I switch the commented line from one to the other, it's giving me warnings (Rip English, apologize).
PHP код:
GiveDrugWithOptions(playerid, .graines = dStats[d_coGraines], .type = DRUGTYPE_COCAINE);
Код:
(235) : warning 219: local variable "type" shadows a variable at a preceding level (472) : warning 219: local variable "type" shadows a variable at a preceding level (540) : warning 219: local variable "type" shadows a variable at a preceding level (576) : warning 219: local variable "type" shadows a variable at a preceding level
PHP код:
GiveDrugWithOptions(playerid, _, _, dStats[d_coGraines], DRUGTYPE_COCAINE);
Quote:
As it says, local variable "type" shadows a variable at a preceding level. Which means that it is already used previously somewhere in the code on a level that is not local.
Either remove the occurrence in the preceding level or change the variable name to something that is not used yet. And your first post was not descriptive so I wouldn't know what to answer with. |
PHP код:
ApplyDrugEffect(playerid, Float:quantite, type)
PHP код:
GiveDrugWithOptions(playerid, champid = INVALID_DRUG_ID, feuilles = 0, graines = 0, type = DRUGTYPE_COCAINE)
Quote:
Are you sure it comes exactly from this line? because pawn compiler is dumb and when you forget to declare a variable somewhere but use it, it throws false shadow warnings of that variable everywhere.
I got a bunch of those single parameter with names and even literally have .playerid=playerid in half dozen parts of my code (streamer related mostly) and there's not a single warning, I advice you to check other places you use type, maybe one of them isn't declared properly. |
PHP код:
else if(!strcmp("/arrestdealer", cmdtext, true, strlen("/arrestdealer")))
{
if(!IsAFDLMember(playerid))
SCM(playerid, RED, PLAYER_UNAUTHORIZED);
if(GetNearestDealer(playerid) == INVALID_DRUG_ID)
return SCM(playerid, RED, NOT_NEAR_DEALER);
// SendMessageToRadio(playerid, "%s a arrкte le dealer de drogue.. Le dealer avait %i graines de cannabis & %i graines de cocaine.");
DestroyActor(dStats[dID]);
SetTimer("CreateDealer", DEALER_HEURE*1000, false); // (60*1000)*60*DEALER_HEURE <- Real time
DestroyDynamic3DTextLabel(dStats[dLabel]);
Me_Auto(playerid, "vient d'arrкter le dealer de drogue. On risque pas le voir avant quelques heures.");
GiveDrugWithOptions(playerid, _, _, dStats[d_coGraines], DRUGTYPE_COCAINE);
// GiveDrugWithOptions(playerid, .graines = dStats[d_coGraines], .type = DRUGTYPE_COCAINE);
return 1;
}