SA-MP Forums Archive
Spawning more cars that I actual want - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Spawning more cars that I actual want (/showthread.php?tid=587599)



Spawning more cars that I actual want - JessThompson - 01.09.2015

Some reason my code is spawning more cars than just one can you please help me.


Here is my code

Код:
  			if(listitem == 0) // Bikes
  		    {
 				new FirstCar[10];
				format(FirstCar, sizeof(FirstCar), "%i", DSbikes[0][DSCarModel]);
				new spawnedcar = CreateVehicle(strval(FirstCar), 488.0754, -420.3091, 2757.9961, 358.6074, 1, 1, 3600);
				PutPlayerInVehicle(playerid, spawnedcar, 0);
				TogglePlayerControllable(playerid,0);
				if(prc_Moving[playerid] == false) // Check whether the camera is already set.
				{
					prc_Degree[playerid] = 0; // Reseting the variable
					prc_Timer[playerid] = SetTimerEx("MoveCamera", 75, true, "d", playerid); // Setting the timer
					prc_Moving[playerid] = true; // okay, now we're going to activate the moving variable
				}
			}



Re: Spawning more cars that I actual want - khRamin78 - 01.09.2015

maybe you use 2x times that dialogid ? maybe


Re: Spawning more cars that I actual want - MarvinPWN - 01.09.2015

PHP код:
if(listitem == 0)// Bike
{
    new 
FirstCar[10];
    
format(FirstCar,sizeof FirstCar,"%i",DSbikes[0][DSCarModel]);
    new 
spawnedcar CreateVehicle(strval(FirstCar),488.0754, -420.30912757.9961358.6074113600);
    
PutPlayerInVehicle(playerid,spawnedcar,0);
    
TogglePlayerControllable(playerid,0);
    if(
prc_Moving[playerid] == false)// Check whether the camera is already set.
    
{
        
prc_Degree[playerid] = 0;// Reseting the variable
        
prc_Timer[playerid] = SetTimerEx("MoveCamera",75,true,"d",playerid);// Setting the timer
        
prc_Moving[playerid] = true;// okay, now we're going to activate the moving variable
    
}
    return 
1;

Maybe the return will help that only one car will spawn.


Re: Spawning more cars that I actual want - khRamin78 - 01.09.2015

-Removed-