21.01.2018, 03:44
PHP код:
stock LoadPics()
{
new str[256];
for(new i= 1; i < MAX_WEAPS; i++)
{
if(PicIDTaken[i] == 0) continue;
format(str, sizeof(str), "p%d", i);
WeapPic[i][wPickupM] = dini_Int(AddDirFile(dir_pickupfiles, str), "PickupModel");
WeapPic[i][wX] = dini_Float(AddDirFile(dir_pickupfiles, str), "X");
WeapPic[i][wY] = dini_Float(AddDirFile(dir_pickupfiles, str), "Y");
WeapPic[i][wZ] = dini_Float(AddDirFile(dir_pickupfiles, str), "Z");
WeapPic[i][wInt] = dini_Int(AddDirFile(dir_pickupfiles, str), "Int");
WeapPic[i][wWorld] = dini_Int(AddDirFile(dir_pickupfiles, str), "World");
WeapPic[i][wAmmo] = dini_Int(AddDirFile(dir_pickupfiles, str), "Ammo");
WeapPic[i][wType] = dini_Int(AddDirFile(dir_pickupfiles, str), "Type");
WeapPic[i][wPickup] = CreateDynamicPickup(WeapPic[i][wPickupM], WeapPic[i][wType], WeapPic[i][wX], WeapPic[i][wY], WeapPic[i][wZ], WeapPic[i][wWorld], WeapPic[i][wInt], -1, 70.0);
//CreateDynamic3DTextLabel(str, COLOR_YELLOW, WeapPic[idx][wX], WeapPic[idx][wY], WeapPic[idx][wZ], 10.0, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 0, -1, -1, -1, 100.0);
PicIDTaken[i] = 1;
}
return 1;
}
SavePics()
{
new str[256];
for(new i= 1; i < MAX_WEAPS; i++)
{
if(PicIDTaken[i] == 0) continue;
format(str, sizeof(str), "p%d", i);
dini_IntSet(AddDirFile(dir_pickupfiles, str), "PickupModel", WeapPic[i][wPickupM]);
dini_FloatSet(AddDirFile(dir_pickupfiles, str), "X", WeapPic[i][wX]);
dini_FloatSet(AddDirFile(dir_pickupfiles, str), "Y", WeapPic[i][wY]);
dini_FloatSet(AddDirFile(dir_pickupfiles, str), "Z", WeapPic[i][wZ]);
dini_IntSet(AddDirFile(dir_pickupfiles, str), "Int", WeapPic[i][wInt]);
dini_IntSet(AddDirFile(dir_pickupfiles, str), "World", WeapPic[i][wWorld]);
dini_IntSet(AddDirFile(dir_pickupfiles, str), "Ammo", WeapPic[i][wAmmo]);
dini_IntSet(AddDirFile(dir_pickupfiles, str), "Type", WeapPic[i][wType]);
}
return 1;
}
PHP код:
CMD:createpic(playerid, params[])
{
new ids, amount, Float: wPos[3], string[254], type;
if (adlvl[playerid] < 5) return 0;
if(sscanf(params, "ddd", ids, amount, type)) return SendClientMessage(playerid, COLOR_WHITE, "Usage: /createpic [weaponid] [amount] [type](Best Types: 2 - 23)");
if(type < 1 || type > 23) return SendClientMessage(playerid, COLOR_RED, "Error: Available Types: 1-22 ");
new id = GetPicAvailableID();
GetPlayerPos(playerid, wPos[0], wPos[1], wPos[2]);
PicIDTaken[id] = 1;
WeapPic[id][wX] = wPos[0];
WeapPic[id][wY] = wPos[1];
WeapPic[id][wZ] = wPos[2];
WeapPic[id][wWorld] = GetPlayerVirtualWorld(playerid);
WeapPic[id][wInt] = GetPlayerInterior(playerid);
WeapPic[id][wPickupM] = GetWeaponModel(ids);
WeapPic[id][wAmmo] = amount;
WeapPic[id][wType] = type;
WeapPic[id][wPickup] = CreateDynamicPickup(GetWeaponModel(ids), type, wPos[0], wPos[1], wPos[2], GetPlayerVirtualWorld(playerid), GetPlayerInterior(playerid), -1, 50.0);
format(string, sizeof(string), "You Have Created Pickup ID:%d, Weapon ID:%d, Amount:%d, With ID:%d, Type: %d At Your Location", WeapPic[id][wPickupM],ids, WeapPic[id][wAmmo], id, type);
SendClientMessage(playerid, COLOR_YELLOW, string);
SavePics();
return 1;
}