19.06.2011, 19:11
Hello all guys, I have problem.. I tried to fix it in 2 ways - heh, no effect.
So, Im making a vehicle shop. When you enter the CP - you will see a car, if you want to see other - press ALT, if you want to buy it - ENTER and if you want to go back press SPACE.. But, when I enter the CP - no vehicle, no sound, no freeze.
Script:
OnPlayerEnterDynamicCP:
I can't test other things(go back, buy the car or see other car) because there's something wrong with vehicle creating, freezing and other things. Also, I dont see the textdraws.
So, Im making a vehicle shop. When you enter the CP - you will see a car, if you want to see other - press ALT, if you want to buy it - ENTER and if you want to go back press SPACE.. But, when I enter the CP - no vehicle, no sound, no freeze.
Script:
pawn Код:
#define MAX_SHOP_CARS 4
enum Turgus
{
sModelis,
sKaina
};
new const ShopCars[MAX_SHOP_CARS][Turgus] =
{
{490, 1000000},
{560, 120000},
{561, 130000},
{561, 100000}
};
OnPlayerEnterDynamicCP:
pawn Код:
if(checkpointid == Checkpoint{1})
{
if(pData[playerid][pVehicle] != 0) return SendClientMessage(playerid, -1, "{FFFFFF}[ {FFFF00}INFORMACIJA {FFFFFF}]: Jыs jau turite maрinа!");
if(GetPlayerState(playerid) != PLAYER_STATE_ONFOOT) return true;
SetPlayerCameraPos(playerid, -522.474, 2627.827, 53.925);
SetPlayerCameraLookAt(playerid, -519.353, 2628.121, 53.414);
pData[playerid][pShopVehicle][0] = MAX_SHOP_CARS;
pData[playerid][pShopVehicle][1] = CreateVehicle(ShopCars[pData[playerid][pShopVehicle][0]][sModelis], -510.1840, 2633.3875, 53.2482, 143.3534, 0, 0, -1);
SetPlayerVirtualWorld(playerid, playerid + 1);
SetVehicleVirtualWorld(pData[playerid][pShopVehicle][1], GetPlayerVirtualWorld(playerid));
PutPlayerInVehicle(playerid, pData[playerid][pShopVehicle][1], 0);
new Stringas[151];
TextDrawShowForPlayer(playerid, pData[playerid][pShop]);
format(Stringas, 151, "~w~Masina: ~r~%s~n~~w~Kaina: ~r~$%d~n~~n~g~Pirkimui: ~r~ENTER~n~~g~Grizimui: ~r~SPACE~n~~g~Kita masina: ~r~ALT", MasinuPavadinimai[GetVehicleModel(pData[playerid][pShopVehicle][1] - 400)], ShopCars[pData[playerid][pShopVehicle][0]][sKaina]);
TextDrawSetString(pData[playerid][pShop], Stringas);
PlayerPlaySound(playerid, 1183, 0, 0, 0);
TogglePlayerControllable(playerid, false);
}