fGetSpawnFromChange missing

Doc

Valued Member!
So yeah - I don't appear to have a function for fGetSpawnFromChance, can anybody copy and paste from below please? I don't have a problem with vehicles spawning, but it seems they spawn with a 100% success rate!


edit: please rename to fix typo! - will help for the archives
 
BEGIN

DECLARE bspawn TINYINT(1) DEFAULT 0;

IF (RAND() <= chance) THEN
SET bspawn = 1;
END IF;

RETURN bspawn;

END
 
Well this is strange, it's refusing to save the function. When I press save it just deletes what I pasted in the definition with no warning or anything. It's return type is tinyint(1) which is correct and type is a function. I can't understand why it's doing this. I even tried saving it as a new function with no luck.

EDIT: Got it to save by changing data access to "Contains SQL" in the advanced options. Thanks again
 
This didn't actually work, i get an error with the number of arguements when it's executed. I also need fSpawnChance aswell as fGetSpawnFromChance now - can you post both again please? :) Thanks
 
fGetSpawnFromChance:

BEGIN

DECLARE bspawn TINYINT(1) DEFAULT 0;

IF (RAND() <= chance) THEN
SET bspawn = 1;
END IF;

RETURN bspawn;

END

thats all i have :)
 
Thanks mate

edit: Can you also tell me the data access type for fGetSpawnFromChance please? It's in the advanced tab
 
EDIT:Thanks, got it working, navicat was being a bit buggy when setting parameters. This function is used in my Improved vehicle spawn functions (See signature) :)
 
Back
Top