PDA

View Full Version : Help Me Please its urgent


javedali1211
11/07/2016, 06:13 AM
Hello Everyone i have vehicle ownership system on my gamemode but its like when a player joins the server then it loads player vehicles and when player left the server then his owned vehicles disappears i want to make it when server starts it loads all the player vehicles here is the code please help me for this i really need to fix this please

stock LoadPlayerVehicles(playerid)
{
GetPlayerVehicles{playerid} = 0;
verifydestroycar{playerid} = 0;
new vehcount = 0;
for(new v = 0; v < MAX_SHOP_VEHICLES; v++)
{
new file[40];
format(file, sizeof(file), VEH_FILE, v);
if(fexist(file))
{
INI_ParseFile(file, "LoadVeh_%s", .bExtra = true, .extra = v);

if(!strcmp(GetName(playerid), VehicleInfo[v][vOwner], false))
{
new newveh = CreateVehicle(VehicleInfo[v][vModel], VehicleInfo[v][vPosX], VehicleInfo[v][vPosY], VehicleInfo[v][vPosZ], VehicleInfo[v][vPosA], VehicleInfo[v][vColor1], VehicleInfo[v][vColor2], 500000);
SetVehicleNumberPlate(newveh, VehicleInfo[v][vPlate]);
if(VehicleInfo[v][vPaintJob] != 0)
{
ChangeVehiclePaintjob(newveh, VehicleInfo[v][vPaintJob]);
}

if(VehicleInfo[v][vHealth] <= 251.0)
{
SetVehicleHealth(newveh, 1000.0);
VehicleInfo[v][vHealth] = 1000.0;
}
else
{
SetVehicleHealth(newveh, VehicleInfo[v][vHealth]);
}

for(new m = 0; m < 12; m++)
{
if(GetVehicleMods[v][m] > 0)
{
AddVehicleComponent(newveh, GetVehicleMods[v][m]);
}
}

if(VehicleInfo[v][vLocked] == 1)
{
SetVehicleParamsForAll(newveh, 0, 1);
GetVehicleParamsEx(newveh, engine, lights, alarm, doors, bonnet, boot, condition);
SetVehicleParamsEx(newveh, engine, lights, alarm, ON, bonnet, boot, condition);
}
else if(VehicleInfo[v][vLocked] == 0)
{
SetVehicleParamsForAll(newveh, 0, 0);
GetVehicleParamsEx(newveh, engine, lights, alarm, doors, bonnet, boot, condition);
SetVehicleParamsEx(newveh, engine, lights, alarm, OFF, bonnet, boot, condition);
}

if(VehicleInfo[v][vNeons] != NO_NEONS && VehicleInfo[v][vNeons] == BLUE_NEONS)
{
blueneons[newveh] = CreateObject(18648,0,0,0,0,0,0);
blueneons2[newveh] = CreateObject(18648,0,0,0,0,0,0);
AttachObjectToVehicle(blueneons[newveh], newveh, -0.8, 0.0, -0.70, 0.0, 0.0, 0.0);
AttachObjectToVehicle(blueneons2[newveh], newveh, 0.8, 0.0, -0.70, 0.0, 0.0, 0.0);
}
else if(VehicleInfo[v][vNeons] != NO_NEONS && VehicleInfo[v][vNeons] == RED_NEONS)
{
redneons[newveh] = CreateObject(18647,0,0,0,0,0,0);
redneons2[newveh] = CreateObject(18647,0,0,0,0,0,0);
AttachObjectToVehicle(redneons[newveh], newveh, -0.8, 0.0, -0.70, 0.0, 0.0, 0.0);
AttachObjectToVehicle(redneons2[newveh], newveh, 0.8, 0.0, -0.70, 0.0, 0.0, 0.0);
}
else if(VehicleInfo[v][vNeons] != NO_NEONS && VehicleInfo[v][vNeons] == GREEN_NEONS)
{
greenneons[newveh] = CreateObject(18649,0,0,0,0,0,0);
greenneons2[newveh] = CreateObject(18649,0,0,0,0,0,0);
AttachObjectToVehicle(greenneons[newveh], newveh, -0.8, 0.0, -0.70, 0.0, 0.0, 0.0);
AttachObjectToVehicle(greenneons2[newveh], newveh, 0.8, 0.0, -0.70, 0.0, 0.0, 0.0);
}
else if(VehicleInfo[v][vNeons] != NO_NEONS && VehicleInfo[v][vNeons] == YELLOW_NEONS)
{
yellowneons[newveh] = CreateObject(18650,0,0,0,0,0,0);
yellowneons2[newveh] = CreateObject(18650,0,0,0,0,0,0);
AttachObjectToVehicle(yellowneons[newveh], newveh, -0.8, 0.0, -0.70, 0.0, 0.0, 0.0);
AttachObjectToVehicle(yellowneons2[newveh], newveh, 0.8, 0.0, -0.70, 0.0, 0.0, 0.0);
}
else if(VehicleInfo[v][vNeons] != NO_NEONS && VehicleInfo[v][vNeons] == PINK_NEONS)
{
pinkneons[newveh] = CreateObject(18651,0,0,0,0,0,0);
pinkneons2[newveh] = CreateObject(18651,0,0,0,0,0,0);
AttachObjectToVehicle(pinkneons[newveh], newveh, -0.8, 0.0, -0.70, 0.0, 0.0, 0.0);
AttachObjectToVehicle(pinkneons2[newveh], newveh, 0.8, 0.0, -0.70, 0.0, 0.0, 0.0);
}

IsShopVehicle[newveh] = v;
GetPlayerVehicles{playerid}++;
GetServerVehicles++;

GetVehicleFuel[newveh] = VehicleInfo[v][vFuel];
GetVehicleCurrentHealth[newveh] = VehicleInfo[v][vHealth];

vehcount++;

if(vehcount == MAX_VIP_VEHS)
{
return 1;
}
}
}
}
return 1;
}

