11.05.2014, 10:44
I build car shop System and when i go to the red circle point thats open me dialog with the cars and their price
and i choose and press "Buy" and this is dosen't told me nothing and this is didnt give me the car i buyed
and this is dosen't take from me money please if you see problems with that please fix it
and i choose and press "Buy" and this is dosen't told me nothing and this is didnt give me the car i buyed
and this is dosen't take from me money please if you see problems with that please fix it
Код:
#include <a_samp> #include <dof2> #include <FAC> #include <dini> #pragma unused DOF2_Exit #include <cpstream> #define DIALOG_CAR (120) enum pInfoVehicle { vehicle_Name[30], vehicle_Price, vehicle_ID }; new PlayerData[][pInfoVehicle] = { {"Sultan", 840000, 560}, {"Infernus", 3500000, 411}, {"Washington", 350000, 421}, {"Stallion", 400000, 439}, {"Romero", 450000, 442}, {"Admiral", 350000, 445}, {"Turismo", 2500000, 451}, {"NRG-500", 15000000, 522} }; new pName[MAX_PLAYERS][MAX_PLAYER_NAME+1], vehicle_CP, vehicle_Create[MAX_PLAYERS], bool: vehicle_In[MAX_PLAYERS], Text3D:vehicle_Text3D[MAX_VEHICLES]; public OnGameModeInit() { vehicle_CP = CPS_AddCheckpoint(2096.5759, 1284.1421, 10.8203 ,2.0, 40); return 1; } public OnPlayerConnect(playerid) return GetPlayerName(playerid, pName[playerid], MAX_PLAYER_NAME+1), 1; public OnPlayerDisconnect(playerid, reason) { if(vehicle_In[playerid] == true) { DestroyVehicle(vehicle_Create[playerid]), vehicle_In[playerid] = false; Delete3DTextLabel(vehicle_Text3D[vehicle_Create[playerid]]); } return 1; } public OnPlayerCommandText(playerid, cmdtext[]) { if(!strcmp(cmdtext, "/carshop", true)) { SetPlayerPos(playerid, 2096.5759, 1284.1421, 10.8203); return SendClientMessage(playerid, 0xFFFF00FF, ".бшелйн дбайн мзреъ дшлбйн"); } if(!strcmp(cmdtext, "/callcar", true)) { if(!DOF2_GetBool(VehicleFile(playerid), "VehicleHave")) return SendClientMessage(playerid, 0xFF0000FF, ".ма чййн шлб ббтмеък"); if(IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, 0xFF0000FF, ".аъд лбш роца бъек шлб"); vehicle_Create[playerid] = CreateVehicle(DOF2_GetInt(VehicleFile(playerid), "VehicleModel"), 0.0, 0.0, 0.0, 0.0, -1, -1, 60); new Float:vehicle_Pos[4]; GetPlayerPos(playerid, vehicle_Pos[0], vehicle_Pos[1], vehicle_Pos[2]); SetVehiclePos(vehicle_Create[playerid], vehicle_Pos[0], vehicle_Pos[1], vehicle_Pos[2]); PutPlayerInVehicle(playerid, vehicle_Create[playerid], 0); new Vehicle_F[50]; format(Vehicle_F, sizeof(Vehicle_F), "{CCFF66}%s {FF0066}:дбтмйн щм дшлб", pName[playerid]); vehicle_Text3D[vehicle_Create[playerid]] = Create3DTextLabel(Vehicle_F, 0xFFFF00FF, 0, 0, 0, 30, 0, 0); Attach3DTextLabelToVehicle(vehicle_Text3D[vehicle_Create[playerid]], vehicle_Create[playerid], 0, 0, 1); vehicle_In[playerid] = true; return SendClientMessage(playerid, 0xFFFF00FF, ".шлбк щевш амйк рдв бждйшеъ"), 1; } if(!strcmp(cmdtext,"/sellcar", true)) { if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, 0xFF0000FF, ".аъд ма роца бъек шлб"); if(!DOF2_GetBool(VehicleFile(playerid), "VehicleHave")) return SendClientMessage(playerid, 0xFF0000FF, ".ма чййн шлб ббтмеък"); FAC_GivePlayerMoney(playerid, DOF2_GetInt(VehicleFile(playerid), "VehiclePrice") / 2); if(vehicle_In[playerid] == true) DestroyVehicle(vehicle_Create[playerid]), vehicle_In[playerid] = false; Delete3DTextLabel(vehicle_Text3D[vehicle_Create[playerid]]); DOF2_RemoveFile(VehicleFile(playerid)); return SendClientMessage(playerid, 0xFFFF00FF, ".шлбк ролш ечйбмъ зцй оозйше"), 1; } return 0; } public OnPlayerExitVehicle(playerid, vehicleid) { if(vehicle_In[playerid] == true) { DestroyVehicle(vehicle_Create[playerid]), vehicle_In[playerid] = false; Delete3DTextLabel(vehicle_Text3D[vehicle_Create[playerid]]); } return 1; } public OnPlayerStateChange(playerid, newstate, oldstate) { if(oldstate == PLAYER_STATE_DRIVER || oldstate == PLAYER_STATE_PASSENGER && vehicle_In[playerid]) { DestroyVehicle(vehicle_Create[playerid]), vehicle_In[playerid] = false; Delete3DTextLabel(vehicle_Text3D[vehicle_Create[playerid]]); } return 1; } public OnVehicleDeath(vehicleid, killerid) { if(vehicle_In[killerid] == true) { DestroyVehicle(vehicle_Create[killerid]), vehicle_In[killerid] = false; Delete3DTextLabel(vehicle_Text3D[vehicle_Create[killerid]]); } return 1; } public OnPlayerEnterCheckpoint(playerid) { if(CPS_IsPlayerInCheckpoint(playerid, vehicle_CP) && !IsPlayerInAnyVehicle(playerid)) { new string[600]; format(string, sizeof(string), ""); for(new i; i <sizeof(PlayerData); i++) { format(string, sizeof(string), "%s\n{FF00FF}Vehicle Name: [%s] {FFFF00}Price:[$%d]", string, PlayerData[i][vehicle_Name], PlayerData[i][vehicle_Price]); } ShowPlayerDialog(playerid, DIALOG_CAR, DIALOG_STYLE_LIST, "{C0C0C0}зреъ долерйеъ", string, "чрййд", "йцйад"); } return 1; } public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]) { if(dialogid == DIALOG_CAR) { if(!response) return 0; if(DOF2_GetBool(VehicleFile(playerid), "VehicleHave")) return SendClientMessage(playerid, 0xFF0000FF, ".чййн лбш шлб ббтмеък"); DOF2_CreateFile(VehicleFile(playerid)); if(FAC_GetPlayerMoney(playerid) < PlayerData[listitem][vehicle_Price]) return SendClientMessage(playerid, 0xFF0000FF, ".айп бйгк аъ длсу дгшещ"); FAC_GivePlayerMoney(playerid, -PlayerData[listitem][vehicle_Price]); DOF2_SetString(VehicleFile(playerid), "VehicleName", PlayerData[listitem][vehicle_Name]); DOF2_SetInt(VehicleFile(playerid), "VehiclePrice", PlayerData[listitem][vehicle_Price]); DOF2_SetInt(VehicleFile(playerid), "VehicleModel", PlayerData[listitem][vehicle_ID]); DOF2_SetBool(VehicleFile(playerid), "VehicleHave", true); DOF2_SaveFile(); SendClientMessage(playerid, 0xFFFF00FF, ".ожм иеб, лтъ йщ ббтмеък шлб"); } return 1; } stock VehicleFile(playerid) { new v_File[64]; format(v_File, sizeof(v_File), "%s.ini", pName[playerid]); return v_File; }