SA-MP Forums

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

 
 
Thread Tools Display Modes
Old 25/04/2009, 03:16 AM   #1
Mike-Chip
Little Clucker
 
Join Date: Apr 2009
Posts: 29
Reputation: 0
Default car export - problem

Hi all,
i'm trying to make a function that when a player export a vehicle and the vehicle is damaged the money will be decreased according to the damage. But the following code doesn't work properly... dunno why, seems fine...
Code:
public SellExportVehicle(playerid)
{
	new string[256], i;
	new Float:vhealth;
	new GetVHealth = GetVehicleHealth(GetPlayerVehicleID(playerid), vhealth);
	new VHealthLost = (GetVHealth - 1000);
	new FirstValue = (ExportPayment / 1000);
	new SecondValue = (FirstValue * VHealthLost);
	new EndValue = (ExportPayment - SecondValue);
	
	for(i=0; i<MAX_EXPORTVEHICLES; i++) {
		if(ExportVehicles[i]==ExportVehicle) {
			wantedVehicle = i;
			break;
		}
	}
	if(wantedVehicle>=0)
	{
		if(IsPlayerInAnyVehicle(playerid))
		{
			if( GetVehicleModel( GetPlayerVehicleID(playerid) ) == ExportVehicle )
			{
				if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
				{
						format(string, sizeof(string), "Excellent, we will export your %s at once! Here is $%d for your services.", ExportVehicleNames[i], EndValue);
						SendClientMessage(playerid, COLOR_GREEN, string);
						format(string, sizeof(string), "%s has exported a %s, and earned $%d! ", pName(playerid), ExportVehicleNames[i], EndValue);
						SendClientMessageToAll(COLOR_GREEN, string);
						format(string, sizeof(string), "$%d", EndValue);
						GameTextForPlayer(playerid, string, 4000,3);
						GivePlayerPCash(playerid, EndValue);
						PlayerPlaySound(playerid, 1057, 0.0, 0.0, 0.0);
						EndExports();
						return SetVehicleToRespawn(GetPlayerVehicleID(playerid));
				}
			} else return SendClientMessage(playerid, COLOR_YELLOW, "We aren't buying this vehicle at the time!");
  		}
  		else format(string, sizeof(string), "We are currently buying %s's for export.", ExportVehicleNames[i]);
		return SendClientMessage(playerid, COLOR_ORANGE, string);
	} else return SendClientMessage(playerid, COLOR_YELLOW, "We aren't buying any vehicle at the time!");
}
Thanks in Advance!
Mike-Chip is offline  
Old 25/04/2009, 04:58 AM   #2
Nubotron
Big Clucker
 
Join Date: Jan 2008
Posts: 156
Reputation: 0
Default Re: car export - problem

http://forum.sa-mp.com/index.php?topic=95452 and there is some scripting errors in your code
Nubotron is offline  
Old 25/04/2009, 05:27 AM   #3
Mike-Chip
Little Clucker
 
Join Date: Apr 2009
Posts: 29
Reputation: 0
Default Re: car export - problem

Thanks man, but it gets a warning message:
ah... ExportPayment = (random(10)+10)*1000;

Code:
Line 3220: new Float:VHealth;
Line 3221: GetVehicleHealth(GetPlayerVehicleID(playerid),VHealth);
Line 3222: new FinalValue = ( ExportPayment * ( VHealth / 1000 ) );
Code:
D:/GTASAN~1/GTASAM~1/GAMEMO~1/lswars.pwn(3222) : warning 213: tag mismatch
Mike-Chip is offline  
Old 25/04/2009, 05:30 AM   #4
Joe Staff
High-roller
 
Joe Staff's Avatar
 
Join Date: Aug 2007
Posts: 2,578
Reputation: 378
Default Re: car export - problem

You need to turn the Float value 'vHealth' into an integer I think round(Float:float) does that not sure.
__________________
Big bottom girls make this rockin' world go 'round.
Joe Staff is offline  
Old 25/04/2009, 05:38 AM   #5
Mike-Chip
Little Clucker
 
Join Date: Apr 2009
Posts: 29
Reputation: 0
Default Re: car export - problem

but how I do that ?
Mike-Chip is offline  
Old 25/04/2009, 06:03 AM   #6
Nubotron
Big Clucker
 
Join Date: Jan 2008
Posts: 156
Reputation: 0
Default Re: car export - problem

new FinalValue = floatround( ExportPayment * ( VHealth / 1000 ) );
Nubotron is offline  
Old 25/04/2009, 12:20 PM   #7
Mike-Chip
Little Clucker
 
Join Date: Apr 2009
Posts: 29
Reputation: 0
Default Re: car export - problem

Thanks man, worked like a charm :P
Mike-Chip 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
[FilterScript] [FS]Car export [UPDATED] Mikep Filterscripts 53 01/09/2010 09:25 AM
pls Help by Export Car Wolverin Help Archive 0 20/03/2010 01:57 PM
Car export doesn't work on 0.3 Black Souls Help Archive 5 22/09/2009 07:34 PM


All times are GMT. The time now is 05:34 AM.


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