Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- Данный ФС работает только с ZCMD
- Описание:
- Позволяет использовать через RCON консоль
- команды из игрового мода.
- Copyright © 2010 Fro
- **/
- #include <a_samp>
- #define VERSION "0.2"
- #define isnull(%1) ((!(%1[0])) || (((%1[0]) == '\1') && (!(%1[1]))))
- public OnFilterScriptInit()
- {
- print(" ");
- print("_____________________________________");
- printf(" Сервер использует RconCall v %s\n", VERSION);
- print("_____________________________________");
- print(" By: Fro (c) Copyright 2009-2010, TBG\n");
- return 1;
- }
- public OnFilterScriptExit()
- {
- printf("\n RconCall v %s выгружен\n", VERSION);
- return 1;
- }
- public OnRconCommand(cmd[])
- {
- new
- command[32],
- result[64];
- sparam(command, 32, cmd, 0);
- if(!strcmp(command, "cmd"))
- {
- sparam(command, 32, cmd, 1);
- sparam(result, 64, cmd, 2, 1);
- if(isnull(result)) result = " ";
- format(command, 32, "cmd_%s", command);
- CallRemoteFunction(command, "is", -1, result);
- }
- return 1;
- }
- stock sparam
- (
- dest[], maxSize = sizeof(dest),
- const source[], substrIndex = 0,
- withRest = 0, delimiter = ' '
- )
- {
- dest[0] = 0; // очистим строку назначения
- for ( new cur, pre, i = -1; ; cur++ ) // пробежимся по каждому символу в строке source
- {
- if ( source[cur] == 0 ) // если текущий символ в source - это символ конца строки
- {
- if ( ++i == substrIndex ) // если индекс текущей подстроки и есть sourceIndex
- // скопируем в dest нужную подстроку из source
- strmid( dest, source, pre, ( withRest ? strlen(source) : cur ), maxSize );
- goto sparam_end;
- }
- if ( source[cur] == delimiter ) // если текущий символ в source - это символ для разделения строки
- {
- if ( ++i == substrIndex ) // если индекс текущей подстроки и есть sourceIndex
- {
- // скопируем в dest нужную подстроку из source
- strmid( dest, source, pre, ( withRest ? strlen(source) : cur ), maxSize );
- goto sparam_end;
- }
- pre = cur + 1;
- }
- }
- sparam_end:
- return 1; // завершим работу функции
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement