[Tutorial] y_iterate (foreach 3.0)
#21

Quote:
Originally Posted by vannesenn
View Post
I can't find any tutorial how to include/add/put vehicle ids into iterate.
pawn Code:
new Iterator:vehicles<MAX_VEHICLES>;

Iter_Add(vehicles, a_vehicle_id_here);
and to see if 'a_vehicle_id_here' is in 'vehicles'

pawn Code:
if(Iter_Contains(vehicles, a_vehicle_id_here))
It's really simple, and just as simple in ArrayList
Reply
#22

Quote:

C:\Users\User\Desktop\SCRIPTING HEAVEN\pawno\include\YSI\..\YSI_Data\..\YSI_Intern al\..\YSI_Core\..\YSI_Storage\..\YSI_Internal\amx_ assembly.inc(38) : fatal error 111: user error: Please update "https://github.com/Zeex/amx_assembly" to get "deref()"

uh.. a little help? :c
Reply
#23

can help?

PHP Code:
D:\games\NFS 2017 Next Build\gamemodes\NFS_Buss6Updates.pwn(16596) : error 017undefined symbol "Iter_Func@ValidComponents"
D:\games\NFS 2017 Next Build\gamemodes\NFS_Buss6Updates.pwn(35098) : error 017undefined symbol "Iter_Func@ValidComponents"
D:\games\NFS 2017 Next Build\gamemodes\NFS_Buss6Updates.pwn(35094) : warning 204symbol is assigned a value that is never used"v"


CMD:vtune(playerid)
{
    if((
vID GetPlayerVehicleID(playerid)) == 0)
    {
          
Error(playerid"You must be in a vehicle to apply mods!");
        return 
true;
    }
    
/*if(pPremium[playerid] == 0)
    {
        Error(playerid, "You must be a premium member to use this command, check /premium for more info.");
        return true;
    }*/
    
if(InDM[playerid] != 0)
    {
         
Error(playerid"You can't tune your vehicle while in a DM!");
           return 
true;
    }
    if(
InEvent[playerid] != && pAdmin[playerid] != 5)
    {
         
Error(playerid"This command cannot be used while in a derby!");
        return 
true;
    }
    if(
doingStunt[playerid] == 19 && pAdmin[playerid] != 5)
    {
         
Error(playerid"This command cannot be used while in a derby!");
        return 
true;
    }
    new 
GetVehicleModel(vID);
    
iTemp 0;
    
str "";
    
line "";
    foreach(new 
xx ValidComponents(v))                           //THIS LINE
    
{
        
// Exclude NOS, wheels and stereo
        
if(GetVehicleComponentInSlot(vIDGetVehicleComponentType(xx)) != xx)
        {
            
format(strsizeof(str), ""RED_E"%d: %s\n"xxcomponentName[xx 1000]);
        }
        else
        {
            
format(strsizeof(str), ""GREEN_E"%d: %s\n"xxcomponentName[xx 1000]);
        }

        
// TO-DO: optimize concatenation?
        
strcat(linestr);

        
iTemp ++;
    }

    if(
iTemp == 0)
    {
        
SendClientMessage(playeridCOLOR_GREY"No components suit this vehicle!");
        return 
true;
    }

    
ShowPlayerDialog(playerid37DIALOG_STYLE_LIST"Available components"line"Apply""Close"); // TO-DO: memory optimization
    
return true;

Reply
#24

@NewFreeroamStunt

ValidComponents(v) > ValidComponents[v]

Also, did you created Iter?
Reply
#25

Update to latest git version, and read what Y_Less told you: https://sampforum.blast.hk/showthread.php?tid=640723
Reply
#26

is there an up-to-date list of current y_iterate functions with explanations + returns?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)