Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- Scripters Tools: by funky1234 (Ash)
- */
- #include <a_samp>
- #define ADMIN_ONLY //Comment this out or remove it if you wish to allow all player to use these commands
- #define PICKUP_FILE "script_lines/pickups.txt" //The location of your pickups file
- #define MAPICON_FILE "script_lines/mapicons.txt" //The location of your map icons file
- #define COORDS_FILE "script_lines/coords.txt" //The location of your coords file
- #define VEHICLE_FILE "script_lines/vehs.txt" //The location of your vehicle file
- #define TEXTLABEL_FILE "script_lines/textlabels.txt" //The location of your 3D Text Label file.
- #define CP_FILE "script_lines/checkpoints.txt" //The location of your checkpoint saving file.
- #define DEFAULT_CP_SIZE 5.0 //Your default checkpoint size that is use in the /makecp command.
- #define dcmd(%1,%2,%3) if (!strcmp((%3)[1], #%1, true, (%2)) && ((((%3)[(%2) + 1] == '\0') && (dcmd_%1(playerid, ""))) || (((%3)[(%2) + 1] == ' ') && (dcmd_%1(playerid, (%3)[(%2) + 2]))))) return 1
- #define COLOUR 0xFF00FFFF
- public OnFilterScriptInit()
- {
- print("Line Maker Loaded");
- }
- public OnPlayerCommandText(playerid, cmdtext[])
- {
- dcmd(makepickup, 10, cmdtext);
- dcmd(makemapicon, 11, cmdtext);
- dcmd(makepos, 7, cmdtext);
- dcmd(makevehicle, 11, cmdtext);
- dcmd(maketextlabel, 13, cmdtext);
- dcmd(makecp, 6, cmdtext);
- return 0;
- }
- dcmd_makepickup(playerid, params[])
- {
- #if defined ADMIN_ONLY
- if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, COLOUR, "Admin Required");
- #endif
- new idx, Float:x, Float:y, Float:z;
- GetPlayerPos(playerid, x, y, z);
- FindSpace(params, idx);
- if(idx == strlen(params)) return SendClientMessage(playerid, COLOUR, "Usage: /makepickup [modelid] [comment]");
- new orig[64];
- format(orig, sizeof(orig), "%s", params); //All will become clear, read on ;)
- strdel(orig, idx, strlen(orig));
- strdel(params, 0, idx);
- new string[128];
- format(string, sizeof(string), "CreatePickup(%i, 0, %f, %f, %f, 0); //%s", strval(orig), x, y, z, params);
- WriteData(PICKUP_FILE, string);
- format(string, sizeof(string), "Pickup line made: %s", string);
- SendClientMessage(playerid, COLOUR, string);
- return 1;
- }
- dcmd_makemapicon(playerid, params[])
- {
- #if defined ADMIN_ONLY
- if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, COLOUR, "Admin Required");
- #endif
- new idx, Float:x, Float:y, Float:z;
- GetPlayerPos(playerid, x, y, z);
- FindSpace(params, idx);
- if(idx == strlen(params)) return SendClientMessage(playerid, COLOUR, "Usage: /makemapicon [mapiconid] [comment]");
- new orig[64];
- format(orig, sizeof(orig), "%s", params); //And again...
- strdel(orig, idx, strlen(orig));
- strdel(params, 0, idx);
- new string[128];
- format(string, sizeof(string), "SetPlayerMapIcon(playerid, 0, %f, %f, %f, %i, 0, MAPICON_LOCAL); //%s", x, y, z, strval(orig), params);
- WriteData(MAPICON_FILE, string);
- format(string, sizeof(string), "Mapicon line made: %s", string);
- SendClientMessage(playerid, COLOUR, string);
- return 1;
- }
- dcmd_makepos(playerid, params[])
- {
- #if defined ADMIN_ONLY
- if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, COLOUR, "Admin Required");
- #endif
- if(!strlen(params)) return SendClientMessage(playerid, COLOUR, "Usage: /makepos [comment]");
- new Float:x, Float:y, Float:z, Float:fa;
- GetPlayerPos(playerid, x, y, z);
- GetPlayerFacingAngle(playerid, fa);
- new string[128];
- format(string, sizeof(string), "%f, %f, %f, %f //%s", x, y, z, fa, params);
- WriteData(COORDS_FILE, string);
- format(string, sizeof(string), "(Raw) Position Line Made: %s", string);
- SendClientMessage(playerid, COLOUR, string);
- return 1;
- }
- dcmd_makevehicle(playerid, params[])
- {
- #if defined ADMIN_ONLY
- if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, COLOUR, "Admin required");
- #endif
- if(!strlen(params)) return SendClientMessage(playerid, COLOUR, "Usage /makevehicle [model id] [comment]");
- new Float:x, Float:y, Float:z, Float:af, string[128], idx;
- FindSpace(params, idx);
- if(idx == strlen(params)) return SendClientMessage(playerid, COLOUR, "Usage: /makevehicle [model id] [comment]");
- GetPlayerPos(playerid, x, y, z);
- GetPlayerFacingAngle(playerid, af);
- new orig[64];
- format(orig, 64, params);
- strdel(orig, idx, strlen(params));
- strdel(params, 0, idx);
- if(!IsValidVehicleModel(strval(orig))) return SendClientMessage(playerid, COLOUR, "Invalid Vehicle Model");
- format(string, sizeof(string), "CreateVehicle(%i, %f, %f, %f, %f, -1, -1, -1); //%s", strval(orig), x, y, z, af, params);
- WriteData(VEHICLE_FILE, string);
- format(string, sizeof(string), "Vehicle Line Made: %s", string);
- SendClientMessage(playerid, COLOUR, string);
- return 1;
- }
- dcmd_maketextlabel(playerid, params[])
- {
- #if defined ADMIN_ONLY
- if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, COLOUR, "Admin required");
- #endif
- if(!strlen(params)) return SendClientMessage(playerid, COLOUR, "Usage: /maketextlabel [text] [comment]");
- new Float:x, Float:y, Float:z, string[128], idx;
- FindSpace(params, idx);
- if(idx == strlen(params)) return SendClientMessage(playerid, COLOUR, "Usage: /maketextlabel [text] [comment]");
- GetPlayerPos(playerid, x, y, z);
- new orig[128];
- format(orig, 128, params);
- strdel(orig, idx, strlen(params));
- strdel(params, 0, idx);
- format(string, sizeof(string), "Create3DTextLabel(\"%s\", COLOUR, %f, %f, %f, 20.0, 0, 0); //%s", orig, x, y, z, params);
- WriteData(TEXTLABEL_FILE, string);
- format(string, sizeof(string), "Text Label Line Made: %s", string);
- SendClientMessage(playerid, COLOUR, string);
- return 1;
- }
- dcmd_makecp(playerid, params[])
- {
- #if defined ADMIN_ONLY
- if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, COLOUR, "Admin Required");
- #endif
- new idx, Float:x, Float:y, Float:z;
- GetPlayerPos(playerid, x, y, z);
- FindSpace(params, idx);
- if(idx == strlen(params)) return SendClientMessage(playerid, COLOUR, "Usage: /makecp [comment]");
- strdel(params, 0, idx);
- new string[128];
- format(string, sizeof(string), "SetPlayerCheckpoint(playerid, %f, %f, %f, %f); // %s", x, y, z, DEFAULT_CP_SIZE, params);
- WriteData(CP_FILE, string);
- format(string, sizeof(string), "Checkpoint line made: %s", string);
- SendClientMessage(playerid, COLOUR, string);
- return 1;
- }
- stock WriteData(file[], data[])
- {
- new str[256];
- format(str, sizeof(str), "%s\r\n", data);
- new File:f = fopen(file, io_append);
- fwrite(f, str);
- fclose(f);
- }
- stock FindSpace(str[], &idx)
- {
- new len = strlen(str);
- for(new i; i < len; i++)
- {
- idx++;
- if(str[i] == ' ')
- {
- return idx;
- }
- }
- return len;
- }
- stock IsValidVehicleModel(vid)
- {
- if(vid > 399 && vid < 612)
- {
- return 1;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement