SA-MP Forums Archive
Dcmd and Dini problem. - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Dcmd and Dini problem. (/showthread.php?tid=396201)



Dcmd and Dini problem. - 9903286 - 29.11.2012

I'm trying to create some kind of car system, and the /savecar and stuff works completely, but when i use
/loadcar nothing happens. The only error i get are this one:
Код:
C:\Users\9903286\Dropbox\Server\gamemodes\gamemode.pwn(9296) : warning 217: loose indentation
These are the only codes involved in this problem:
Код:
dcmd_loadcar(playerid, params[])
{
	#pragma unused params
	new modelid, color1, color2;
	LoadPlayerCar(playerid, modelid, color1, color2);
	    new Float:pX, Float:pY, Float:pZ, Float:pAng;
     	GetPlayerPos(playerid, pX, pY, pZ);
	    GetPlayerFacingAngle(playerid, pAng);
		CreateVehicle(modelid, pX, pY, pZ, pAng, color1, color2, -1);
	return 1;
}
Код:
stock LoadPlayerCar(playerid, modelid, color1, color2)
{
	new file[256], name[MAX_PLAYER_NAME];
	GetPlayerName(playerid, name, sizeof(name));
	format(file, sizeof(file), "%s.car", name);
	modelid = dini_Int(file, "Carmodel");
	color1 = dini_Int(file, "Color1");
	color2 = dini_Int(file, "Color2");
	return modelid, color1, color2;
}



Re: Dcmd and Dini problem. - tyler12 - 29.11.2012

pawn Код:
dcmd_loadcar(playerid, params[])
{
    #pragma unused params
    new modelid, color1, color2;
    LoadPlayerCar(playerid, modelid, color1, color2);
    new Float:pX, Float:pY, Float:pZ, Float:pAng;
    GetPlayerPos(playerid, pX, pY, pZ);
    GetPlayerFacingAngle(playerid, pAng);
    CreateVehicle(modelid, pX, pY, pZ, pAng, color1, color2, -1);
    return 1;
}

stock LoadPlayerCar(playerid, modelid, color1, color2)
{
    new file[256], name[MAX_PLAYER_NAME];
    GetPlayerName(playerid, name, sizeof(name));
    format(file, sizeof(file), "%s.car", name);
    modelid = dini_Int(file, "Carmodel");
    color1 = dini_Int(file, "Color1");
    color2 = dini_Int(file, "Color2");
    return modelid, color1, color2;
}
Show a .car file. Also, show how you create them.


Re: Dcmd and Dini problem. - 9903286 - 29.11.2012

Quote:
Originally Posted by tyler12
Посмотреть сообщение
pawn Код:
dcmd_loadcar(playerid, params[])
{
    #pragma unused params
    new modelid, color1, color2;
    LoadPlayerCar(playerid, modelid, color1, color2);
    new Float:pX, Float:pY, Float:pZ, Float:pAng;
    GetPlayerPos(playerid, pX, pY, pZ);
    GetPlayerFacingAngle(playerid, pAng);
    CreateVehicle(modelid, pX, pY, pZ, pAng, color1, color2, -1);
    return 1;
}

stock LoadPlayerCar(playerid, modelid, color1, color2)
{
    new file[256], name[MAX_PLAYER_NAME];
    GetPlayerName(playerid, name, sizeof(name));
    format(file, sizeof(file), "%s.car", name);
    modelid = dini_Int(file, "Carmodel");
    color1 = dini_Int(file, "Color1");
    color2 = dini_Int(file, "Color2");
    return modelid, color1, color2;
}
Show a .car file. Also, show how you create them.
.car file:
Код:
Carmodel=562
Color1=60
Color2=60
NOTICE: I've already been ingame and saved a cars id.

How i create them:
Код:
new file2[256];
format(file2, sizeof(file), "%s.car", name);
if(!fexist(file2))
{
dini_Create(file2);

dini_IntSet(file2, "Carmodel", 0);
dini_IntSet(file2, "Color1", 0);
dini_IntSet(file2, "Color2", 0);
}



Re: Dcmd and Dini problem. - tyler12 - 29.11.2012

PHP код:
stock LoadPlayerCar(playerid, &modelid, &color1, &color2)
{
    new 
file[256], name[MAX_PLAYER_NAME];
    
GetPlayerName(playeridnamesizeof(name));
    
format(filesizeof(file), "%s.car"name);
    
modelid dini_Int(file"Carmodel");
    
color1 dini_Int(file"Color1");
    
color2 dini_Int(file"Color2");
    return 
modelidcolor1color2;

stock LoadPlayerCar(playerid, &modelid, &color1, &color2)
{
new file[256], name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
format(file, sizeof(file), "%s.car", name);
modelid = dini_Int(file, "Carmodel");
color1 = dini_Int(file, "Color1");
color2 = dini_Int(file, "Color2");
return modelid, color1, color2;
}[/php]


Re: Dcmd and Dini problem. - 9903286 - 29.11.2012

Quote:
Originally Posted by tyler12
Посмотреть сообщение
PHP код:
stock LoadPlayerCar(playerid, &modelid, &color1, &color2)
{
    new 
file[256], name[MAX_PLAYER_NAME];
    
GetPlayerName(playeridnamesizeof(name));
    
format(filesizeof(file), "%s.car"name);
    
modelid dini_Int(file"Carmodel");
    
color1 dini_Int(file"Color1");
    
color2 dini_Int(file"Color2");
    return 
modelidcolor1color2;

stock LoadPlayerCar(playerid, &modelid, &color1, &color2)
{
new file[256], name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
format(file, sizeof(file), "%s.car", name);
modelid = dini_Int(file, "Carmodel");
color1 = dini_Int(file, "Color1");
color2 = dini_Int(file, "Color2");
return modelid, color1, color2;
}[/php]
.. Thanks, it works now. :P