Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* Sistema para guardar las posiciones */ /* BadyX */
- /*
- [img]http://imageshack.us/a/img210/5773/posij.jpg[/img]
- [IMG]http://imageshack.us/a/img252/7053/posi2.jpg[/IMG]
- */
- #include <a_samp>
- new Float:CoordenadasX[MAX_PLAYERS];
- new Float:CoordenadasY[MAX_PLAYERS];
- new Float:CoordenadasZ[MAX_PLAYERS];
- #if defined FILTERSCRIPT
- #else
- main(){}
- #endif
- public OnPlayerCommandText(playerid, cmdtext[])
- {
- new cmd[128];
- new string[120];
- new idx;
- cmd = strtokex(cmdtext, idx);
- if(strcmp(cmd, "/mysave", true) == 0) /* BadyX */
- {
- if(IsPlayerConnected(playerid))
- {
- new length = strlen(cmdtext);
- while ((idx < length) && (cmdtext[idx] <= ' '))
- {
- idx++;
- }
- new offset = idx;
- new result[128];
- while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
- {
- result[idx - offset] = cmdtext[idx];
- idx++;
- }
- result[idx - offset] = EOS;
- if(!strlen(result)) return SendClientMessage(playerid, -1, "USO: /mysave [Nombre]");
- GetPlayerPos(playerid, CoordenadasX[playerid],CoordenadasY[playerid],CoordenadasZ[playerid]);
- format(string, sizeof(string), "(( %s )) SetPlayerPos(playerid,%f,%f,%f);",result, CoordenadasX, CoordenadasY, CoordenadasZ);
- PosicionesLog(string);
- SendClientMessage(playerid, -1, # Posicion guardada);
- }
- return 1;
- }
- return 0;
- }
- forward PosicionesLog(stringe[]); /* BadyX */
- public PosicionesLog(stringe[])
- {
- new entry[256];
- format(entry, sizeof(entry), "%s\r\n",stringe);
- new File:hFile;
- hFile = fopen("Posiciones.ini", io_append);
- fwrite(hFile, entry);
- fclose(hFile);
- }
- stock strtokex(const stringe[], &index) /* ¿? */
- {
- new length = strlen(stringe);
- while ((index < length) && (stringe[index] <= ' '))
- {
- index++;
- }
- new offset = index;
- new result[20];
- while ((index < length) && (stringe[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))
- {
- result[index - offset] = stringe[index];
- index++;
- }
- result[index - offset] = EOS;
- return result;
- }
- //============================================================================//
- // //
- // SI TE SIRVIO //
- // //
- // RESPETA EL TRABAJO DEL CREADOR //
- // //
- //============================================================================//
Advertisement
Add Comment
Please, Sign In to add comment