[REQUEST] Vehicle doesn't spawn

Neis

New Member
Im getting some troubles with it, executing pMain and it doesnt spawn nothing.

Code:
BEGIN
 
    DECLARE iSpawnNumVeh SMALLINT(3) DEFAULT 25;     
 
    CALL pCleanup();
    CALL pFixMaxNum;
 
    SELECT SUM(MaxNum) FROM object_classes WHERE Chance >= '0.1' INTO @iMaxNumTotal;
    IF (ISNULL(@iMaxNumTotal)) THEN
        SET @iMaxNumTotal = 0;
    END IF;
    IF (iSpawnNumVeh > @iMaxNumTotal) THEN
        SET iSpawnNumVeh = @iMaxNumTotal;
    END IF;
 
    WHILE (fGetVehCount() < iSpawnNumVeh) DO
        CALL pSpawn();
    END WHILE;
 
END
 
Hey Guys use this u will have to add Hit points and inventory fields to object_spawns to use it any problems drop me a message when u run it the error will tell u what the exact field name is

PHP:
BEGIN
 
# maximum number of INSTANCE id's USED.
#-----------------------------------------------
    DECLARE sInstance VARCHAR(8) DEFAULT 1;
#-----------------------------------------------
#maximum number of vehicles allowed !!! theoretical max. amount
#-----------------------------------------------
    DECLARE iVehSpawnMax INT DEFAULT 1000;
#-----------------------------------------------   
 
# DECLARE iVehSpawnMin                INT DEFAULT 0;        #ToDo !!!
    DECLARE iTimeoutMax                INT DEFAULT 250;    #number of loops before timeout
    DECLARE iTimeout                        INT DEFAULT 0;        #internal counter for loops done; used to prevent infinite loops - DO NOT CHANGE
    DECLARE iNumVehExisting        INT DEFAULT 0;        #internal counter for already existing vehicles - DO NOT CHANGE
    DECLARE iNumClassExisting    INT DEFAULT 0;        #internal counter for already existing class types - DO NOT CHANGE
    DECLARE i INT DEFAULT 1; #internal counter for vehicles spawns - DO NOT CHANGE
 
#Starts Cleanup
    CALL pCleanup();
   
        SELECT COUNT(*)                #retrieve the amount of already spawned vehicles...
            INTO iNumVehExisting
            FROM object_data
            WHERE Instance = sInstance
            AND Classname != '-'                        #exclude dummys
            AND Classname != 'Hedgehog_DZ'            #exclude hedgehog
            AND Classname != 'Wire_cat1'                #exclude wirecat
            AND Classname != 'Sandbag1_DZ'            #exclude Sanbag
            AND Classname != 'TrapBear'            #exclude trap
            AND Classname != 'TentStorage';        #exclude TentStorage
 
        WHILE (iNumVehExisting < iVehSpawnMax) DO        #loop until maximum amount of vehicles is reached
 
            #select a random vehicle class
            SELECT Classname, Chance, MaxNum, Damage
                INTO @rsClassname, @rsChance, @rsMaxNum, @rsDamage
                FROM object_classes ORDER BY RAND() LIMIT 1;
 
            #count number of same class already spawned
            SELECT COUNT(*)
                INTO iNumClassExisting
                FROM object_data
                WHERE Instance = sInstance
                AND Classname = @rsClassname;
 
            IF (iNumClassExisting < @rsMaxNum) THEN
 
                IF (rndspawn(@rschance) = 1) THEN
               
                    INSERT INTO object_data (ObjectUID, Instance, Classname, Damage, CharacterID, Worldspace, Inventory, Hitpoints, Fuel, Datestamp)
                        SELECT ObjectUID, sInstance, Classname, RAND(@rsDamage), '0', Worldspace, Inventory, Hitpoints, RAND(1), SYSDATE()
                            FROM object_spawns
                            WHERE Classname = @rsClassname
                                AND NOT ObjectUID IN (select objectuid from object_data where instance = sInstance)
                            ORDER BY RAND()
                            LIMIT 0, 1;
                           
                    SELECT COUNT(*)
                        INTO iNumVehExisting
                        FROM object_data
                        WHERE Instance = sInstance
                            AND Classname != '-'                        #exclude dummys
                            AND Classname != 'Hedgehog_DZ'            #exclude hedgehog
                            AND Classname != 'Wire_cat1'                #exclude wirecat
                            AND Classname != 'Sandbag1_DZ'            #exclude Sanbag
                            AND Classname != 'TrapBear'            #exclude trap
                            AND Classname != 'TentStorage';        #exclude TentStorage
       
                    #update number of same class already spawned
                    SELECT COUNT(*)
                        INTO iNumClassExisting
                        FROM object_data
                        WHERE Instance = sInstance
                        AND Classname = @rsClassname;
               
                END IF;
            END IF;   
           
            SET iTimeout = iTimeout + 1; #raise timeout counter
            IF (iTimeout >= iTimeoutMax) THEN
                SET iNumVehExisting = iVehSpawnMax;
            END IF;
        END WHILE;
    SET i = i + 1;
END
 


Code:
# maximum number of INSTANCE id's USED.
#-----------------------------------------------
    DECLARE sInstance VARCHAR(8) DEFAULT 1;
[Err] 1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'DECLARE sInstance VARCHAR(8) DEFAULT 1' at line 5
Does not work.
 
Back
Top