SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help > Help Archive

 
 
Thread Tools Display Modes
Old 20/02/2009, 10:44 AM   #1
walrus
Little Clucker
 
Join Date: Feb 2009
Posts: 26
Reputation: 0
Default Apply Car Damage & Car locations script questions

Hello Can i ask? How to apply damage to car without driver? I mean, door, hud colisions on hit and so on. And secon question, is there any very nice car location script, where will be all cars placed nicely, in many locations and so on... I would aprecate you help
walrus is offline  
Old 20/02/2009, 10:46 AM   #2
Donny_k
Gangsta
 
Donny_k's Avatar
 
Join Date: May 2006
Posts: 788
Reputation: 4
Default Re: Apply Car Damage & Car locations script questions

Vehicle damage isn't synced when it's not being driven and to get locations of vehicles just look inside your scriptfiles folder at the vehicle lists text files or download a gamemode and look in there etc.
__________________
We don't stop playing because we grow old, we grow old because we stop playing.
Donny_k is offline  
Old 20/02/2009, 10:50 AM   #3
walrus
Little Clucker
 
Join Date: Feb 2009
Posts: 26
Reputation: 0
Default Re: Apply Car Damage & Car locations script questions

How to synce then? Is it possible? That would be awsome
walrus is offline  
Old 20/02/2009, 10:52 AM   #4
ReFuSeR
Big Clucker
 
Join Date: Apr 2008
Posts: 76
Reputation: 2
Default Re: Apply Car Damage & Car locations script questions

[me=ReFuSeR]smashes palm into face.[/me]

No... It isn't possible

and I believe there is a script like that... Just search. If there isn't then you need to look in other gamemodes for them. You can also make them yourself
__________________
Sprunk Guard Detection: Click this
ReFuSeR is offline  
Old 20/02/2009, 10:59 AM   #5
walrus
Little Clucker
 
Join Date: Feb 2009
Posts: 26
Reputation: 0
Default Re: Apply Car Damage & Car locations script questions

Hmmm, i just tested load vechiles_list, but no cars have been loaded. What is wrong here?
Code:
#include <a_samp>
#include <file>

#define COLOR_YELLOW 0xFFFF00AA
#define COLOR_WHITE 0xFFFFFFAA

new total_vehicles_from_files=0;

main()
{
	print( " " );
	print( " [================================] "	);
	print( " | GTA San Andreas Virtual Life | "	);
	print( " | ---------------------------- | "	);
	print( " |  By Martynas aka Walrus  | "	);
	print( " | ---------------------------- | "	);
	print( " |    Version 1.00    | "	);
	print( " [================================] "	);
	print( " " );
}

public OnGameModeInit()
{
	SetGameModeText("San Andreas Virtual Life");
	AddPlayerClass(103, 747.384, -525.5044, 15, 0, 0, 50000, 38, 50000, 32, 50000);
	total_vehicles_from_files += LoadStaticVehiclesFromFile("vehiclelists/red_country.txt");
	return 1;
}

LoadStaticVehiclesFromFile(const filename[])
{
	new File:file_ptr;
	new line[256];
	new var_from_line[64];
	new vehicletype;
	new Float:SpawnX;
	new Float:SpawnY;
	new Float:SpawnZ;
	new Float:SpawnRot;
	new Color1, Color2;
	new index;
	new vehicles_loaded;

	file_ptr = fopen(filename,filemode:io_read);
	if(!file_ptr) return 0;

	vehicles_loaded = 0;

	while(fread(file_ptr,line,256) > 0)
	{
	  index = 0;

	  // Read type
 		index = token_by_delim(line,var_from_line,',',index);
 		if(index == (-1)) continue;
 		vehicletype = strval(var_from_line);
 		if(vehicletype < 400 || vehicletype > 611) continue;

 		// Read X, Y, Z, Rotation
 		index = token_by_delim(line,var_from_line,',',index+1);
 		if(index == (-1)) continue;
 		SpawnX = floatstr(var_from_line);

 		index = token_by_delim(line,var_from_line,',',index+1);
 		if(index == (-1)) continue;
 		SpawnY = floatstr(var_from_line);

 		index = token_by_delim(line,var_from_line,',',index+1);
 		if(index == (-1)) continue;
 		SpawnZ = floatstr(var_from_line);

 		index = token_by_delim(line,var_from_line,',',index+1);
 		if(index == (-1)) continue;
 		SpawnRot = floatstr(var_from_line);

 		// Read Color1, Color2
 		index = token_by_delim(line,var_from_line,',',index+1);
 		if(index == (-1)) continue;
 		Color1 = strval(var_from_line);

 		index = token_by_delim(line,var_from_line,';',index+1);
 		Color2 = strval(var_from_line);

 		//printf("%d|%f|%f|%f|%f|%d|%d",vehicletype,
 		  //SpawnX,SpawnY,SpawnZ,SpawnRot,Color1,Color2);

		AddStaticVehicleEx(vehicletype,SpawnX,SpawnY,SpawnZ,SpawnRot,Color1,Color2,-1);

		vehicles_loaded++;
	}

	fclose(file_ptr);
	printf("Loaded %d vehicles from: %s",vehicles_loaded,filename);
	return vehicles_loaded;
}


// Tokenise by a delimiter
// Return string and index of the end determined by the
// provided delimiter in delim
token_by_delim(const string[], return_str[], delim, start_index)
{
	new x=0;
	while(string[start_index] != EOS && string[start_index] != delim) {
	  return_str[x] = string[start_index];
	  x++;
	  start_index++;
	}
	return_str[x] = EOS;
	if(string[start_index] == EOS) start_index = (-1);
	return start_index;
}
walrus is offline  
 

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
All my newbie script questions. Sal_Kings Help Archive 18 10/11/2009 05:03 PM
Apply the new script without a restart Jakku Server Support 2 29/10/2009 08:00 PM
Mysql Questions... Integrating with a script... Ace_Steele Help Archive 1 04/08/2009 11:10 AM


All times are GMT. The time now is 12:56 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.