Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- Hilfreiche Admin Befehle by Lukas aka DreamYy
- Copyrigth darf entfernt werden.
- 22:30
- */
- #define FILTERSCRIPT
- #define ROT 0xE10000FF
- #include <a_samp>
- #include <dini>
- #include <ocmd>
- #if defined FILTERSCRIPT
- public OnFilterScriptInit()
- {
- print("\n--------------------------------------");
- print(" Hilfreiche Befehle by DreamYy ");
- print("--------------------------------------\n");
- return 1;
- }
- public OnFilterScriptExit()
- {
- return 1;
- }
- #else
- main()
- {
- print("\n----------------------------------");
- print(" ");
- print("----------------------------------\n");
- }
- #endif
- ///////////////// Befehle //////////////////
- // 1. /veh
- ocmd:veh(playerid,params[])
- {
- new AutoID, farbe[2],Float:VehPos[4], vehicleid;
- if(GetPlayerState(playerid)!=PLAYER_STATE_ONFOOT) return SendClientMessage(playerid,0xB0AFB0FF,"Du bist vereits in einem Auto!");
- if(sscanf(params, "ddd",AutoID,farbe[0],farbe[1])) return SendClientMessage(playerid,0xB0AFB0FF, "/veh [AutoID] [Farbe1] [Farbe2]");
- if(AutoID < 400 || AutoID > 611) return SendClientMessage(playerid,0xB0AFB0FF, "Diese Auto ID existiert nicht.");
- if(farbe[0] < 0 || farbe[0] > 126 || farbe[1] < 0 || farbe[1] > 126) return SendClientMessage(playerid,0xB0AFB0FF, "Wähle eine Farbe zwischen 0 und 126.");
- //ADMIN ABFRAGE
- GetPlayerPos(playerid, VehPos[0],VehPos[1],VehPos[2]);
- GetPlayerFacingAngle(playerid, VehPos[3]);
- vehicleid = CreateVehicle(AutoID,VehPos[0],VehPos[1],VehPos[2],VehPos[3],farbe[0],farbe[1],-1);
- LinkVehicleToInterior(vehicleid,GetPlayerInterior(playerid));
- SetVehicleVirtualWorld(vehicleid,GetPlayerVirtualWorld(playerid));
- PutPlayerInVehicle(playerid, vehicleid, 0);
- return 1;
- }
- // 2. /kick
- ocmd:kick(playerid,params[])
- {
- new SpielerID, Grund[128],string[128];
- //Admin Abfrage
- if(sscanf(params,"us",SpielerID,Grund))return SendClientMessage(playerid,ROT,"Benutze: /kick [id] [grund]");
- format(string,sizeof(string),"AdmCmd: %s wurde von %s gekickt. Grund: %s",SpielerName(SpielerID),SpielerName(playerid),Grund);
- SendClientMessageToAll(ROT,string);
- Kick(SpielerID);
- return 1;
- }
- // 3. /goto
- ocmd:goto(playerid,params[])
- {
- new SpielerID, Float: X, Float: Y, Float: Z, Float: Angle;
- new string[64];
- if(sscanf(params,"d",SpielerID))return SendClientMessage(playerid,ROT,"Benutze: /goto [playerid]");
- GetPlayerPos(SpielerID,X,Y,Z);
- GetPlayerFacingAngle(SpielerID,Angle);
- SetPlayerPos(playerid,X,Y,Z);
- SetPlayerFacingAngle(playerid,Angle);
- format(string,sizeof(string),"Der Administrator %s hat sich zu dir geportet!",SpielerName(playerid));
- SendClientMessage(SpielerID,ROT,string);
- return 1;
- }
- // 4. /gethere
- ocmd:gethere(playerid,params[])
- {
- new SpielerID, Float: X, Float: Y, Float: Z, Float: Angle;
- new string[64];
- if(sscanf(params,"d",SpielerID))return SendClientMessage(playerid,ROT,"/gethere [playerid]");
- GetPlayerPos(playerid,X,Y,Z);
- GetPlayerFacingAngle(playerid,Angle);
- SetPlayerPos(SpielerID,X,Y,Z);
- SetPlayerFacingAngle(SpielerID,Angle);
- format(string,sizeof(string),"Der Administrator %s hat dich zu ihm geportet!",SpielerName(playerid));
- SendClientMessage(SpielerID,ROT,string);
- return 1;
- }
- // 5. /afreeze
- ocmd:afreeze(playerid,params[])
- {
- new SpielerID, str[64];
- if(sscanf(params,"uz",SpielerID,str)) return SendClientMessage(playerid,ROT,"Benutze: /afreeze [playerid][Grund]");
- new Player[MAX_PLAYER_NAME] , str2[128];
- GetPlayerName(SpielerID,Player,sizeof(Player));
- format(str2,sizeof(str2),"%s wurde vom Admin %s gefreezed Grund : %s",Player,SpielerName(playerid),str);
- SendClientMessageToAll(ROT,str2);
- TogglePlayerControllable(SpielerID, 0);
- return 1;
- }
- // 6. /aunfreeze
- ocmd:aunfreeze(playerid,params[])
- {
- new SpielerID, str[64];
- if(sscanf(params,"u",SpielerID,str)) return SendClientMessage(playerid,ROT,"Benutze: /aunfreeze [Spieler ID]");
- new Player[MAX_PLAYER_NAME] , str2[128];
- GetPlayerName(SpielerID,Player,sizeof(Player));
- format(str2,sizeof(str2),"%s wurde entfreezed.",Player);
- SendClientMessageToAll(ROT,str2);
- TogglePlayerControllable(SpielerID, 1);
- return 1;
- }
- stock SpielerName(playerid)
- {
- new name[MAX_PLAYER_NAME];
- GetPlayerName(playerid,name,sizeof(name));
- return name;
- }
- stock sscanf(sstring[], format[], {Float,_}:...)
- {
- #if defined isnull
- if (isnull(sstring))
- #else
- if (sstring[0] == 0 || (sstring[0] == 1 && sstring[1] == 0))
- #endif
- {
- return format[0];
- }
- #pragma tabsize 4
- new
- formatPos = 0,
- sstringPos = 0,
- paramPos = 2,
- paramCount = numargs(),
- delim = ' ';
- while (sstring[sstringPos] && sstring[sstringPos] <= ' ')
- {
- sstringPos++;
- }
- while (paramPos < paramCount && sstring[sstringPos])
- {
- switch (format[formatPos++])
- {
- case '\0':
- {
- return 0;
- }
- case 'i', 'd':
- {
- new
- neg = 1,
- num = 0,
- ch = sstring[sstringPos];
- if (ch == '-')
- {
- neg = -1;
- ch = sstring[++sstringPos];
- }
- do
- {
- sstringPos++;
- if ('0' <= ch <= '9')
- {
- num = (num * 10) + (ch - '0');
- }
- else
- {
- return -1;
- }
- }
- while ((ch = sstring[sstringPos]) > ' ' && ch != delim);
- setarg(paramPos, 0, num * neg);
- }
- case 'h', 'x':
- {
- new
- num = 0,
- ch = sstring[sstringPos];
- do
- {
- sstringPos++;
- switch (ch)
- {
- case 'x', 'X':
- {
- num = 0;
- continue;
- }
- case '0' .. '9':
- {
- num = (num << 4) | (ch - '0');
- }
- case 'a' .. 'f':
- {
- num = (num << 4) | (ch - ('a' - 10));
- }
- case 'A' .. 'F':
- {
- num = (num << 4) | (ch - ('A' - 10));
- }
- default:
- {
- return -1;
- }
- }
- }
- while ((ch = sstring[sstringPos]) > ' ' && ch != delim);
- setarg(paramPos, 0, num);
- }
- case 'c':
- {
- setarg(paramPos, 0, sstring[sstringPos++]);
- }
- case 'f':
- {
- new changestr[16], changepos = 0, strpos = sstringPos;
- while(changepos < 16 && sstring[strpos] && sstring[strpos] != delim)
- {
- changestr[changepos++] = sstring[strpos++];
- }
- changestr[changepos] = '\0';
- setarg(paramPos,0,_:floatstr(changestr));
- }
- case 'p':
- {
- delim = format[formatPos++];
- continue;
- }
- case '\'':
- {
- new
- end = formatPos - 1,
- ch;
- while ((ch = format[++end]) && ch != '\'') {}
- if (!ch)
- {
- return -1;
- }
- format[end] = '\0';
- if ((ch = strfind(sstring, format[formatPos], false, sstringPos)) == -1)
- {
- if (format[end + 1])
- {
- return -1;
- }
- return 0;
- }
- format[end] = '\'';
- sstringPos = ch + (end - formatPos);
- formatPos = end + 1;
- }
- case 'u':
- {
- new
- end = sstringPos - 1,
- id = 0,
- bool:num = true,
- ch;
- while ((ch = sstring[++end]) && ch != delim)
- {
- if (num)
- {
- if ('0' <= ch <= '9')
- {
- id = (id * 10) + (ch - '0');
- }
- else
- {
- num = false;
- }
- }
- }
- if (num && IsPlayerConnected(id))
- {
- setarg(paramPos, 0, id);
- }
- else
- {
- #if !defined foreach
- #define foreach(%1,%2) for (new %2 = 0; %2 < MAX_PLAYERS; %2++) if (IsPlayerConnected(%2))
- #define __SSCANF_FOREACH__
- #endif
- sstring[end] = '\0';
- num = false;
- new
- name[MAX_PLAYER_NAME];
- id = end - sstringPos;
- foreach (Player, playerid)
- {
- GetPlayerName(playerid, name, sizeof (name));
- if (!strcmp(name, sstring[sstringPos], true, id))
- {
- setarg(paramPos, 0, playerid);
- num = true;
- break;
- }
- }
- if (!num)
- {
- setarg(paramPos, 0, INVALID_PLAYER_ID);
- }
- sstring[end] = ch;
- #if defined __SSCANF_FOREACH__
- #undef foreach
- #undef __SSCANF_FOREACH__
- #endif
- }
- sstringPos = end;
- }
- case 's', 'z':
- {
- new
- i = 0,
- ch;
- if (format[formatPos])
- {
- while ((ch = sstring[sstringPos++]) && ch != delim)
- {
- setarg(paramPos, i++, ch);
- }
- if (!i)
- {
- return -1;
- }
- }
- else
- {
- while ((ch = sstring[sstringPos++]))
- {
- setarg(paramPos, i++, ch);
- }
- }
- sstringPos--;
- setarg(paramPos, i, '\0');
- }
- default:
- {
- continue;
- }
- }
- while (sstring[sstringPos] && sstring[sstringPos] != delim && sstring[sstringPos] > ' ')
- {
- sstringPos++;
- }
- while (sstring[sstringPos] && (sstring[sstringPos] == delim || sstring[sstringPos] <= ' '))
- {
- sstringPos++;
- }
- paramPos++;
- }
- do
- {
- if ((delim = format[formatPos++]) > ' ')
- {
- if (delim == '\'')
- {
- while ((delim = format[formatPos++]) && delim != '\'') {}
- }
- else if (delim != 'z')
- {
- return delim;
- }
- }
- }
- while (delim > ' ');
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement