Dcmd and Dini problem.
#1

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

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

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);
}
Reply
#4

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

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
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)