Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #define MAX_NAME_GPS_POINT 50
- #define MAX_GPS_POINT 10
- #define GPS_INVALID_ID -1
- enum info
- {
- gps_id,
- Float: gps_pos_x,
- Float: gps_pos_y,
- Float: gps_pos_z
- gps_name[MAX_NAME_GPS_POINT]
- }
- new gps_info[MAX_GPS_POINT][info];
- public OnGameModeInit()
- {
- // код
- mysql_function_query(база данных, !"SELECT * FROM `gps_point`", true, !"LoadPoint", "");
- }
- forward LoadPoint();
- public LoadPoint()
- {
- new rows = cache_get_row_count(база данных);
- if(rows)
- {
- for(new i; i < rows; i ++)
- {
- gps_info[i][gps_id] = cache_get_field_content_int(0, !"GPS_ID");
- cache_get_field_content(0, !"GPS_Name", gps_info[i][gps_name], база данных, MAX_NAME_GPS_POINT);
- gps_info[i][gps_pos_x] = cache_get_field_content_float(0, !"GPS_X");
- gps_info[i][gps_pos_x] = cache_get_field_content_float(0, !"GPS_Y");
- gps_info[i][gps_pos_x] = cache_get_field_content_float(0, !"GPS_Z");
- }
- }
- }
- stock ShowPlayerPointList(playerid, dialogid)
- {
- new string[100];
- for(new i; i < MAX_GPS_POINT)
- {
- if(gps_info[i] == GPS_INVALID_ID)
- continue;
- format(string, sizeof string, "%s\n%s > ", gps_info[i][gps_name]);
- }
- ShowPlayerDialog(playerid, dialogid, DIALOG_STYLE_LIST, !"Список GPS", string, !"Перейти", !"Закрыть");
- }
- public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
- {
- case 1030:
- {
- if(!response)
- return true;
- //new id = gps_info[listitem][gps_id];
- new id = listitem;
- new size = 10.0;
- SetPlayerCheckpoint(playerid, gps_info[id][gps_pos_x], gps_info[id][gps_pos_y], gps_info[id][gps_pos_z], size);
- }
- }
- stock SavePoint(id)
- {
- new string[100];
- format(string, sizeof string,
- "UPDATE `gps_point` SET\
- `GPS_Name` = '%s', `GPS_X` = '%f', `GPS_Y` = '%f', `GPS_Z` = '%f' WHERE `GPS_ID` = '%d'",
- gps_info[i][gps_name], gps_info[i][gps_pos_x], gps_info[i][gps_pos_y], gps_info[i][gps_pos_z], id);
- mysql_function_query(база данных, "", false, "", "");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement