SA-MP Forums

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

Reply
 
Thread Tools Display Modes
Old 25/04/2016, 03:07 AM   #1
SalmaN97
Big Clucker
 
Join Date: Oct 2013
Posts: 144
Reputation: 15
Default Vehicle color

Hello

i am trying to make a car system so i tried to save car color with yini i searched on samp forums and found some ways to save car color but didnt worked:

method 1:
PHP Code:
public OnVehicleRespray(playeridvehicleidcolor1color2)
{
    
VehicleInfo[vehicleid][vCol1] = color1;
    
VehicleInfo[vehicleid][vCol2] = color2;
    return 
1;

but did not worked the color of car itself was not changing when i entered pay n spray so i tied this code:
PHP Code:
public OnVehicleRespray(playeridvehicleidcolor1color2)
{
    
VehicleInfo[vehicleid][vCol1] = color1;
    
VehicleInfo[vehicleid][vCol2] = color2;
    
ChangeVehicleColor(vehicleidcolor1color2);
    return 
1;

but still same then i tried another method using this include link:
PHP Code:
    new color1color2;
    
GetVehicleColor(Vehicleidcolor1color2
i put the code above in my car saving stock but still didnt work hope you guys will help me.


NOTE: OTHER DATA SAVES LIKE CAR OWNER AND POSITION
SalmaN97 is offline   Reply With Quote
Old 25/04/2016, 06:21 AM   #2
Vince
Spam Machine
 
Vince's Avatar
 
Join Date: Sep 2007
Location: Belgium
Posts: 10,067
Reputation: 2660
Default Re: Vehicle color

That's because OnVehicleRespray is a misleading name since it's not called for Pay 'n' Sprays. It only works in modshops. Pay 'n' Sprays can only be detected with proximity detectors. I believe streamer plugin areas are the most accurate.
__________________
Vince is offline   Reply With Quote
Old 25/04/2016, 07:27 AM   #3
SalmaN97
Big Clucker
 
Join Date: Oct 2013
Posts: 144
Reputation: 15
Default Re: Vehicle color

i have tried in mod shop my car color changes but it does not save in the file
SalmaN97 is offline   Reply With Quote
Old 25/04/2016, 12:04 PM   #4
[KHK]Khalid
Gangsta
 
[KHK]Khalid's Avatar
 
Join Date: Jan 2012
Location: Alexandria, Egypt
Posts: 854
Reputation: 136
Default Re: Vehicle color

Quote:
Originally Posted by SalmaN97 View Post
i have tried in mod shop my car color changes but it does not save in the file
Show us your "car saving stock" code!
[KHK]Khalid is offline   Reply With Quote
Old 25/04/2016, 12:40 PM   #5
ikey07
High-roller
 
ikey07's Avatar
 
Join Date: Jul 2010
Location: Latvia,Riga
Posts: 1,167
Reputation: 180
Default Re: Vehicle color

any chance you have some other script which use OnVehicleRespray and you have return 1; in it ?
__________________
ikey07 is offline   Reply With Quote
Old 26/04/2016, 12:05 AM   #6
SalmaN97
Big Clucker
 
Join Date: Oct 2013
Posts: 144
Reputation: 15
Default Re: Vehicle color

Quote:
Originally Posted by [KHK]Khalid View Post
Show us your "car saving stock" code!
PHP Code:
stock SaveVehicles(id)
{
    new 
file[64];
    
format(filesizeof(file), "Vehicles/%d.ini"id);
    new 
INI:Handle INI_Open(file);
   

    if(
Handle != INI_NO_FILE)
    {
        
INI_WriteString(Handle"VehicleOwner"VehicleInfo[id][vOwner]);
        
INI_WriteInt(Handle"VehicleModel"VehicleInfo[id][vModel]);
        
INI_WriteInt(Handle"VehicleColor1"VehicleInfo[id][vCol1]);
        
INI_WriteInt(Handle"VehicleColor2"VehicleInfo[id][vCol2]);
        
INI_WriteFloat(Handle,"VehPosX"VehicleInfo[id][vPosX]);
        
INI_WriteFloat(Handle,"VehPosY"VehicleInfo[id][vPosY]);
        
INI_WriteFloat(Handle,"VehPosZ"VehicleInfo[id][vPosZ]);
        
INI_WriteFloat(Handle,"VehPosA"VehicleInfo[id][vPosA]);
        
INI_Close(Handle);
    }

Quote:
Originally Posted by ikey07 View Post
any chance you have some other script which use OnVehicleRespray and you have return 1; in it ?
My script is in a filterscript and gamemode is blank i didnt scripted anything inside gamemode and removed the "OnVehicleRespray" part.
SalmaN97 is offline   Reply With Quote
Old 26/04/2016, 01:30 AM   #7
Sew_Sumi
Banned
 
Join Date: Jun 2008
Location: Azerbaijan
Posts: 6,243
Reputation: 525
Default Re: Vehicle color

Quote:
Originally Posted by [KHK]Khalid View Post
Show us your "car saving stock" code!
It's called a function... Nothing else.
Sew_Sumi is offline   Reply With Quote
Old 26/04/2016, 08:09 AM   #8
SalmaN97
Big Clucker
 
Join Date: Oct 2013
Posts: 144
Reputation: 15
Default Re: Vehicle color

i added a message to send when i enter a mod shop and change color:
PHP Code:
public OnVehicleRespray(playeridvehicleidcolor1color2)
{
    
VehicleInfo[vehicleid][vCol1] = color1;
    
VehicleInfo[vehicleid][vCol2] = color2;

    new 
string[128];
    
format(stringsizeof(string), "Your car color 1 is (%d) and color 2 is (%d)"color1color2);
    
SendClientMessageToAll(0xFFFF00FFstring);
    return 
1;

but i dont get the message i think there is a problem with "OnVehicleRespray" itself
SalmaN97 is offline   Reply With Quote
Reply

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
Help Color Vehicle Swans Scripting Help 1 28/09/2015 09:39 AM
Get Player color and change vehicle color to the player color gurmani11 Scripting Help 4 03/07/2015 11:34 AM
[FilterScript] Vehicle Color IDs AustinWeerdGuy Filterscripts 18 20/03/2014 09:10 PM
vehicle color Farid Help Archive 1 26/12/2010 11:02 AM


All times are GMT. The time now is 11:02 AM.


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