Random Pickups Spawns
#1

Hey guys, I made a filterscript that currently should only spawns randomly a Pickup. PAWNO says me that the code is right, but I can't see the Pickup in any place I go.
I want to precise that I put all the code in the callback "public OnFilterscriptInit()" so maybe that's why it doesn't work (but that should ).

Anyway, here is the code, what's wrong whith it?

Код:
 new Float:RandomSpawns[0][3] =
 {
 {331.0169,2592.1196,17.4321},
 {-36.2954,2349.6096,24.3026},
 {549.1324,2273.1812,34.7290},
 {-393.5911,2488.7756,41.2797},
 {-552.6669,2593.8730,53.9348},
 {-246.0845,2580.4900,63.5703}
 };

new drugs;
new rand = random(sizeof(RandomSpawns));
drugs = CreatePickup(1279, 1, RandomSpawns[rand][0], RandomSpawns[rand][1], RandomSpawns[rand][2], 0);
Thanks.
Reply
#2

the
Код:
new Float:RandomSpawns[0][3] =
looks weird. a [0] in the array size with 3 cells each?
try to remove the 0 and make it simply [], so the compiler will estimate the size when compiling, also the sizeof(RandomSpawns) will return its real size. so the random() will pick another number than 0:
Код:
new Float:RandomSpawns[][3] =
oh, a little debug will help you to find the pickup position the script decided for you:
Код:
new rand = random(sizeof(RandomSpawns));
drugs = CreatePickup(1279, 1, RandomSpawns[rand][0], RandomSpawns[rand][1], RandomSpawns[rand][2], 0);

new string[128];
format(string,sizeof(string),"pickup %d spawned. position (x,y,z): %4.2f %4.2f %4.2f",rand,RandomSpawns[rand][0], RandomSpawns[rand][1], RandomSpawns[rand][2]);
SendClientMessageToAll(0xcc3333ff,string);
Reply
#3

Thanks Babul but it looks weird:

First because I changed [0] to [] and I added some /tp cmds to go to pickups, and I still can't see them.

But the real problem is that I see nowhere "pickup %d spawned. position (x,y,z): %4.2f %4.2f %4.2f" When I connect whereas the FS is correctly loaded.

I really don't know why then.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)