Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <a_samp>
- #define zlta 0xFFFF00AA //yelloW
- new str[256];
- new Float:Pos[MAX_PLAYERS][4];
- new PosSelected[MAX_PLAYERS];
- public OnFilterScriptInit()
- {
- print("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~");
- print("~ ~");
- print("~ InGame Coordinates saver by Nolo ~");
- print("~ ~");
- print("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~");
- return 1;
- }
- public OnPlayerCommandText(playerid,cmdtext[])
- {
- new cmd[256],idx;
- cmd = strtok(cmdtext,idx);
- if(!strcmp(cmdtext,"/savecoo",true,4))
- {
- GetPlayerPos(playerid,Pos[playerid][0],Pos[playerid][1],Pos[playerid][2]);
- GetPlayerFacingAngle(playerid,Pos[playerid][3]);
- PosSelected[playerid] = 1;
- format(str,256,"Coordinates succesfully defined: %.4f,%.4f,%.4f ",Pos[playerid][0],Pos[playerid][1],Pos[playerid][2],Pos[playerid][3]);
- SendClientMessage(playerid,zlta,str);
- new File:fhandle;
- fhandle = fopen("coordinates.txt",io_append);
- fwrite(fhandle,str);
- fclose(fhandle);
- SendClientMessage(playerid,zlta,"Your coordinates has been saved in the file 'coordinates.txt' in your scriptfiles");
- PosSelected[playerid] = 0;
- return 1;
- }
- return 0;
- }
- strtok(const string[], &index)
- {
- new length = strlen(string);
- while ((index < length) && (string[index] <= ' ') && (string[index] > '\r'))
- {
- index++;
- }
- new offset = index;
- new result[30];
- while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)) && (string[index] > '\r'))
- {
- result[index - offset] = string[index];
- index++;
- }
- result[index - offset] = EOS;
- return result;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement