Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <a_samp>
- #include <zcmd>
- #define funcion%0(%1) forward %0(%1); public %0(%1)
- enum sRecords
- {
- CantidadJugadores,
- };
- new SistemaDeRecords[sRecords];
- new TotalJugadores = 0;
- #if defined FILTERSCRIPT
- public OnFilterScriptInit()
- {
- CargarRecord();
- return 1;
- }
- #else
- main(){}
- #endif
- public OnPlayerConnect(playerid)
- {
- TotalJugadores ++;
- ComprobarRecord();
- return 1;
- }
- public OnPlayerDisconnect(playerid, reason)
- {
- TotalJugadores --;
- return 1;
- }
- funcion CargarRecord()
- {
- new arrCoords[1][64];
- new strFromFile2[256];
- new File: file = fopen("Records/Records.ini", io_read);
- if (file)
- {
- fread(file, strFromFile2);
- split(strFromFile2, arrCoords, ',');
- SistemaDeRecords[CantidadJugadores] = strval(arrCoords[0]);
- fclose(file);
- }
- return 1;
- }
- funcion GuardarRecord()
- {
- new coordsstring[256];
- format(coordsstring, sizeof(coordsstring), "%d", SistemaDeRecords[CantidadJugadores]);
- new File: file2 = fopen("Records/Records.ini", io_write);
- fwrite(file2, coordsstring);
- fclose(file2);
- return 1;
- }
- funcion ComprobarRecord()
- {
- new Anterior = SistemaDeRecords[CantidadJugadores] -1;
- new string[75];
- if(TotalJugadores > SistemaDeRecords[CantidadJugadores])
- {
- SendClientMessageToAll(-1, "|_________ Atención _________|");
- SendClientMessageToAll(-1, "");
- SendClientMessageToAll(-1, "El record de usuarios a sido superado!.");
- format(string,128,"[!] Record anterior %d ",Anterior);
- SendClientMessageToAll(-1,string);
- format(string,128,"[!] Nuevo record %d ",SistemaDeRecords[CantidadJugadores]);
- SendClientMessageToAll(-1,string);
- SistemaDeRecords[CantidadJugadores] ++;
- GuardarRecord();
- return 1;
- }
- return 1;
- }
- funcion split(const strsrc[], strdest[][], delimiter)
- {
- new i, li;
- new aNum;
- new len;
- while(i <= strlen(strsrc)){
- if(strsrc[i]==delimiter || i==strlen(strsrc)){
- len = strmid(strdest[aNum], strsrc, li, i, 128);
- strdest[aNum][len] = 0;
- li = i+1;
- aNum++;
- }
- i++;
- }
- return 1;
- }
- /* Comandos */
- CMD:verrecord(playerid, params[])
- {
- new string[25];
- format(string, sizeof(string), "[Info] Record actual %d", SistemaDeRecords[CantidadJugadores]);
- SendClientMessage(playerid, -1, string);
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment