Loop -
Leenert - 16.06.2013
Hey everyone, I have a little problem.
Under OnGameModeInit I have 4 Loops, that should create Pickups on my server. Unfortunately they do not start - just the first one. Even if I change the order of the loops - just the first one starts.
Код:
for(new b = 1; b <= MAX_NITRO_PICKUPS; b++) {
SetNitroRandomPosInArea(b,362.0141, -1891.816, 2826.046, 303.6248);
}
for(new a = 1; a <= MAX_REIFEN_PICKUPS; a++) {
SetReifenRandomPosInArea(a,362.0141, -1891.816, 2826.046, 303.6248);
}
for(new i = 1; i <= MAX_PANZERUNG_PICKUPS; i++) {
SetPanzerungRandomPosInArea(i,362.0141, -1891.816, 2826.046, 303.6248);
}
for(new c = 1; c <= MAX_BAUTEIL_PICKUPS; c++) {
SetBauteilRandomPosInArea(c,362.0141, -1891.816, 2826.046, 303.6248);
}
I hope someone can help me
Re: Loop -
Andriensis - 16.06.2013
i've the same issue.
i solved just putting everything under and only for.
AW: Re: Loop -
Leenert - 16.06.2013
Quote:
Originally Posted by ******
Probably because you are starting at 1 - PAWN is 0 indexed.
|
Thank you - that works. But the problem is not solved completely. To describe the system it creates car parts, that can get collected by players. So I use theese loops to create the pickups:
Код:
for(new i = 0; i < MAX_PANZERUNG_PICKUPS; i++) {
SetAutoteilRandomPosInArea(i,362.0141, -1891.816, 2826.046, 303.6248,2);
}
for(new i = 0; i < MAX_REIFEN_PICKUPS; i++) {
SetAutoteilRandomPosInArea(i,362.0141, -1891.816, 2826.046, 303.6248,0);
}
for(new i = 0; i < MAX_NITRO_PICKUPS; i++) {
SetAutoteilRandomPosInArea(i,362.0141, -1891.816, 2826.046, 303.6248,1);
}
The pickups are created - up to this time it works fine.
But the problem is, that a player is just able to collect a car part, that was created at last. In my example it would be the "Nitro" Pickups. So there e.g. a tire pickup, but the player is not able to collect it. The player can just pickup all nitro pickups. When I change the loops the player maybe is able to collect tires.
Here is my OnPlayerPickUpDynamicPickup:
Код:
new Gesamt_Pickups = CountDynamicPickups();
for(new i = 0; i < Gesamt_Pickups; i++) {
if(pickupid == AutoteilInfo[i][PickupID]) {
new type = AutoteilInfo[i][Type];
printf("Debug: %d", type);
DestroyDynamicPickup(AutoteilInfo[i][PickupID]);
DestroyDynamic3DTextLabel(AutoteilInfo[i][LabelID]);
SetAutoteilRandomPosInArea(i,362.0141, -1891.816, 2826.046, 303.6248,type);
SpielerInfo[playerid][pAutoteile][type]++;
new str[124];
switch(type)
{
case 0: format(str,sizeof(str),"Du hast gerade deinen %d. Autoreifen gefunden!",SpielerInfo[playerid][pAutoteile][type]);
case 1: format(str,sizeof(str),"Du hast gerade deine %d. Nitroflasche gefunden!",SpielerInfo[playerid][pAutoteile][type]);
case 2: format(str,sizeof(str),"Du hast gerade dein %d. Fahrzeugpanzerungselement gefunden!",SpielerInfo[playerid][pAutoteile][type]);
}
SendClientMessage(playerid,COLOR_RED,str);
}
I really don't know where's the problem....