help with command -
Im_BanK - 18.05.2011
hy there.
I wonder if is possible to create a command like /say text1 text2 with 2 different colors?
Like /say dude(text1) your doomed(text2)
it is possible? and how?
Can someone show me an example?
Re: help with command -
Im_BanK - 18.05.2011
NVM...
now i have a problem trying to save the License Plate but i get:
pawn Код:
error 006: must be assigned to an array
The command is like this:
pawn Код:
if(dialogid == 999)
{
if(response)
{
new vehicleid, Float:XX,Float:YY,Float:ZZ;
new plate = strlen(inputtext);
new string[128], Float:CarHP, Float:OldCarHP
if(plate < 4) return ShowPlayerDialog(playerid, 999, DIALOG_STYLE_INPUT, "Plate", "Numarul de inmatriculare trebuie sa aibe minim 4 caractere.\n\nIncearca din nou.", "Ok", "Cancel");
if(plate > 14) return ShowPlayerDialog(playerid, 999, DIALOG_STYLE_INPUT, "Plate", "Numarul de inmatriculare nu trebuie sa depaseasca 14 caractere.\n\nIncearca din nou.", "Ok", "Cancel");
vehicleid = GetPlayerVehicleID(playerid);
GetVehicleHealth(vehicleid, CarHP);
OldCarHP = CarHP;
SetVehicleNumberPlate(vehicleid,inputtext);
GetVehiclePos(vehicleid,XX,YY,ZZ);
SetVehicleToRespawn(vehicleid);
SetVehiclePos(vehicleid,XX,YY,ZZ);
PutPlayerInVehicle(playerid,vehicleid,0);
SetVehicleHealth(vehicleid, OldCarHP);
new license[256];
format(license, sizeof(license), "%s", inputtext);
CarInfo[vehicleid][cLicense] = license;
format(string, sizeof(string), "{FFFF00}You have set your vehicle's plate to:{FFFFFF} %s", inputtext);
SendClientMessage(playerid, 0xFFFFFFFF, string);
}
return 1;
}
How can i fix this?
Re: help with command -
MadeMan - 18.05.2011
CarInfo enum
pawn Код:
format(CarInfo[vehicleid][cLicense], 32, "%s", inputtext);
Re: help with command -
Im_BanK - 19.05.2011
it works now.
It saving but now when im restarting the server is not loading.
what command should i use and where to place it.
Re: help with command -
MadeMan - 19.05.2011
Where you save/load other CarInfo data.
Re: help with command -
Im_BanK - 19.05.2011
what do you mean?
the plate is saving inside the cars.cfg but when i restart the server it won't load.
after i restarted the server i have opened the cars.cfg and the plate is still there.
i don't know what to write inside the script to load the plate inside the cars.cfg and where to place it.
Re: help with command -
MadeMan - 19.05.2011
Find the places in your script that use cars.cfg
Re: help with command -
Vince - 19.05.2011
Remember to use SetVehicleToRespawn after you've set a vehicle's number plate.
Re: help with command -
Im_BanK - 19.05.2011
you don't understand me.
inside the cars.cfg is fine it's saves.
it works if i /v park it /roc but when i restart the server
it wont load back. but inside the cars.cfg it still there the plate name (Im_BanK)
i think i need to put this:
at on playerconnect / ongmamemodeinit or something.
i don't know how to implement the cLicense inside that.
like i sad it works fine untill the server is restarted.
CODE:
pawn Код:
public LoadCar()
{
new arrCoords[31][64];
new strFromFile2[256];
new File: file = fopen("cars.cfg", io_read);
if (file)
{
new idx = 184;
while (idx < sizeof(CarInfo))
{
fread(file, strFromFile2);
split(strFromFile2, arrCoords, ',');
CarInfo[idx][cModel] = strval(arrCoords[0]);
CarInfo[idx][cLocationx] = floatstr(arrCoords[1]);
CarInfo[idx][cLocationy] = floatstr(arrCoords[2]);
CarInfo[idx][cLocationz] = floatstr(arrCoords[3]);
CarInfo[idx][cAngle] = floatstr(arrCoords[4]);
CarInfo[idx][cColorOne] = strval(arrCoords[5]);
CarInfo[idx][cColorTwo] = strval(arrCoords[6]);
strmid(CarInfo[idx][cOwner], arrCoords[7], 0, strlen(arrCoords[7]), 255);
strmid(CarInfo[idx][cDescription], arrCoords[8], 0, strlen(arrCoords[8]), 255);
CarInfo[idx][cValue] = strval(arrCoords[9]);
CarInfo[idx][cLicense] = strval(arrCoords[10]);
CarInfo[idx][cOwned] = strval(arrCoords[11]);
CarInfo[idx][cLock] = strval(arrCoords[12]);
CarInfo[idx][mod1] = strval(arrCoords[13]);
CarInfo[idx][mod2] = strval(arrCoords[14]);
CarInfo[idx][mod3] = strval(arrCoords[15]);
CarInfo[idx][mod4] = strval(arrCoords[16]);
CarInfo[idx][mod5] = strval(arrCoords[17]);
CarInfo[idx][mod6] = strval(arrCoords[18]);
CarInfo[idx][mod7] = strval(arrCoords[19]);
CarInfo[idx][mod8] = strval(arrCoords[20]);
CarInfo[idx][mod9] = strval(arrCoords[21]);
CarInfo[idx][mod10] = strval(arrCoords[22]);
CarInfo[idx][mod11] = strval(arrCoords[23]);
CarInfo[idx][mod12] = strval(arrCoords[24]);
CarInfo[idx][mod13] = strval(arrCoords[25]);
CarInfo[idx][mod14] = strval(arrCoords[26]);
CarInfo[idx][mod15] = strval(arrCoords[27]);
CarInfo[idx][mod16] = strval(arrCoords[28]);
CarInfo[idx][mod17] = strval(arrCoords[29]);
CarInfo[idx][paintjob] = strval(arrCoords[30]);
idx++;
}
}
return 1;
}
public SaveCarCoords()
{
new idx;
new File: file2;
while (idx < sizeof(CarInfo))
{
new coordsstring[256];
format(coordsstring, sizeof(coordsstring), "%d|%f|%f|%f|%f|%d|%d|%d|%d|%d|%d|%d|%d|%d|%d|%d|%d|%d|%d|%d|%d|%d|%d|%d|%d\n",
CarInfo[idx][cModel],
CarInfo[idx][cLocationx],
CarInfo[idx][cLocationy],
CarInfo[idx][cLocationz],
CarInfo[idx][cAngle],
CarInfo[idx][cColorOne],
CarInfo[idx][cColorTwo],
CarInfo[idx][mod1],
CarInfo[idx][mod2],
CarInfo[idx][mod3],
CarInfo[idx][mod4],
CarInfo[idx][mod5],
CarInfo[idx][mod6],
CarInfo[idx][mod7],
CarInfo[idx][mod8],
CarInfo[idx][mod9],
CarInfo[idx][mod10],
CarInfo[idx][mod11],
CarInfo[idx][mod12],
CarInfo[idx][mod13],
CarInfo[idx][mod14],
CarInfo[idx][mod15],
CarInfo[idx][mod16],
CarInfo[idx][mod17],
CarInfo[idx][paintjob]);
if(idx == 0)
{
file2 = fopen("cars.cfg", io_write);
}
else
{
file2 = fopen("cars.cfg", io_append);
}
fwrite(file2, coordsstring);
idx++;
fclose(file2);
}
return 1;
}
pawn Код:
public OnPropUpdate()
{
new idx;
new File: file2;
idx = 184;
while (idx < sizeof(CarInfo))
{
new coordsstring[256];
format(coordsstring, sizeof(coordsstring), "%d,%f,%f,%f,%f,%d,%d,%s,%s,%d,%s,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d\n",
CarInfo[idx][cModel],//
CarInfo[idx][cLocationx],//
CarInfo[idx][cLocationy],//
CarInfo[idx][cLocationz],//
CarInfo[idx][cAngle],//
CarInfo[idx][cColorOne],//
CarInfo[idx][cColorTwo],//
CarInfo[idx][cOwner],//
CarInfo[idx][cDescription],//
CarInfo[idx][cValue],//
CarInfo[idx][cLicense],//
CarInfo[idx][cOwned],//
CarInfo[idx][cLock],
CarInfo[idx][mod1],
CarInfo[idx][mod2],
CarInfo[idx][mod3],
CarInfo[idx][mod4],
CarInfo[idx][mod5],
CarInfo[idx][mod6],
CarInfo[idx][mod7],
CarInfo[idx][mod8],
CarInfo[idx][mod9],
CarInfo[idx][mod10],
CarInfo[idx][mod11],
CarInfo[idx][mod12],
CarInfo[idx][mod13],
CarInfo[idx][mod14],
CarInfo[idx][mod15],
CarInfo[idx][mod16],
CarInfo[idx][mod17],
CarInfo[idx][paintjob]);
if(idx == 184)
{
file2 = fopen("cars.cfg", io_write);
}
else
{
file2 = fopen("cars.cfg", io_append);
}
fwrite(file2, coordsstring);
idx++;
fclose(file2);
}
return 1;
}
Re: help with command -
MadeMan - 19.05.2011
In LoadCar change this
pawn Код:
CarInfo[idx][cLicense] = strval(arrCoords[10]);
to
pawn Код:
strmid(CarInfo[idx][cLicense], arrCoords[10], 0, strlen(arrCoords[10]), 255);
And in OnPropUpdate change masini.cfg to cars.cfg