05.07.2014, 05:20
(
Последний раз редактировалось PawnOX; 05.07.2014 в 05:23.
Причина: FUCK THE SCREENSHOT!
)
This error
As you can see, That ID "451" is a turismo vehicle but it says ERROR -_-
Heres my codes
And my stock
As you can see, That ID "451" is a turismo vehicle but it says ERROR -_-
Heres my codes
pawn Код:
CMD:createpvehicle(playerid, params[])
{
if(PlayerInfo[playerid][pAdmin] < 4)
{
SendClientMessage(playerid, COLOR_GREY, "You're not allowed to use this command.");
return 1;
}
new playervehicleid = GetPlayerFreeVehicleId(playerid);
if(AdminDuty[playerid] != 1 && PlayerInfo[playerid][pAdmin] < 6)
{
SendClientMessage(playerid,COLOR_WHITE, "You're not on-duty as admin. To access your admin commands you must be on-duty. Type /aduty to go on-duty.");
return 1;
}
new string[128], giveplayerid, modelid, color1, color2;
if(sscanf(params, "uddd", giveplayerid, modelid, color1, color2)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /createpvehicle [playerid/partofname] [modelid] [color 1] [color 2]");
if(AdminDuty[giveplayerid] == 1)
{
SendClientMessage(playerid,COLOR_WHITE, "You can't use that command on an on-duty admin.");
return 1;
}
if(color1 < 0 || color1 > 255) { SendClientMessage(playerid, COLOR_GREY, " Color Number can't be below 0 or above 255!"); return 1; }
if(color2 < 0 || color2 > 255) { SendClientMessage(playerid, COLOR_GREY, " Color Number can't be below 0 or above 255!"); return 1; }
if(modelid < 400 || modelid > 611) { SendClientMessage(playerid, COLOR_GREY, " Vehicle Number can't be below 400 or above 611!"); return 1; }
new carsamount = GetPlayerVehicleCount(giveplayerid);
// (TEMPORARY - ZHAO NOTE) TempDonator not added yet
if(PlayerInfo[giveplayerid][pDonator] == 0 && carsamount >= 5) //PlayerInfo[giveplayerid][pTempDonator] > 0) && carsamount >= 5)
{
SendClientMessage(giveplayerid, COLOR_GREY, "That player can't have more cars, non-donator can only own 5 cars.");
return 1;
}
if(PlayerInfo[giveplayerid][pDonator] == 1 && carsamount >= 7)
{
SendClientMessage(playerid, COLOR_GREY, "That player can't have more cars, Bronze Donator can only own 7 cars.");
return 1;
}
if(PlayerInfo[giveplayerid][pDonator] == 2 && carsamount >= 8)
{
SendClientMessage(playerid, COLOR_GREY, "That player can't have more cars, Silver Donator can only own 8 cars.");
return 1;
}
if(PlayerInfo[giveplayerid][pDonator] == 3 && carsamount >= 10)
{
SendClientMessage(playerid, COLOR_GREY, "That player can't have more cars, Gold Donator can only own 10 cars.");
return 1;
}
/*if(PlayerInfo[giveplayerid][pDonator] >= 4 && carsamount >= 10)
{
SendClientMessage(giveplayerid, COLOR_GREY, "That player can't have more cars, Platinum+ VIP can only own 10 cars.");
return 1;
}*/
if(playervehicleid == -1) return SendClientMessage(playerid, COLOR_GREY, "ERROR: That player can't have more cars.");
if(PlayerInfo[giveplayerid][pDonator] == 0 && VehicleSpawned[giveplayerid] >= 1)
{
SendClientMessage(playerid, COLOR_GREY, "That player is non-donator and can only have 1 vehicle spawned. The player must store that vehicle in order to create a new one.");
return 1;
}
if(PlayerInfo[giveplayerid][pDonator] == 1 && VehicleSpawned[giveplayerid] >= 2)
{
SendClientMessage(playerid, COLOR_GREY, "That player is Bronze Donator and can only have 2 vehicles spawned. The player must store that vehicle in order to create a new one.");
return 1;
}
if(PlayerInfo[giveplayerid][pDonator] == 2 && VehicleSpawned[giveplayerid] >= 3)
{
SendClientMessage(playerid, COLOR_GREY, "That player is Silver Donator and can only have 3 vehicles spawned. The player must store a vehicle in order to create a new one.");
return 1;
}
/*if(PlayerInfo[giveplayerid][pDonator] == 3 && VehicleSpawned[giveplayerid] >= 4)
{
SendClientMessage(playerid, COLOR_GREY, "That player is Gold Donator and can only have 4 vehicles spawned. The player must store a vehicle in order to create a new one.");
return 1;
}*/
/*if(PlayerInfo[giveplayerid][pDonator] == 4 && VehicleSpawned[giveplayerid] >= 5)
{
SendClientMessage(giveplayerid, COLOR_GREY, "That player is Undefined Donator and can only have 5 vehicles spawned. The player must store a vehicle in order to create a new one.");
return 1;
}
if(PlayerInfo[giveplayerid][pDonator] == 5 && VehicleSpawned[giveplayerid] >= 5)
{
SendClientMessage(giveplayerid, COLOR_GREY, "That player is a VIP Moderator and can only have 5 vehicles spawned. The player must store a vehicle in order to create a new one.");
return 1;
}*/
if(PlayerInfo[giveplayerid][pDonator] < 0 || PlayerInfo[giveplayerid][pDonator] > 3)
{
SendClientMessage(playerid, COLOR_GREY, "ERROR: That player has an invalid Donator level.");
return 1;
}
new Float:X,Float:Y,Float:Z;
GetPlayerPos(giveplayerid,X,Y,Z);
new Float:Angle;
GetPlayerFacingAngle(giveplayerid,Angle);
new car = CreatePlayerVehicle(giveplayerid, playervehicleid, modelid, X, Y, Z, Angle, color1, color2, 0);
if(car == INVALID_PLAYER_VEHICLE_ID)
{
return SendClientMessage(playerid, COLOR_GREY, "ERROR: Something went wrong and the car didn't get created.");
}
else
{
format(string, sizeof(string), " Vehicle successfully created with ID %d.", car);
SendClientMessage(playerid, COLOR_GRAD1, string);
new engine, lights, alarm, doors, bonnet, boot, objective;
GetVehicleParamsEx(car, engine, lights, alarm, doors, bonnet, boot, objective);
SetVehicleParamsEx(car, 0,lights,alarm,doors,bonnet,boot,objective);
}
format(string, sizeof(string), "%s has created a %s for %s (Color 1: %d | Color 2: %d).", GetPlayerNameEx(playerid), GetVehicleName(car), GetPlayerNameEx(giveplayerid), color1, color2);
Log("logs/playervehicle.log", string);
return 1;
}
pawn Код:
stock CreatePlayerVehicle(playerid, playervehicleid, modelid, Float: x, Float: y, Float: z, Float: angle, color1, color2, price)
{
if(PlayerVehicleInfo[playerid][playervehicleid][pvId] == INVALID_PLAYER_VEHICLE_ID)
{
VehicleSpawned[playerid]++;
PlayerCars++;
PlayerVehicleInfo[playerid][playervehicleid][pvModelId] = modelid;
PlayerVehicleInfo[playerid][playervehicleid][pvPosX] = x;
PlayerVehicleInfo[playerid][playervehicleid][pvPosY] = y;
PlayerVehicleInfo[playerid][playervehicleid][pvPosZ] = z;
PlayerVehicleInfo[playerid][playervehicleid][pvPosAngle] = angle;
PlayerVehicleInfo[playerid][playervehicleid][pvColor1] = color1;
PlayerVehicleInfo[playerid][playervehicleid][pvColor2] = color2;
PlayerVehicleInfo[playerid][playervehicleid][pvPark] = 1;
PlayerVehicleInfo[playerid][playervehicleid][pvPrice] = price;
PlayerVehicleInfo[playerid][playervehicleid][pvFuel] = 100.0;
PlayerVehicleInfo[playerid][playervehicleid][pvImpounded] = 0;
for(new m = 0; m < MAX_MODS; m++)
{
PlayerVehicleInfo[playerid][playervehicleid][pvMods][m] = 0;
}
new carcreated = AddStaticVehicleEx(modelid,x,y,z,angle,color1,color2,-1);
PlayerVehicleInfo[playerid][playervehicleid][pvId] = carcreated;
PlayerVehicleInfo[playerid][playervehicleid][pvSpawned] = 1;
SetVehicleNumberPlate(carcreated, PlayerVehicleInfo[playerid][playervehicleid][pvNumberPlate]);
return carcreated;
}
return INVALID_PLAYER_VEHICLE_ID;
}