Vehicle color
#1

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
Reply
#2

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.
Reply
#3

i have tried in mod shop my car color changes but it does not save in the file
Reply
#4

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!
Reply
#5

any chance you have some other script which use OnVehicleRespray and you have return 1; in it ?
Reply
#6

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.
Reply
#7

Quote:
Originally Posted by [KHK]Khalid
View Post
Show us your "car saving stock" code!
It's called a function... Nothing else.
Reply
#8

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
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)