14.10.2011, 00:43
(
Последний раз редактировалось Buzzbomb; 14.10.2011 в 03:58.
)
I'm trying to do my own car System First time... Will this work compile fine But will it write the car id and owner and position
Here the code..
Here A Different Code i tried and It saved My Character ID and Not the Vehicle ID And I had to use GetPlayerPos Cause GetVehiclePos Wasnt Working it kept Writing 0.0000 For X Y Z AND A
Here the code..
pawn Код:
if(response)// They pressed the first button.
{
new
Vehicle,
Float:x = 553.1023,//553.1023,-1280.1471,16.8322,358.5390 Spawn Bought car here
Float:y = -1280.1471,
Float:z = 16.8322,
Float:a = 358.5390;
SetPlayerPos(playerid,x,y,z);
GetPlayerFacingAngle(playerid,a);
x += (5 * floatsin(-a, degrees));
y += (5 * floatcos(-a, degrees));
switch(dialogid)// If you only have one dialog, then this isn't required, but it's neater for when you implement more dialogs.
{
case 123:// Our dialog!
{
switch(listitem)// Checking which listitem was selected
{
case 0:// The first item listed
{
if(GetPlayerMoney(playerid) < 80000) return SendClientMessage(playerid, 0xFFFFFF, "You Cant Afford This Buffalo.");
GivePlayerMoney(playerid, -80000);
Vehicle = CreateVehicle(402,x,y,z + 1.0,a, -1, -1, 50000);
PutPlayerInVehicle(playerid, Vehicle, 0);
CVPlayerFile(playerid);
SendClientMessage(playerid, 0xFFFFFF, "Here Your Keys to Your Ride... Drive Safely");
}
case 1: // The second item listed
{
if(GetPlayerMoney(playerid) < 85000) return SendClientMessage(playerid, 0xFFFFFF, "You Cant Afford This Bullet.");
GivePlayerMoney(playerid, -85000);
Vehicle = CreateVehicle(541,x,y,z + 1.0,a, -1, -1, 50000);
PutPlayerInVehicle(playerid, Vehicle, 0);
CVPlayerFile(playerid);
SendClientMessage(playerid, 0xFFFFFF, "Here Your Keys to Your Ride... Drive Safely");
}
case 2: // The third item listed
{
if(GetPlayerMoney(playerid) < 90000) return SendClientMessage(playerid, 0xFFFFFF, "You Cant Afford This Banshee.");
GivePlayerMoney(playerid, -90000);
Vehicle = CreateVehicle(429,x,y,z + 1.0,a, -1, -1, 50000);
PutPlayerInVehicle(playerid, Vehicle, 0);
CVPlayerFile(playerid);
SendClientMessage(playerid, 0xFFFFFF, "Here Your Keys to Your Ride... Drive Safely");
}
}
}
}//Buffalo ($80,000)\nBullet ($85,000)\nBanshee ($90,000)
}
return 1;
}
forward CVPlayerFile(playerid);
public CVPlayerFile(playerid)
{
new vfile[256];
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
format(vfile, sizeof(vfile), ARS_VEH, name);
dini_Create(vfile);
dini_IntSet(vfile, "vOwner",VehicleInfo[playerid][vOwner]);
dini_IntSet(vfile, "vModel",VehicleInfo[playerid][vModel] = 0);
dini_IntSet(vfile, "vLocX",VehicleInfo[playerid][vLocX] = 0);
dini_IntSet(vfile, "vLocY",VehicleInfo[playerid][vLocY] = 0);
dini_IntSet(vfile, "vLocZ",VehicleInfo[playerid][vLocZ] = 0);
dini_IntSet(vfile, "vLocA",VehicleInfo[playerid][vLocA] = 0);
dini_IntSet(vfile, "vColor1",VehicleInfo[playerid][vColor1] = 0);
dini_IntSet(vfile, "vColor2",VehicleInfo[playerid][vColor2] = 0);
dini_IntSet(vfile, "vMod1",VehicleInfo[playerid][vMod1] = 0);
dini_IntSet(vfile, "vMod2",VehicleInfo[playerid][vMod2] = 0);
dini_IntSet(vfile, "vMod3",VehicleInfo[playerid][vMod3] = 0);
dini_IntSet(vfile, "vMod4",VehicleInfo[playerid][vMod4] = 0);
dini_IntSet(vfile, "vMod5",VehicleInfo[playerid][vMod5] = 0);
SaveCarInfo(playerid);
return 1;
}
forward SaveCarInfo(playerid);
public SaveCarInfo(playerid)
{
new vfile[256];
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
format(vfile, sizeof(vfile), ARS_VEH, name);
new Float:X, Float:Y, Float:Z, Float:A;
GetVehiclePos(playerid, X,Y,Z);
GetVehicleZAngle(playerid, A);
dini_IntSet(vfile, "vModel", GetPlayerVehicleID(playerid));
dini_FloatSet(vfile, "vLocX", X);
dini_FloatSet(vfile, "vLocY", Y);
dini_FloatSet(vfile, "vLocZ", Z);
dini_FloatSet(vfile, "vLocA", A);
return 1;
}
forward SavePlayerVehicles(playerid);
public SavePlayerVehicles(playerid)
{
new vfile[256];
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
format(vfile, sizeof(vfile), ARS_VEH, name);
dini_IntSet(vfile, "vOwner",VehicleInfo[playerid][vOwner]);
dini_IntSet(vfile, "vModel",VehicleInfo[playerid][vModel]);
dini_IntSet(vfile, "vLocX",VehicleInfo[playerid][vLocX]);
dini_IntSet(vfile, "vLocY",VehicleInfo[playerid][vLocY]);
dini_IntSet(vfile, "vLocZ",VehicleInfo[playerid][vLocZ]);
dini_IntSet(vfile, "vLocA",VehicleInfo[playerid][vLocA]);
dini_IntSet(vfile, "vColor1",VehicleInfo[playerid][vColor1]);
dini_IntSet(vfile, "vColor2",VehicleInfo[playerid][vColor2]);
dini_IntSet(vfile, "vMod1",VehicleInfo[playerid][vMod1]);
dini_IntSet(vfile, "vMod2",VehicleInfo[playerid][vMod2]);
dini_IntSet(vfile, "vMod3",VehicleInfo[playerid][vMod3]);
dini_IntSet(vfile, "vMod4",VehicleInfo[playerid][vMod4]);
dini_IntSet(vfile, "vMod5",VehicleInfo[playerid][vMod5]);
return 1;
}
Here A Different Code i tried and It saved My Character ID and Not the Vehicle ID And I had to use GetPlayerPos Cause GetVehiclePos Wasnt Working it kept Writing 0.0000 For X Y Z AND A
pawn Код:
if(response)// They pressed the first button.
{
new
Vehicle,
Float:x = 553.1023,//553.1023,-1280.1471,16.8322,358.5390 Spawn Bought car here
Float:y = -1280.1471,
Float:z = 16.8322,
Float:a = 358.5390;
SetPlayerPos(playerid,x,y,z);
GetPlayerFacingAngle(playerid,a);
x += (5 * floatsin(-a, degrees));
y += (5 * floatcos(-a, degrees));
switch(dialogid)// If you only have one dialog, then this isn't required, but it's neater for when you implement more dialogs.
{
case 123:// Our dialog!
{
switch(listitem)// Checking which listitem was selected
{
case 0:// The first item listed
{
if(GetPlayerMoney(playerid) < 80000) return SendClientMessage(playerid, 0xFFFFFF, "You Cant Afford This Buffalo.");
GivePlayerMoney(playerid, -80000);
Vehicle = CreateVehicle(402,x,y,z + 1.0,a, -1, -1, 50000);
PutPlayerInVehicle(playerid, Vehicle, 0);
CVPlayerFile(playerid);
SendClientMessage(playerid, 0xFFFFFF, "Here Your Keys to Your Ride... Drive Safely");
}
case 1: // The second item listed
{
if(GetPlayerMoney(playerid) < 85000) return SendClientMessage(playerid, 0xFFFFFF, "You Cant Afford This Bullet.");
GivePlayerMoney(playerid, -85000);
Vehicle = CreateVehicle(541,x,y,z + 1.0,a, -1, -1, 50000);
PutPlayerInVehicle(playerid, Vehicle, 0);
CVPlayerFile(playerid);
SendClientMessage(playerid, 0xFFFFFF, "Here Your Keys to Your Ride... Drive Safely");
}
case 2: // The third item listed
{
if(GetPlayerMoney(playerid) < 90000) return SendClientMessage(playerid, 0xFFFFFF, "You Cant Afford This Banshee.");
GivePlayerMoney(playerid, -90000);
Vehicle = CreateVehicle(429,x,y,z + 1.0,a, -1, -1, 50000);
PutPlayerInVehicle(playerid, Vehicle, 0);
CVPlayerFile(playerid);
SendClientMessage(playerid, 0xFFFFFF, "Here Your Keys to Your Ride... Drive Safely");
}
}
}
}//Buffalo ($80,000)\nBullet ($85,000)\nBanshee ($90,000)
}
return 1;
}
forward CVPlayerFile(playerid);
public CVPlayerFile(playerid)
{
new vfile[256];
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
format(vfile, sizeof(vfile), ARS_VEH, name);
dini_Create(vfile);
dini_IntSet(vfile, "Owner",VehicleInfo[playerid][vOwner]);
dini_IntSet(vfile, "Model",VehicleInfo[playerid][vModel] = 0);
dini_IntSet(vfile, "Plate",VehicleInfo[playerid][vPlate] = 0);
dini_IntSet(vfile, "LocX",VehicleInfo[playerid][vLocX] = 0);
dini_IntSet(vfile, "LocY",VehicleInfo[playerid][vLocY] = 0);
dini_IntSet(vfile, "LocZ",VehicleInfo[playerid][vLocZ] = 0);
dini_IntSet(vfile, "LocA",VehicleInfo[playerid][vLocA] = 0);
dini_IntSet(vfile, "Color1",VehicleInfo[playerid][vColor1] = 0);
dini_IntSet(vfile, "Color2",VehicleInfo[playerid][vColor2] = 0);
dini_IntSet(vfile, "Mod1",VehicleInfo[playerid][vMod1] = 0);
dini_IntSet(vfile, "Mod2",VehicleInfo[playerid][vMod2] = 0);
dini_IntSet(vfile, "Mod3",VehicleInfo[playerid][vMod3] = 0);
dini_IntSet(vfile, "Mod4",VehicleInfo[playerid][vMod4] = 0);
dini_IntSet(vfile, "Mod5",VehicleInfo[playerid][vMod5] = 0);
SaveCarInfo(playerid);
return 1;
}
forward SaveCarInfo(playerid);
public SaveCarInfo(playerid)
{
new vfile[256], string[256];
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
format(vfile, sizeof(vfile), ARS_VEH, name);
new Float:X, Float:Y, Float:Z, Float:A;
GetPlayerPos(playerid, X,Y,Z);
GetPlayerFacingAngle(playerid, A);
dini_IntSet(vfile, "Model", GetPlayerVehicleID(playerid));
dini_Set(vfile, "Plate", PlayerInfo[playerid][pFirstname] );
dini_FloatSet(vfile, "LocX", X);
dini_FloatSet(vfile, "LocY", Y);
dini_FloatSet(vfile, "LocZ", Z);
dini_FloatSet(vfile, "LocA", A);
dini_IntSet(vfile, "Color1",VehicleInfo[playerid][vColor1]);
format(string, sizeof(string), "Car Saved At %f, %f, %f, %f", X, Y, Z, A);
SendClientMessage(playerid, GREEN, string);
return 1;
}