stock UnloadPlayerVehicles(playerid)
{
new vehcount = 0;
for(new v = 0; v < MAX_VEHICLES; v++)
{
if(IsShopVehicle[v] != -1)
{
if(!strcmp(GetName(playerid), VehicleInfo[IsShopVehicle[v]][vOwner], false))
{
new color1, color2;
if(GetVehicleColor(v, color1, color2))
{
VehicleInfo[IsShopVehicle[v]][vColor1] = color1;
VehicleInfo[IsShopVehicle[v]][vColor2] = color2;
}
new Float:health;
GetVehicleHealth(v, health);
VehicleInfo[IsShopVehicle[v]][vHealth] = health;
SaveVehicleStats(IsShopVehicle[v]);
DestroyNeons(v);
DestroyVehicle(v);
GetPlayerVehicles{playerid}--;
GetServerVehicles--;
IsShopVehicle[v] = -1;

vehcount++;

if(vehcount == MAX_VIP_VEHS)
{
return 1;
}
}
}
}
return 1;
}

public OnPlayerDisconnect(playerid, reason)
{
UnloadPlayerVehicles(playerid);
}

public OnPlayerConnect(playerid)
{

LoadPlayerVehicles(playerid);
}


thats the my vehicle ownership system so please game it OnGameModeInit it will load player vehicles please help me on this

Napst34
11/07/2016, 06:25 AM
Why this : DestroyVehicle(v); ?

javedali1211
11/07/2016, 06:38 AM
Why this : DestroyVehicle(v); ?

this is what i said if player leaves the server his owned vehicles disappears i want to make this whole code in OnGameModeInit if server starts it loads the player vehicles i tried it many times by myself but it didn't worked so i asked for a help please any scripter fix it for me make it when server starts it loads player vehicle

javedali1211
11/07/2016, 11:34 AM
anyone?

javedali1211
12/07/2016, 12:50 PM
dump

minijackc
12/07/2016, 01:58 PM
under OnGameModeInit

LoadPlayerVehicles();

Jonesy96
12/07/2016, 02:00 PM
DELETED

javedali1211
12/07/2016, 05:09 PM
under OnGameModeInit

LoadPlayerVehicles();

C:\Users\Hp\Desktop\CNR\gamemodes\CnR.pwn(12026) : warning 202: number of arguments does not match definition

Parallex
12/07/2016, 05:12 PM
Please, in future, try to create topics with better and helpful titles. It's for the best for us and you.

javedali1211
12/07/2016, 05:16 PM
Please, in future, try to create topics with better and helpful titles. It's for the best for us and you.

i have showed everything and everything is clear but everyone ignored it still waiting for a person who can fix it for me

Parallex
12/07/2016, 05:18 PM
i have showed everything and everything is clear but everyone ignored it still waiting for a person who can fix it for me

I just told you that it would be better if in the topic title, you would include more useful information rather than "help me".