07.08.2013, 01:40
I have this code:
The problem is I cannot seem to get the multiple parameters to work. (EG: /editveh <model>, then there's extra parameters after the model)
What am I doing wrong?
pawn Код:
CMD:editveh(playerid, params[])
{
new
type [25];
if( sscanf( params, "s[25]", type ) )
{
SendClientMessage (playerid, COL_SILVER, "USAGE: /editveh <type>");
return 1;
}
if( !strcmp( type, "model" ) )
{
new
vID,
vModel;
strdel( params, 0, 5);
if( sscanf( params, "ii", vID, vModel ) )
{
SendClientMessage (playerid, COL_SILVER, "USAGE: /editveh model <vehicle id> <model id>");
return 1;
}
if( fexist( GetVehiclePath(vID) ) )
{
print("d");
new
INI: Vehicle = INI_Open (GetVehiclePath (vID) ),
annStr [128],
Float: vx,
Float: vy,
Float: vz,
Float: va,
tempVID;
GetVehiclePos (vID, vx, vy, vz);
GetVehicleZAngle (vID, va);
INI_SetTag (Vehicle, "data");
INI_WriteInt (Vehicle, "model", vModel);
INI_Close (Vehicle);
INI_ParseFile( GetVehiclePath (vID), "LoadVehicle_%s", .bExtra = true, .extra = vID );
DestroyVehicle (vID);
tempVID = CreateVehicle( VehicleInfo [vID] [Model], vx, vy, vz, va, VehicleInfo [vID] [SpawnCol1], VehicleInfo [vID] [SpawnCol2], 360000 );
SetVehicleParamsEx (tempVID, VehicleInfo [vID] [EngineStatus], VehicleInfo [vID] [LightStatus], VehicleInfo [vID] [AlarmStatus], \
VehicleInfo [vID] [Locked], VehicleInfo [vID] [HoodStatus], VehicleInfo [vID] [TrunkStatus], 0
);
format (annStr, 128, "[VEHICLE] "#INT_SILVER"Vehicle %d's model has been edited to %d.", vID, vModel);
SendClientMessage (playerid, COL_LIGHTBLUE, annStr);
}
else return SendClientMessage (playerid, COL_SILVER, "This vehicle does not exist!");
}
return 1;
}
What am I doing wrong?