22.04.2012, 16:41
i need help with this. i want to save certain VehicleID(GetPlayerVehicleID() like 100 -200 for Admins. so when admins spawn a car with /veh they should get a car with id 100-200
pawn Код:
dcmd_veh(playerid,params[])
{
if(AccInfo[playerid][Level] >= 1)
{
new Index;
new tmp[256]; tmp = strtok(params,Index);
new tmp2[256]; tmp2 = strtok(params,Index);
new tmp3[256]; tmp3 = strtok(params,Index);
if(!strlen(tmp)) return
SendClientMessage(playerid, red, "Usage: /veh [ModelID/Name]");
new car;
new carid;
new string[128];
new colour1, colour2;
if(!IsNumeric(tmp))
car = GetVehicleModelIDFromName(tmp);
else car = strval(tmp);
carid = GetPlayerVehicleID();
if(car < 411 || car > 600) return SendClientMessage(playerid, red, "Invalid Vehicle Model ID!");
if(!strlen(tmp2)) colour1 = 0; else colour1 = strval(tmp2);
if(!strlen(tmp3)) colour2 = 0; else colour2 = strval(tmp3);
if(AccInfo[playerid][pCar] != -1 && !IsPlayerAdmin(playerid))
EraseVeh(AccInfo[playerid][pCar]);
new LVehicleID;
new Float:X,Float:Y,Float:Z;
new Float:Angle,int1;
GetPlayerPos(playerid, X,Y,Z);
GetPlayerFacingAngle(playerid,Angle);
int1 = GetPlayerInterior(playerid);
LVehicleID = CreateVehicle(car, X,Y-4,Z, Angle, colour1, colour2, -1);
LinkVehicleToInterior(LVehicleID,int1);
AccInfo[playerid][pCar] = LVehicleID;
SendCommandToAdmins(playerid,"Car");
format(string, sizeof(string), "%s Spawned a %s (Model:%d) Colours (%d, %d)", pName(playerid), VehicleNames[car-400], car, colour1, colour2);
SaveIn("CarSpawns",string);
format(string, sizeof(string), "Spawned a %s (%d) Colors: %d,%d", VehicleNames[car-400], car, colour1, colour2);
return SendClientMessage(playerid,LIGHTBLUE, string);
}
else return ErrorMessages(playerid, 6);
}