Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // mascii's simple anti-vehicle FS
- // Edited by Kinetic, but all credits still go to mascii
- #include <a_samp>
- #include <utils>
- #define COLOR_GREY 0xAFAFAFAA
- forward strtok(const string[], &index);
- new Antiv[MAX_PLAYERS];
- //0 = off
- //1 = on
- public OnFilterScriptInit()
- {
- return 1;
- }
- public OnPlayerConnect(playerid)
- {
- Antiv[playerid] = 1;
- return 1;
- }
- public OnPlayerStateChange(playerid, newstate, oldstate)
- {
- if(newstate == PLAYER_STATE_PASSENGER || PLAYER_STATE_DRIVER)
- {
- if (Antiv[playerid] == 0)
- {
- RemovePlayerFromVehicle(playerid);
- }
- }
- return 1;
- }
- public OnPlayerCommandText(playerid, cmdtext[])
- {
- new idx;
- new cmd[64];
- new tmp[128];
- new str[128];
- cmd = strtok(cmdtext, idx);
- if(strcmp(cmd, "/antiv", true) == 0)
- {
- if (IsPlayerAdmin(playerid) == 1)
- {
- tmp = strtok(cmdtext, idx);
- if(!strlen(tmp))
- {
- SendClientMessage(playerid, COLOR_GREY, "/antiv [playerid]");
- return 1;
- }
- new tmpplayer = ReturnUser(tmp);
- if(Antiv[tmpplayer] == 0)
- {
- new name[MAX_PLAYER_NAME];
- GetPlayerName(tmpplayer, name, sizeof(name));
- format(str, sizeof(str), "You have disabled vehicle entry for %s(ID:%d)", name, tmpplayer);
- SendClientMessage(playerid, COLOR_GREY, str);
- SendClientMessage(tmpplayer, COLOR_GREY, "Admin has disabled your vehicle entry privlages");
- Antiv[tmpplayer] = 1;
- }
- if(Antiv[tmpplayer] == 1)
- {
- new name[MAX_PLAYER_NAME];
- GetPlayerName(tmpplayer, name, sizeof(name));
- format(str, sizeof(str), "You have enabled vehicle entry for %s(ID:%d)", name, tmpplayer);
- SendClientMessage(playerid, COLOR_GREY, str);
- SendClientMessage(tmpplayer, COLOR_GREY, "Admin has enabled your vehicle entry privlages");
- Antiv[tmpplayer] = 0;
- }
- }
- }
- if(strcmp(cmdtext, "/antiv on", true) == 0)
- {
- if (IsPlayerAdmin(playerid) == 1)
- {
- SendClientMessageToAll(COLOR_GREY,"Admin has turned the use of Vehicles on");
- for(new i=0; i<=GetMaxPlayers(); i++)
- {
- Antiv[i] = 1;
- }
- }
- return 1;
- }
- if(strcmp(cmdtext, "/antiv off", true) == 0)
- {
- if (IsPlayerAdmin(playerid) == 1)
- {
- SendClientMessageToAll(COLOR_GREY,"Admin has turned the use of Vehicles off");
- for(new i=0; i<=GetMaxPlayers(); i++)
- {
- Antiv[i] = 0;
- }
- }
- return 1;
- }
- return 0;
- }
- strtok(const string[], &index) // Strtok
- {
- new length = strlen(string);
- while ((index < length) && (string[index] <= ' '))
- {
- index++;
- }
- new offset = index;
- new result[20];
- while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))
- {
- result[index - offset] = string[index];
- index++;
- }
- result[index - offset] = EOS;
- return result;
- }
Advertisement
Add Comment
Please, Sign In to add comment