04.02.2013, 14:28
Hello,
I wanna make a command that let players park their bought cars, but I tested it with a friend and he can park my car while he doesnt own it :S
Whats wrong with my CMD?
I wanna make a command that let players park their bought cars, but I tested it with a friend and he can park my car while he doesnt own it :S
pawn Код:
command(park, playerid, params[])
{
new Float:x, Float:y, Float:z, Float:angle;
if(IsPlayerInAnyVehicle(playerid))
{
new FileName[128];
for(new i = 0; i < SpawnedVehicles; i++)
{
format(FileName, sizeof(FileName), "Vehicles/Vehicle_%d.ini", i);
if(fexist(FileName))
{
if(Vehicles[i][CarID] == GetPlayerVehicleID(playerid))
{
if(!strcmp(Vehicles[i][vOwner], GetName(playerid), true))
{
GetVehiclePos(GetPlayerVehicleID(playerid), x, y, z);
GetVehicleZAngle(GetPlayerVehicleID(playerid), angle);
dini_FloatSet(FileName, "XSpawn", x);
dini_FloatSet(FileName, "YSpawn", y);
dini_FloatSet(FileName, "ZSpawn", z);
dini_FloatSet(FileName, "AngleSpawn", angle);
DestroyVehicle(GetPlayerVehicleID(playerid));
new NewCar = AddStaticVehicleEx(dini_Int(FileName, "Model"), dini_Float(FileName, "XSpawn"), dini_Float(FileName, "YSpawn"), dini_Float(FileName, "ZSpawn"), dini_Float(FileName, "AngleSpawn"), dini_Int(FileName, "Color1"), dini_Int(FileName, "Color2"), -1);
dini_IntSet(FileName, "CarID", NewCar);
SetVehicleNumberPlate(NewCar, dini_Get(FileName, "Plate"));
SCM(playerid, ADMINBLUE, "You succesfully parked your vehicle.");
}
else
{
SCM(playerid, RED, "This is not your vehicle!");
}
}
}
}
}
return 1;
}