Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- *
- * Map Icon maker by Lorenc.
- * (c) 2010
- *
- */
- #include <a_samp>
- #define COLOR_LIGHT_GREEN 0x00D67EFF
- #define DIALOG1 1237
- public OnFilterScriptInit()
- {
- print("\n--------------------------------------");
- print(" Map Icon maker by Lorenc loaded.");
- print("--------------------------------------\n");
- return 1;
- }
- public OnPlayerCommandText(playerid, cmdtext[])
- {
- if (strcmp("/micon", cmdtext, true, 10) == 0) {
- if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, COLOR_LIGHT_GREEN, "~!~ You need to be a rcon admin to use this command.");
- ShowPlayerDialog(playerid,DIALOG1,DIALOG_STYLE_INPUT,"Lorenc's Map Icon Creator - Saving!","The map icon will be saved at this location\nhowever you will need to input a map icon id below:","Accept","Decline");
- return 1;
- }
- return 0;
- }
- public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
- {
- if(dialogid == DIALOG1) {
- if(response) {
- if(IsNumeric(inputtext)) {
- new string[126];
- new Float:X, Float:Y, Float:Z;
- GetPlayerPos(playerid, X, Y, Z);
- SetPlayerMapIcon( playerid, 46, X, Y, Z, strval(inputtext), 0 );
- new File:pos = fopen("MapIcons.LMIC", io_append);
- format(string, sizeof string, "SetPlayerMapIcon( playerid, 12, %.2f, %.2f, %.2f, %i, 0); //Created by Lorenc's map icon saver \r\n", X, Y, Z, strval(inputtext));
- fwrite(pos, string);
- fclose(pos);
- SendClientMessage(playerid, COLOR_LIGHT_GREEN, string);
- SendClientMessage(playerid, COLOR_LIGHT_GREEN, "Map icon has been saved to the file MapIcons.LMIC.");
- }
- else {
- SendClientMessage(playerid, COLOR_LIGHT_GREEN, "~!~ Numbers Only!");
- ShowPlayerDialog(playerid,DIALOG1,DIALOG_STYLE_INPUT,"Lorenc's Map Icon Creator - Saving!","The map icon will be saved at this location\nhowever you will need to input a map icon id below:","Accept","Decline");
- }
- }
- else {
- SendClientMessage(playerid, COLOR_LIGHT_GREEN, "~!~ Canceled");
- }
- return 1;
- }
- return 1;
- }
- forward fcreate(filename[]);
- public fcreate(filename[])
- {
- if (fexist(filename)){return false;}
- new File:fhandle = fopen(filename,io_write);
- fclose(fhandle);
- return true;
- }
- stock IsNumeric(string[])
- {
- for (new i = 0, j = strlen(string); i < j; i++) {
- if (string[i] > '9' || string[i] < '0') return 0;
- }
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement