18.11.2017, 04:09
Conseguir fazer, tem alguns problemas com vezes de veнculos que pode ser comprado. E quando comprar mais de um veнculo e eles nascerem no mesmo lugar.
PHP код:
#include <a_samp>
#include <zcmd>
#include <MenuStore>
new car;
CMD:shop(playerid, params[])
{
if(GetPlayerState(playerid) == PLAYER_STATE_ONFOOT)
{
MenuStore_AddItem(playerid, 1, 400, "Landstalker", 200, "", 200);
MenuStore_AddItem(playerid, 2, 401, "Bravura", 500, "", 200);
MenuStore_AddItem(playerid, 3, 402, "Buffalo", 900, "");
MenuStore_AddItem(playerid, 4, 403, "Linerunner", 400, "");
MenuStore_AddItem(playerid, 5, 404, "Perennial", 200, "");
MenuStore_AddItem(playerid, 6, 405, "Sentinel", 300, "");
MenuStore_AddItem(playerid, 7, 408, "Trashmaster", 200, "");
MenuStore_AddItem(playerid, 8, 410, "Manana", 250, "");
MenuStore_AddItem(playerid, 9, 411, "Infernus", 5000, "");
MenuStore_AddItem(playerid, 10, 412, "Voodoo", 1300, "");
MenuStore_AddItem(playerid, 11, 413, "Pony", 200, "");
MenuStore_AddItem(playerid, 12, 414, "Mule", 350, "");
MenuStore_AddItem(playerid, 13, 415, "Cheetah", 2600, "");
MenuStore_AddItem(playerid, 14, 418, "Moonbeam", 400, "");
MenuStore_AddItem(playerid, 15, 420, "Taxi", 450, "");
MenuStore_Show(playerid, Weapon_Shop, "Shop Veiculos");
}
else
{
SendClientMessage(playerid, -1, "Vocк nгo pode estб dentro de uma veнculo.");
}
return 1;
}
Store:Weapon_Shop(playerid, response, itemid, modelid, price, amount, itemname[])
{
new Float:x, Float:y, Float:z, Float:a;
if(!response)
return true;
if(GetPlayerMoney(playerid) < price)
return SendClientMessage(playerid, -1, "Vocк nгo tem dinheiro suficiente.");
if(amount == 1) {
GetPlayerPos(playerid, x, y, z);
car = AddStaticVehicle(modelid, x, y,z, a, -1, -1);
PutPlayerInVehicle(playerid,car,0);
SetPlayerFacingAngle(playerid, a);
SetCameraBehindPlayer(playerid);
}
else {
GetPlayerPos(playerid, x, y, z);
car = AddStaticVehicle(modelid, x, y,z, a, -1, -1);
PutPlayerInVehicle(playerid,car,0);
SetPlayerFacingAngle(playerid, a);
SetCameraBehindPlayer(playerid);
}
new string[128];
format(string, 128, "Vocк comprou %dx %s", amount, itemname);
SendClientMessage(playerid, -1, string);
GivePlayerMoney(playerid, -price);
return true;
}
stock GetWeaponIDFromModel(modelid)
{
new idvehicle;
switch(modelid)
{
case 331: idvehicle = 400;
case 333: idvehicle = 401;
case 334: idvehicle = 402;
case 335: idvehicle = 403;
case 336: idvehicle = 404;
case 337: idvehicle = 405;
case 338: idvehicle = 408;
case 339: idvehicle = 410;
case 341: idvehicle = 411;
case 321: idvehicle = 412;
case 325: idvehicle = 413;
case 326: idvehicle = 414;
case 342: idvehicle = 415;
case 343: idvehicle = 418;
case 344: idvehicle = 420;
case 346: idvehicle = 421;
case 347: idvehicle = 422;
case 348: idvehicle = 423;
case 349: idvehicle = 424;
case 350: idvehicle = 425;
case 351: idvehicle = 428;
case 352: idvehicle = 430;
case 353: idvehicle = 431;
case 355: idvehicle = 432;
case 356: idvehicle = 433;
case 372: idvehicle = 434;
case 357: idvehicle = 435;
case 358: idvehicle = 438;
case 359: idvehicle = 440;
case 360: idvehicle = 441;
case 361: idvehicle = 442;
case 362: idvehicle = 443;
case 363: idvehicle = 444;
case 365: idvehicle = 445;
case 366: idvehicle = 448;
case 367: idvehicle = 450;
}
return idvehicle;
}