trying to install foreach
#1

edited last post

compiled/ran the filterscript, added it into my server but no commands work, no why?

Код:
// This is a comment
// uncomment the line below if you want to write a filterscript
#define FILTERSCRIPT
#include <a_samp>
#include <zcmd>
#include <YSI\y_timers>
#include <sscanf2>
#define COLOR_ERROR             0xFF0000AA
#define COLOR_PM                0xFF0000AA
#define green 		 0x33FF33AA
#define yellow 		 0xFFFF00AA
#define COLOR_FADE1 0xC2A2DAAA
#define COLOR_FADE2 0xFFFFFFAA
#define COLOR_FADE3 0xAAAAAAAA
#define COLOR_FADE4 0x8C8C8C8C
#define COLOR_FADE5 0x6E6E6E6E
#define color_GREEN 0x9FFF00FF
#define LIGHTGREEN 	 0x38FF06FF
#define LIGHTBLUE2   0xF6BB0AA
#define LIGHTBLUE    0x0BBF6AA
#define COLOR_PINK   0xFF66FFAA
#define COLOR_BLUE 	 0x0000BBAA
#define COLOR_PURPLE 0x800080AA
#define COLOR_GOVERNMENT 0x8A2BE2AA
#define COLOR_WHITE 0xFFFFFFFF
#define COLOR_GREY 0xAFAFAFFF
#define COLOR_RED 0xFF0000AA
#define COLOR_YELLOW 0xFFFF00FF
#define COLOR_PDBLUE 0x2641FEAA
#define COLOR_ORANGE 0xFF9900AA
new HasBoughtMask[MAX_PLAYERS];
new HasBoughtCigar[MAX_PLAYERS];
new HasBoughtBeer[MAX_PLAYERS];
new HasDrivingLic[MAX_PLAYERS];
new HasGunLic[MAX_PLAYERS];
new HasFlyingLic[MAX_PLAYERS];
new bool:maskonface[MAX_PLAYERS] = false;
new TogPM[MAX_PLAYERS];
new AdvTimer1;

#pragma tabsize 0
#if defined FILTERSCRIPT

//========================END OF DEFINES=========START OF COMMANDS==================================================================

CMD:cigar(playerid, params[])
{
if(HasBoughtCigar[playerid] == 1)
SetPlayerSpecialAction(playerid, SPECIAL_ACTION_SMOKE_CIGGY);
else if(HasBoughtCigar[playerid] == 0)
SendClientMessage(playerid, COLOR_RED, "You dont have any cigars, head to the 24/7 to buy some!");
return 1;
}

CMD:beer(playerid, params[])
{
if(HasBoughtBeer[playerid] == 1)
SetPlayerSpecialAction(playerid,SPECIAL_ACTION_DRINK_BEER );
else if(HasBoughtBeer[playerid] == 0)
SendClientMessage(playerid, COLOR_RED, "You dont have beer, head to the 24/7 to buy one !");
return 1;
}

CMD:maskon(playerid, params[])
{
	if(maskonface[playerid] == true) return SendClientMessage(playerid,COLOR_RED,"You are already masked!");
	if(IsPlayerConnected(playerid))
	if(HasBoughtMask[playerid] == 1)
	{
	SendClientMessage(playerid, COLOR_FADE2,"You have put a mask on your face!");
	for(new i = 0; i < MAX_PLAYERS; i++)
	{
	maskonface[playerid] = true;
	ApplyAnimation(playerid, "SHOP", "ROB_Shifty", 4.0, 0, 0, 0, 0, 0);
	ShowPlayerNameTagForPlayer(i, playerid, false);
 	}
   	}
	else if(HasBoughtMask[playerid] == 0)
	SendClientMessage(playerid, COLOR_RED, "You dont have a mask, head to the 24/7 to buy one !");
    return 1;
}

CMD:maskoff(playerid, params[])
{
	if(maskonface[playerid] == false) return SendClientMessage(playerid,COLOR_RED,"You are not masked!");
	if(IsPlayerConnected(playerid))
	{
	for(new i = 0; i < MAX_PLAYERS; i++)
	{
	if(IsPlayerConnected(i))
	{
 	maskonface[playerid] = false;
 	ApplyAnimation(playerid, "MISC", "plyr_shkhead", 4.0, 0, 0, 0, 0, 0);
 	ShowPlayerNameTagForPlayer(i, playerid, true);
 	}
 	}
 	SendClientMessage(playerid, COLOR_FADE2, "You took the mask off your face!");
 	}
 	return 1;
}


CMD:me(playerid, params[])
{
    new textv2[128];
    if(sscanf(params, "s[128]", params)) return SendClientMessage(playerid, COLOR_WHITE, "Usage: /me [action]");
    if(maskonface[playerid] == true)
	{
    format(textv2, sizeof (textv2), "* Stranger %s", params);
    if(AntiAdv(playerid, params)) return 1;
    NearMessageSender(playerid, 6, textv2, COLOR_FADE1,COLOR_FADE1,COLOR_FADE1,COLOR_FADE1,COLOR_FADE1);
	return 1;
	}
	else
	if(maskonface[playerid] == false)
	{
	format(textv2, sizeof(textv2), "* %s %s", NAMEGET(playerid), params);
    NearMessageSender(playerid, 6, textv2, COLOR_FADE1,COLOR_FADE1,COLOR_FADE1,COLOR_FADE1,COLOR_FADE1);
	return 1;
	}
	return 1;
}

CMD:do(playerid, params[])
{
    new textv2[128];
    if(sscanf(params, "s[128]", params)) return SendClientMessage(playerid, COLOR_WHITE, "Usage: /do [action]");
    if(maskonface[playerid] == true)
	{
    format(textv2, sizeof (textv2), "* %s ((Stranger))", params);
    if(AntiAdv(playerid, params)) return 1;
    NearMessageSender(playerid, 6, textv2, COLOR_FADE1,COLOR_FADE1,COLOR_FADE1,COLOR_FADE1,COLOR_FADE1);
	return 1;
	}
	else
	if(maskonface[playerid] == false)
	{
	format(textv2, sizeof(textv2), "* %s ((%s))", params, NAMEGET(playerid));
    NearMessageSender(playerid, 6, textv2, COLOR_FADE1,COLOR_FADE1,COLOR_FADE1,COLOR_FADE1,COLOR_FADE1);
	return 1;
	}
	return 1;
}

CMD:b(playerid, params[])
{
	new string[128];
	if(sscanf(params, "s[128]", params)) return SendClientMessage(playerid, COLOR_WHITE, "Usage: /b [text] (Local OOC Chat)");
	if(AntiAdv(playerid, params)) return 1;
	format(string, sizeof(string), "(( Local OOC: %s: %s ))", NAMEGET(playerid), params);
	NearMessageSender(playerid, 12, string, COLOR_FADE2,COLOR_FADE2,COLOR_FADE2,COLOR_FADE2,COLOR_FADE2);
	return 1;
}

CMD:shout(playerid, params[])
{
    new textv2[128];
    if(sscanf(params, "s[128]", params)) return SendClientMessage(playerid, COLOR_WHITE, "Usage: /shout [text]");
    if(maskonface[playerid] == true)
	{
    format(textv2, sizeof (textv2), "Stranger shouts: %s!", params);
    if(AntiAdv(playerid, params)) return 1;
    NearMessageSender(playerid, 15, textv2, COLOR_FADE2,COLOR_FADE2,COLOR_FADE2,COLOR_FADE2,COLOR_FADE2);
	return 1;
	}
	else
	if(maskonface[playerid] == false)
	{
	format(textv2, sizeof(textv2), "%s shouts: %s!", NAMEGET(playerid), params);
    NearMessageSender(playerid, 15, textv2, COLOR_FADE2,COLOR_FADE2,COLOR_FADE2,COLOR_FADE2,COLOR_FADE2);
	return 1;
	}
	return 1;
}


CMD:think(playerid, params[])
{
    new textv2[128];
    if(sscanf(params, "s[128]", params)) return SendClientMessage(playerid, COLOR_WHITE, "Usage: /think [text]");
    if(maskonface[playerid] == true)
	{
    format(textv2, sizeof (textv2), "Stranger thinks: %s", params);
    if(AntiAdv(playerid, params)) return 1;
    NearMessageSender(playerid, 6, textv2, COLOR_FADE1,COLOR_FADE1,COLOR_FADE1,COLOR_FADE1,COLOR_FADE1);
	return 1;
	}
	else
	if(maskonface[playerid] == false)
	{
	format(textv2, sizeof(textv2), "%s thinks: %s", NAMEGET(playerid), params);
    NearMessageSender(playerid, 6, textv2, COLOR_FADE1,COLOR_FADE1,COLOR_FADE1,COLOR_FADE1,COLOR_FADE1);
	return 1;
	}
	return 1;
}

CMD:low(playerid, params[])
{
    new textv2[128];
    if(sscanf(params, "s[128]", params)) return SendClientMessage(playerid, COLOR_WHITE, "Usage: /low [text]");
    if(maskonface[playerid] == true)
	{
    format(textv2, sizeof (textv2), "Stranger says low: %s", params);
    if(AntiAdv(playerid, params)) return 1;
    NearMessageSender(playerid, 3, textv2, COLOR_FADE1,COLOR_FADE1,COLOR_FADE1,COLOR_FADE1,COLOR_FADE1);
	return 1;
	}
	else
	if(maskonface[playerid] == false)
	{
	format(textv2, sizeof(textv2), "%s says low: %s", NAMEGET(playerid), params);
    NearMessageSender(playerid, 3, textv2, COLOR_FADE1,COLOR_FADE1,COLOR_FADE1,COLOR_FADE1,COLOR_FADE1);
	return 1;
	}
	return 1;
}

CMD:mp(playerid, params[])
{
	new string[128];
	new Skin;
  	Skin = GetPlayerSkin(playerid);
  	if(Skin == 265||Skin == 266||Skin == 267||Skin == 280||Skin == 282||Skin == 288||Skin == 165||Skin == 166||Skin == 284||Skin == 285||Skin == 286||Skin == 287||Skin == 283)
	if(sscanf(params, "s[128]", params)) return SendClientMessage(playerid, COLOR_WHITE, "Usage: /mp [text]");
	if(AntiAdv(playerid, params)) return 1;
	for(new i=0;i<MAX_PLAYERS;i++)
    if(GetPlayerSkin(i) == 265 || GetPlayerSkin(i) == 266 || GetPlayerSkin(i) == 267 || GetPlayerSkin(i) == 280 || GetPlayerSkin(i) == 282 || GetPlayerSkin(i) == 288 || GetPlayerSkin(i) == 165 || GetPlayerSkin(i) == 166 || GetPlayerSkin(i) == 284 || GetPlayerSkin(i) == 285 || GetPlayerSkin(i) == 286 || GetPlayerSkin(i) == 287)
    format(string, sizeof(string), "[MEGAPHONE: %s!!!]", params);
	NearMessageSender(playerid, 25, string, COLOR_BLUE,COLOR_BLUE,COLOR_BLUE,COLOR_BLUE,COLOR_BLUE);
	return 1;
}

CMD:gannounce(playerid, params[])
{
	new string[128];
	new Skin;
  	Skin = GetPlayerSkin(playerid);
  	if(Skin == 265||Skin == 266||Skin == 267||Skin == 280||Skin == 282||Skin == 288||Skin == 165||Skin == 166||Skin == 284||Skin == 285||Skin == 286||Skin == 287||Skin == 283)
	if(sscanf(params, "s[256]", params)) return SendClientMessage(playerid, COLOR_WHITE, "Usage: /gannounce [text]");
	if(AntiAdv(playerid, params)) return 1;
	format(string, sizeof(string), "[Government Announce: %s]", params);
	SendClientMessageToAll(COLOR_PDBLUE, string);
	return 1;
}

CMD:pay(playerid, params[])
{
	new string[128], playerb, amount;
	if(sscanf(params, "ui", playerb, amount)) return SendClientMessage(playerid, COLOR_RED, "Usage: /pay [playerid] [amount]");
	if(amount <= 0) return SendClientMessage(playerid, COLOR_RED, "Invalid money ammount.");
	if(playerid == playerb) return SendClientMessage(playerid, COLOR_RED, "You can't pay yourself.");
	if(!IsPlayerNearPlayer(playerid, playerb, 5.0)) return SendClientMessage(playerid, COLOR_RED, "You are too far away from that player.");
	if(GetPlayerMoney(playerid) < amount) return SendClientMessage(playerid, COLOR_RED, "You don't have that much money.");
	GivePlayerMoney(playerid, -amount);
	GivePlayerMoney(playerb, amount);
	format(string, sizeof(string), "** %s takes out $%d, passing them to %s", NAMEGET(playerid), amount, NAMEGET(playerb));
	NearMessageSender(playerid, 7, string, COLOR_FADE1,COLOR_FADE1,COLOR_FADE1,COLOR_FADE1,COLOR_FADE1);
	format(string, sizeof(string), " You have given %s $%d.", NAMEGET(playerb), amount);
	SendClientMessage(playerid, COLOR_RED, string);
	format(string, sizeof(string), " %s has given you $%d.", NAMEGET(playerid), amount);
	SendClientMessage(playerb, COLOR_RED, string);
    return 1;
}


CMD:cuff(playerid, params[])
{
	new targetid;
    new Skin;
	Skin = GetPlayerSkin(playerid);
	if(sscanf(params, "u", targetid)) return SendClientMessage(playerid, -1, "Usage: /cuff [id]");
    if(Skin == 265||Skin == 266||Skin == 267||Skin == 280||Skin == 282||Skin == 288||Skin == 165||Skin == 166||Skin == 284||Skin == 285||Skin == 286||Skin == 287||Skin == 283)
	if(IsPlayerConnected(targetid))
    {
    new Float:x, Float:y, Float:z;
    GetPlayerPos(playerid, x, y, z);
    if(IsPlayerInRangeOfPoint(targetid, 5.0, x, y, z))
    {
    new str[512];
    new name[MAX_PLAYER_NAME];
    GetPlayerName(playerid, name, sizeof(name));
    new target[MAX_PLAYER_NAME];
    GetPlayerName(targetid, target, sizeof(target));
 	format(str, sizeof(str), "You have cuffed %s!",target);
    SendClientMessage(playerid, 0x0000BBAA, str);
    format(str, sizeof(str), "You have been cuffed by Officer %s!",name);
    SendClientMessage(targetid, 0x0000BBAA, str);
    SetPlayerAttachedObject(targetid, 0, 19418, 6, -0.011000, 0.028000, -0.022000, -15.600012, -33.699977,-81.700035, 0.891999, 1.000000, 1.168000);//this will set the object cuffs at the hand of the player you want to cuff.
    SetPlayerSpecialAction(targetid,SPECIAL_ACTION_CUFFED);
    return 1;
    }

	}
    return 1;
}

CMD:uncuff(playerid, params[])
{

        new targetid;
		new Skin;
  		Skin = GetPlayerSkin(playerid);
        if(sscanf(params, "u", targetid)) return SendClientMessage(playerid, -1, "Usage: /uncuff [id]");
        if(IsPlayerConnected(targetid))
        {
        new Float:x, Float:y, Float:z;
        GetPlayerPos(playerid, x, y, z);
        if(Skin == 265||Skin == 266||Skin == 267||Skin == 280||Skin == 282||Skin == 288||Skin == 165||Skin == 166||Skin == 284||Skin == 285||Skin == 286||Skin == 287||Skin == 283)
        if(IsPlayerInRangeOfPoint(targetid, 5.0, x, y, z))
        {
		if(!SetPlayerAttachedObject(targetid, 0, 19418, 6, -0.011000, 0.028000, -0.022000, -15.600012, -33.699977,-81.700035, 0.891999, 1.000000, 1.168000))return SendClientMessage(playerid,-1,"ERROR: The player is not cuffed!");
        PlayerPlaySound(playerid, 5201, x,y,z);
		RemovePlayerAttachedObject(targetid,0);
        SetPlayerSpecialAction(targetid,SPECIAL_ACTION_NONE);
        new str[512];
        new name[MAX_PLAYER_NAME];
        GetPlayerName(playerid, name, sizeof(name));
        new target[MAX_PLAYER_NAME];
        GetPlayerName(targetid, target, sizeof(target));
		format(str, sizeof(str), "You have uncuffed %s!",target);
        SendClientMessage(playerid, 0x0000BBAA, str);
        format(str, sizeof(str), "You have been uncuffed by Officer %s!",name);
        SendClientMessage(targetid, 0x0000BBAA, str);
        return 1;
        }

        }
        return 1;
}

CMD:sms(playerid, cmdtext[])
{
    new idx = strfind(cmdtext, " ", true);
    if((cmdtext[0] == EOS) || ((cmdtext[0] == '\1') && (cmdtext[1] == EOS)) || (idx == -1)) {
    SendClientMessage(playerid,COLOR_RED,"Usage: /sms [id] [message]");
    return 1;
    }
    if(cmdtext[idx + 1] == EOS) {
    SendClientMessage(playerid,COLOR_RED,"Usage: /sms [id] [message]");
    return 1;
    }
    cmdtext[idx++] = EOS;
    new
    id = strval(cmdtext);
    if(!IsPlayerConnected(id)) {
    SendClientMessage(playerid,COLOR_RED,"Invalid Player ID");
    return 1;
    }
    if(playerid == id) {
    SendClientMessage(playerid,COLOR_RED,"You cannot send SMS to yourself.");
    return 1;
    }
    new
    string[256];
    GetPlayerName(id, string, MAX_PLAYER_NAME);
    format(string, sizeof string, "[SMS] sent to %s(%d): {FFFFFF}%s", string, id, cmdtext[idx]);
    SendClientMessage(playerid, COLOR_ORANGE, string);

    GetPlayerName(playerid, string, MAX_PLAYER_NAME);
    format(string, sizeof string, "[SMS] from %s(%d): {FFFFFF}%s", string, playerid, cmdtext[idx]);
    SendClientMessage(id, COLOR_ORANGE, string);
    PlayerPlaySound(id, 1057, 0.0, 0.0, 0.0);

    printf("SMS: %s", cmdtext[idx]);
    return 1;
}

CMD:pm(playerid, cmdtext[])
{
    new idx = strfind(cmdtext, " ", true);
    if((cmdtext[0] == EOS) || ((cmdtext[0] == '\1') && (cmdtext[1] == EOS)) || (idx == -1)) {
    SendClientMessage(playerid,COLOR_RED,"Usage: /pm [id] [message]");
    return 1;
    }
    if(cmdtext[idx + 1] == EOS) {
    SendClientMessage(playerid,COLOR_RED,"Usage: /pm [id] [message]");
    return 1;
    }
    cmdtext[idx++] = EOS;
    new
    id = strval(cmdtext);
    if(!IsPlayerConnected(id)) {
    SendClientMessage(playerid,COLOR_RED,"Invalid Player ID");
    return 1;
    }
    if(playerid == id) {
    SendClientMessage(playerid,COLOR_RED,"You cannot PM yourself.");
    return 1;
    }
    new
    string[256];
    if(TogPM{id} == 0) return SendClientMessage(playerid, COLOR_ERROR, "This player has turned off his PM's!");
    else
    GetPlayerName(id, string, MAX_PLAYER_NAME);
    format(string, sizeof string, "[PM] sent to %s(%d): {FFFFFF}%s", string, id, cmdtext[idx]);
    SendClientMessage(playerid, COLOR_RED, string);

    GetPlayerName(playerid, string, MAX_PLAYER_NAME);
    format(string, sizeof string, "[PM] from %s(%d): {FFFFFF}%s", string, playerid, cmdtext[idx]);
    SendClientMessage(id, COLOR_RED, string);
    printf("PM: %s", cmdtext[idx]);
    return 1;
}

CMD:sellak(playerid, params[])
{
  	new playerb, bullets, string[128];
  	new Skin;
  	Skin = GetPlayerSkin(playerid);
  	if(Skin == 6||Skin == 176||Skin == 29||Skin ==28||Skin ==24||Skin ==233||Skin ==180)
  	if(!IsPlayerInRangeOfPoint(playerid,7, 1397.20117188, -1897.06628418, 12.71907330)) return SendClientMessage(playerid,-1,"You are not at the right place!");
    if(sscanf(params,"ii",playerb,bullets)) return SendClientMessage(playerid,-1,"Usage: /sellak [id] [ammo]");
    if(!IsPlayerNearPlayer(playerid, playerb, 5.0)) return SendClientMessage(playerid,-1,"You are too far away from that player!");
    if(bullets < 1 || bullets > 400) return SendClientMessage(playerid, 0xFF9900AA, "You can only take 1-400 bullets at once!");
    format(string, sizeof(string), "** %s takes out a AK-47 and a box of ammo as he passes it to %s", NAMEGET(playerid), NAMEGET(playerb), bullets);
	NearMessageSender(playerid, 7, string, COLOR_FADE1,COLOR_FADE1,COLOR_FADE1,COLOR_FADE1,COLOR_FADE1);
    format(string, sizeof(string), "Gun Dealer %s has given you a AK-47 and a box of ammo.", NAMEGET(playerid));
    SendClientMessage(playerb, COLOR_RED, string);
    GivePlayerWeapon(playerb, 30, bullets);
    GivePlayerMoney(playerid, -200);//you can change the ammount of money taken from the player
    return 1;
}

CMD:selluzi(playerid, params[])
{
  	new playerb, bullets, string[128];
  	new Skin;
  	Skin = GetPlayerSkin(playerid);
  	if(Skin == 6||Skin == 176||Skin == 29||Skin ==28||Skin ==24||Skin ==233||Skin ==180)// change the skins to the ones you want
  	if(!IsPlayerInRangeOfPoint(playerid,7, 1397.20117188, -1897.06628418, 12.71907330)) return SendClientMessage(playerid,-1,"You are not at the right place!");// change the co-ords to the ones you want
    if(sscanf(params,"ii",playerb,bullets)) return SendClientMessage(playerid,-1,"Usage: /selluzi [id] [ammo]");
    if(!IsPlayerNearPlayer(playerid, playerb, 5.0)) return SendClientMessage(playerid,-1,"You are too far away from that player!");
    if(bullets < 1 || bullets > 400) return SendClientMessage(playerid, 0xFF9900AA, "You can only take 1-400 bullets at once!");
    format(string, sizeof(string), "** %s takes out a Mac-10 and a box of ammo as he passes it to %s", NAMEGET(playerid), NAMEGET(playerb), bullets);
	NearMessageSender(playerid, 7, string, COLOR_FADE1,COLOR_FADE1,COLOR_FADE1,COLOR_FADE1,COLOR_FADE1);
    format(string, sizeof(string), "Gun Dealer %s has given you a Mac-10 and a box of ammo.", NAMEGET(playerid));
    SendClientMessage(playerb, COLOR_RED, string);
    GivePlayerWeapon(playerb, 28, bullets);
    GivePlayerMoney(playerid, -200);//you can change the ammount of money taken from the player
    return 1;
}

CMD:sellshot(playerid, params[])
{
  	new playerb, bullets, string[128];
  	new Skin;
  	Skin = GetPlayerSkin(playerid);
  	if(Skin == 6||Skin == 176||Skin == 29||Skin ==28||Skin ==24||Skin ==233||Skin ==180)// change the skins to the ones you want
  	if(!IsPlayerInRangeOfPoint(playerid,7, 1397.20117188, -1897.06628418, 12.71907330)) return SendClientMessage(playerid,-1,"You are not at the right place!");// change the co-ords to the ones you want
  	if(sscanf(params,"ii",playerb,bullets)) return SendClientMessage(playerid,-1,"Usage: /sellshot [id] [ammo]");
    if(!IsPlayerNearPlayer(playerid, playerb, 5.0)) return SendClientMessage(playerid,-1,"You are too far away from that player!");
    if(bullets < 1 || bullets > 400) return SendClientMessage(playerid, 0xFF9900AA, "You can only take 1-400 bullets at once!");
    format(string, sizeof(string), "** %s takes out a Shotgun and a box of ammo as he passes it to %s", NAMEGET(playerid), NAMEGET(playerb), bullets);
	NearMessageSender(playerid, 7, string, COLOR_FADE1,COLOR_FADE1,COLOR_FADE1,COLOR_FADE1,COLOR_FADE1);
    format(string, sizeof(string), "Gun Dealer %s has given you a Shotgun and a box of ammo.", NAMEGET(playerid));
    SendClientMessage(playerb, COLOR_RED, string);
    GivePlayerWeapon(playerb, 25, bullets);
    GivePlayerMoney(playerid, -200);//you can change the ammount of money taken from the player
    return 1;
}

CMD:selltec9(playerid, params[])
{
  	new playerb, bullets, string[128];
  	new Skin;
  	Skin = GetPlayerSkin(playerid);
  	if(Skin == 6||Skin == 176||Skin == 29||Skin ==28||Skin ==24||Skin ==233||Skin ==180)// change the skins to the ones you want
  	if(!IsPlayerInRangeOfPoint(playerid,7, 1397.20117188, -1897.06628418, 12.71907330)) return SendClientMessage(playerid,-1,"You are not at the right place!");// change the co-ords to the ones you want
  	if(sscanf(params,"ii",playerb,bullets)) return SendClientMessage(playerid,-1,"Usage: /selltec9 [id] [ammo]");
    if(!IsPlayerNearPlayer(playerid, playerb, 5.0)) return SendClientMessage(playerid,-1,"You are too far away from that player!");
    if(bullets < 1 || bullets > 400) return SendClientMessage(playerid, 0xFF9900AA, "You can only take 1-400 bullets at once!");
    format(string, sizeof(string), "** %s takes out a Tec-9 and a box of ammo as he passes it to %s", NAMEGET(playerid), NAMEGET(playerb), bullets);
	NearMessageSender(playerid, 7, string, COLOR_FADE1,COLOR_FADE1,COLOR_FADE1,COLOR_FADE1,COLOR_FADE1);
    format(string, sizeof(string), "Gun Dealer %s has given you a Tec-9 and a box of ammo.", NAMEGET(playerid));
    SendClientMessage(playerb, COLOR_RED, string);
    GivePlayerWeapon(playerb, 32, bullets);
    GivePlayerMoney(playerid, -200);//you can change the ammount of money taken from the player
    return 1;
}

CMD:sellcolt(playerid, params[])
{
  	new playerb, bullets, string[128];
  	new Skin;
  	Skin = GetPlayerSkin(playerid);
  	if(Skin == 6||Skin == 176||Skin == 29||Skin ==28||Skin ==24||Skin ==233||Skin ==180)// change the skins to the ones you want
  	if(!IsPlayerInRangeOfPoint(playerid,7, 1397.20117188, -1897.06628418, 12.71907330)) return SendClientMessage(playerid,-1,"You are not at the right place!");// change the co-ords to the ones you want
  	if(sscanf(params,"ii",playerb,bullets)) return SendClientMessage(playerid,-1,"Usage: /sellcolt [id] [ammo]");
    if(!IsPlayerNearPlayer(playerid, playerb, 5.0)) return SendClientMessage(playerid,-1,"You are too far away from that player!");
    if(bullets < 1 || bullets > 400) return SendClientMessage(playerid, 0xFF9900AA, "You can only take 1-400 bullets at once!");
    format(string, sizeof(string), "** %s takes out a Glock-17 and a box of ammo as he passes it to %s", NAMEGET(playerid), NAMEGET(playerb), bullets);
	NearMessageSender(playerid, 7, string, COLOR_FADE1,COLOR_FADE1,COLOR_FADE1,COLOR_FADE1,COLOR_FADE1);
    format(string, sizeof(string), "Gun Dealer %s has given you a Glock-17 and a box of ammo.", NAMEGET(playerid));
    SendClientMessage(playerb, COLOR_RED, string);
    GivePlayerWeapon(playerb, 22, bullets);
    GivePlayerMoney(playerid, -200);//you can change the ammount of money taken from the player
    return 1;
}

CMD:sellvest(playerid, params[])
{
  new playerb, string[128];
  new Skin;
  Skin = GetPlayerSkin(playerid);
  if(Skin == 6||Skin == 176||Skin == 29||Skin ==28||Skin ==24||Skin ==233||Skin ==180)// change the skins to the ones you want
  if(!IsPlayerInRangeOfPoint(playerid,7, 1397.20117188, -1897.06628418, 12.71907330)) return SendClientMessage(playerid,-1,"You are not at the right place!");// change the co-ords to the ones you want
  if(sscanf(params, "ui", playerb)) return SendClientMessage(playerid, COLOR_RED, "Usage: /sellvest [id]");
  if(!IsPlayerNearPlayer(playerid, playerb, 5.0)) return SendClientMessage(playerid, COLOR_RED, "You are too far away from that player.");
  format(string, sizeof(string), "** %s takes out a Bulletproof Vest as he passes it to %s", NAMEGET(playerid), NAMEGET(playerb));
  NearMessageSender(playerid, 7, string, COLOR_FADE1,COLOR_FADE1,COLOR_FADE1,COLOR_FADE1,COLOR_FADE1);
  format(string, sizeof(string), "Gun Dealer %s has given you a bulletproof vest.", NAMEGET(playerid));
  SendClientMessage(playerb, COLOR_RED, string);
  SetPlayerArmour(playerb, 35);// you can change the ammount of armour given to the player
  return 1;
}

CMD:buy(playerid, params[])
{
    if(!IsPlayerInRangeOfPoint(playerid, 7.0, -29.0543,-184.3049,1003.5469)) return SendClientMessage(playerid,-1,"You need to be in a 24/7 store."); // change the co-ords to the ones you want
    ShowPlayerDialog(playerid,1,DIALOG_STYLE_LIST,"24/7 Store","Spraycan [$100]\nBat [$50]\nGolf Club [$70]\nShovel [$70]\nKatana [$100]\nCamera [$60]\nMask [$350]\nRuffles [$10]\nCoca-Cola [$10]\nCheeseburger [$15]\nCigarettes [$40]\nBeer [$20]","Purchase","Exit");
    return 1;
}

forward AdvTimer();

CMD:adv(playerid, params[])
{
    if (AdvTimer1 != 0) return SendClientMessage(playerid, 0xFF0000FF, "You must wait some time before making another advertisement.");
    if (isnull(params))
    {
        SendClientMessage(playerid, 0xFF0000FF, "Usage: /adv [advertisement]");
        return 1;
    }
    new string[152], playername[24];
    GetPlayerName(playerid, playername, sizeof(playername));
    if(AntiAdv(playerid, params)) return 1;
    format(string, sizeof(string), "||*** Advertisement from %s: %s ***||", playername, params);
    SendClientMessageToAll(0xFF0000FF, string);
    AdvTimer1 = 1;
    SetTimer("AdvTimer", 180000, false);
    GivePlayerMoney(playerid, -350);
    SendClientMessage(playerid, -1, "The advertisement has costed you 350$!");
    return 1;
}


CMD:pmsoff(playerid, params[])
{
	SendClientMessage(playerid, COLOR_ERROR, "You've turned your private messages {FFFFFF}[OFF]"), TogPM{playerid} = 0;
 	return true;
}

CMD:pmson(playerid, params[])
{
	SendClientMessage(playerid, COLOR_ERROR, "You've turned your private messages {FFFFFF}[ON]"), TogPM{playerid} = 1;
 	return true;
}

CMD:buydrivinglic(playerid, params[])
{
 if(!IsPlayerInRangeOfPoint(playerid, 5.0, 2046.6372,-1908.0178,13.5469)) return SendClientMessage(playerid,-1,"You must be near the DMV to obtain a driving license.");
 if(HasDrivingLic[playerid] == 1) return SendClientMessage(playerid, COLOR_RED, "You already have a driving license.");
 if(HasDrivingLic[playerid] == 0)
 (HasDrivingLic[playerid] = 1);
 GivePlayerMoney(playerid, -2000);
 SendClientMessage(playerid, -1, "You've bought a driving license for $2000, drive safely, otherwise the police department may suspend it from you.");
 return 1;
}

CMD:buygunlic(playerid, params[])
{
	if(!IsPlayerInRangeOfPoint(playerid, 5.0, 2046.6372,-1908.0178,13.5469)) return SendClientMessage(playerid,-1,"You must be near the DMV to obtain a gun license.");
	if(HasGunLic[playerid] == 1) return SendClientMessage(playerid, COLOR_RED, "You already have a gun license.");
 	if(HasGunLic[playerid] == 0)
 	(HasGunLic[playerid] = 1);
 	GivePlayerMoney(playerid, -2000);
 	SendClientMessage(playerid, -1, "You've bought a gun license for $2000, remember - you are only allowed to carry light weaponry infront of your house.");
 	return 1;
}

CMD:buyflyinglic(playerid, params[])
{
	if(!IsPlayerInRangeOfPoint(playerid, 5.0, 2046.6372,-1908.0178,13.5469)) return SendClientMessage(playerid,-1,"You must be near the DMV to obtain a flying license.");
	if(HasFlyingLic[playerid] == 1) return SendClientMessage(playerid, COLOR_RED, "You already have a pilot license.");
 	if(HasFlyingLic[playerid] == 0)
 	(HasFlyingLic[playerid] = 1);
 	GivePlayerMoney(playerid, -2000);
 	SendClientMessage(playerid, -1, "You've bought a pilot license for $2000, you are now able to fly with any helicopter/plane.");
 	return 1;
}


CMD:mylic(playerid, params[])
{
	new lic[128], drivinglic[12], gunlic[12],flyinglic[12];
	if(HasDrivingLic[playerid] == 0) drivinglic = "Not Passed";
	else drivinglic = "Passed";
	if(HasGunLic[playerid] == 0) gunlic = "Not Passed";
	else gunlic = "Passed";
	if(HasFlyingLic[playerid] == 0)  flyinglic = "Not Passed";
	else flyinglic = "Passed";
 	format(lic, sizeof(lic), "** Your Licenses - [Driving]: %s || [Gun]: %s || [Flying]: %s", drivinglic,gunlic,flyinglic);
 	SendClientMessage(playerid, -1, lic);
 	return 1;
}


CMD:checklic(playerid, params[])
{
	new lic1[128], drivinglic[12], gunlic[12],flyinglic[12];
	new playerb;
	new pSkin;
	pSkin = GetPlayerSkin(playerid);
	if(pSkin == 265||pSkin == 266||pSkin == 267||pSkin == 280||pSkin == 282||pSkin == 288||pSkin == 165||pSkin == 166||pSkin == 284||pSkin == 285||pSkin == 286||pSkin == 287||pSkin == 283)
	if(sscanf(params,"u",playerb)) return SendClientMessage(playerid,-1,"Usage: /checklic [id]");
	if(!IsPlayerNearPlayer(playerid, playerb, 5.0)) return SendClientMessage(playerid, COLOR_RED, "You are too far away from that player.");
	if(HasDrivingLic[playerb] == 0) drivinglic = "Not Passed";
	else drivinglic = "Passed";
	if(HasGunLic[playerb] == 0) gunlic = "Not Passed";
	else gunlic = "Passed";
	if(HasFlyingLic[playerb] == 0)  flyinglic = "Not Passed";
	else flyinglic = "Passed";
	format(lic1, sizeof(lic1), "** %s's Licenses - [Driving]: %s || [Gun]: %s || [Flying]: %s",NAMEGET(playerid),drivinglic,gunlic,flyinglic);
 	SendClientMessage(playerid, -1, lic1);
 	return 1;
}

CMD:showlic(playerid, params[])
{
	new lic2[128], drivinglic[12], gunlic[12],flyinglic[12];
	new playerb;
	if(sscanf(params,"u",playerb)) return SendClientMessage(playerid,-1,"Usage: /showlic [id]");
	if(!IsPlayerNearPlayer(playerid, playerb, 5.0)) return SendClientMessage(playerid, COLOR_RED, "You are too far away from that player.");
	if(HasDrivingLic[playerid] == 0) drivinglic = "Not Passed";
	else drivinglic = "Passed";
	if(HasGunLic[playerid] == 0) gunlic = "Not Passed";
	else gunlic = "Passed";
	if(HasFlyingLic[playerid] == 0)  flyinglic = "Not Passed";
	else flyinglic = "Passed";
 	format(lic2, sizeof(lic2), "** %s's Licenses - [Driving]: %s || [Gun]: %s || [Flying]: %s",NAMEGET(playerid),drivinglic,gunlic,flyinglic);
 	SendClientMessage(playerb, -1, lic2);
 	format(lic2, sizeof(lic2), "*** %s takes out his/her licenses and shows them to %s.", NAMEGET(playerid), NAMEGET(playerb));
 	if(playerb == playerid)
 	format(lic2, sizeof(lic2), "*** %s takes out his/her licenses and takes a look at them.", NAMEGET(playerid));
 	NearMessageSender(playerid, 5.0, lic2, COLOR_FADE1,COLOR_FADE1,COLOR_FADE1,COLOR_FADE1,COLOR_FADE1);
 	return 1;
}

CMD:sdrivinglic(playerid, params[])
{
	new lic3[128];
	new playerb;
	new pSkin;
	pSkin = GetPlayerSkin(playerid);
	if(pSkin == 265||pSkin == 266||pSkin == 267||pSkin == 280||pSkin == 282||pSkin == 288||pSkin == 165||pSkin == 166||pSkin == 284||pSkin == 285||pSkin == 286||pSkin == 287||pSkin == 283)
	if(sscanf(params,"u",playerb)) return SendClientMessage(playerid,-1,"Usage: /sdrivinglic [id]");
	if(!IsPlayerNearPlayer(playerid, playerb, 5.0)) return SendClientMessage(playerid, COLOR_RED, "You are too far away from that player.");
	if(HasDrivingLic[playerb] == 0) return SendClientMessage(playerid, COLOR_RED, "This person doesnt have driving license to suspend.");
    if(HasDrivingLic[playerb] == 1)
    (HasDrivingLic[playerb] = 0);
    format(lic3, sizeof(lic3), "** Law Enforcer %s has suspended your driving license, beware cause the police may ticket you.", NAMEGET(playerid));
    SendClientMessage(playerb, COLOR_RED, lic3);
    format(lic3, sizeof(lic3), "** You have suspended %s's driving license.", NAMEGET(playerb));
    SendClientMessage(playerid, COLOR_RED, lic3);
 	return 1;
}

CMD:sgunlic(playerid, params[])
{
	new lic4[128];
	new playerb;
	new pSkin;
	pSkin = GetPlayerSkin(playerid);
	if(pSkin == 265||pSkin == 266||pSkin == 267||pSkin == 280||pSkin == 282||pSkin == 288||pSkin == 165||pSkin == 166||pSkin == 284||pSkin == 285||pSkin == 286||pSkin == 287||pSkin == 283)
	if(sscanf(params,"u",playerb)) return SendClientMessage(playerid,-1,"Usage: /sgunlic [id]");
	if(!IsPlayerNearPlayer(playerid, playerb, 5.0)) return SendClientMessage(playerid, COLOR_RED, "You are too far away from that player.");
	if(HasGunLic[playerb] == 0) return SendClientMessage(playerid, COLOR_RED, "This person doesnt have gun license to suspend.");
    if(HasGunLic[playerb] == 1)
    (HasGunLic[playerb] = 0);
    format(lic4, sizeof(lic4), "** Law Enforcer %s has suspended your gun license, you cannot use any legal weaponry now.", NAMEGET(playerid));
    SendClientMessage(playerb, COLOR_RED, lic4);
    format(lic4, sizeof(lic4), "** You have suspended %s's gun license.", NAMEGET(playerb));
    SendClientMessage(playerid, COLOR_RED, lic4);
 	return 1;
}

CMD:sflyinglic(playerid, params[])
{
	new lic5[128];
	new playerb;
	new pSkin;
	pSkin = GetPlayerSkin(playerid);
	if(pSkin == 265||pSkin == 266||pSkin == 267||pSkin == 280||pSkin == 282||pSkin == 288||pSkin == 165||pSkin == 166||pSkin == 284||pSkin == 285||pSkin == 286||pSkin == 287||pSkin == 283)
	if(sscanf(params,"u",playerb)) return SendClientMessage(playerid,-1,"Usage: /sflyinglic [id]");
	if(!IsPlayerNearPlayer(playerid, playerb, 5.0)) return SendClientMessage(playerid, COLOR_RED, "You are too far away from that player.");
	if(HasFlyingLic[playerb] == 0) return SendClientMessage(playerid, COLOR_RED, "This person doesnt have flying license to suspend.");
    if(HasFlyingLic[playerb] == 1)
    (HasFlyingLic[playerb] = 0);
    format(lic5, sizeof(lic5), "** Law Enforcer %s has suspended your flying license, you may not fly with any helicopter/plane.", NAMEGET(playerid));
    SendClientMessage(playerb, COLOR_RED, lic5);
    format(lic5, sizeof(lic5), "** You have suspended %s's flying license.", NAMEGET(playerb));
    SendClientMessage(playerid, COLOR_RED, lic5);
 	return 1;
}


//====================================START OF PUBLICS==============================================================================================================

public AdvTimer()
{
    AdvTimer1 = 0;
}

public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    if(newkeys & KEY_JUMP && !(oldkeys & KEY_JUMP) && GetPlayerSpecialAction(playerid) == SPECIAL_ACTION_CUFFED) ApplyAnimation(playerid, "GYMNASIUM", "gym_jog_falloff",4.1,0,1,1,0,0);
    if(newkeys & KEY_SPRINT && !(oldkeys & KEY_SPRINT) && GetPlayerSpecialAction(playerid) == SPECIAL_ACTION_CUFFED) ApplyAnimation(playerid, "GYMNASIUM", "gym_jog_falloff",4.1,0,1,1,0,0);
    return 1;
}

public OnPlayerText(playerid, text[])
{
    new textv2[128];
    if(maskonface[playerid] == true)
	{
    format(textv2, sizeof (textv2), "Stranger says: %s",text);
    NearMessageSender(playerid, 8, textv2, COLOR_FADE2,COLOR_FADE2,COLOR_FADE2,COLOR_FADE2,COLOR_FADE2);
	return 0;
	}
	else
	if(maskonface[playerid] == false)
	{
	return 1;
	}
	return 1;
}

public OnPlayerDeath(playerid, killerid, reason)
{
    (HasBoughtMask[playerid] = 0);
	(HasBoughtBeer[playerid] = 0);
	(HasBoughtCigar[playerid] = 0);

	if(maskonface[playerid] == true)
    {
    maskonface[playerid] = false;
 	for(new i = 0; i < MAX_PLAYERS; i++) ShowPlayerNameTagForPlayer(i, playerid, true);
 	}
 	return 1;
}

public OnPlayerStreamIn(playerid, forplayerid)
{

    if(maskonface[playerid] == true)
    {
        ShowPlayerNameTagForPlayer(forplayerid, playerid, false);
    }
    return 1;
}

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    if(dialogid==1 && response==1)
	{

	switch(listitem)
    {
        case 0:
        {
        if(GetPlayerMoney(playerid) <100) return SendClientMessage(playerid,0xAA3333AA, "You do not have enough money!");
        SendClientMessage(playerid,-1,"You purchased a Spraycan for $100!");
        GivePlayerWeapon(playerid, 41, 100);
        GivePlayerMoney(playerid, -100);
        }
        case 1:
        {
        if(GetPlayerMoney(playerid) <50) return SendClientMessage(playerid,0xAA3333AA, "You do not have enough money!");
        SendClientMessage(playerid, -1, "You purchased a Baseball Bat for $50!");
        GivePlayerWeapon(playerid, 5, 1);
        GivePlayerMoney(playerid, -50);
        }
        case 2:
        {
        if(GetPlayerMoney(playerid) <70) return SendClientMessage(playerid,0xAA3333AA, "You do not have enough money!");
        SendClientMessage(playerid, -1, "You purchased a Golf Club for $70!");
        GivePlayerWeapon(playerid, 2, 1);
        GivePlayerMoney(playerid, -70);
        }
        case 3:
        {
        if(GetPlayerMoney(playerid) <70) return SendClientMessage(playerid,0xAA3333AA, "You do not have enough money!");
        SendClientMessage(playerid, -1, "You purchased a Shovel for $70!");
        GivePlayerWeapon(playerid, 6, 1);
		GivePlayerMoney(playerid, -70);
 	  	}
        case 4:
        {
        if(GetPlayerMoney(playerid) <100) return SendClientMessage(playerid,0xAA3333AA, "You do not have enough money!");
        SendClientMessage(playerid, -1, "You purchased a Katana for $100!");
        GivePlayerWeapon(playerid, 8, 1);
		GivePlayerMoney(playerid, -100);
        }
        case 5:
        {
        if(GetPlayerMoney(playerid) <60) return SendClientMessage(playerid,0xAA3333AA, "You do not have enough money!");
        SendClientMessage(playerid, -1, "You purchased a Camera for $60!");
        GivePlayerMoney(playerid, -60);
        GivePlayerWeapon(playerid, 43, 100);
        }
        case 6:
        {
        if(GetPlayerMoney(playerid) <350) return SendClientMessage(playerid,0xAA3333AA, "You do not have enough money!");
        SendClientMessage(playerid, -1, "You purchased a Mask for $350! ((/maskon & /maskoff))");
        GivePlayerMoney(playerid, -350);
  		(HasBoughtMask[playerid] = 1);
        }
        case 7:
        {
        if(GetPlayerMoney(playerid) <10) return SendClientMessage(playerid,0xAA3333AA, "You do not have enough money!");
        new Float:pHealth;
        GetPlayerHealth(playerid, Float:pHealth);
        SendClientMessage(playerid, -1, "You purchased a pack of Ruffles for $10! ((+20 HP))");
        ApplyAnimation(playerid,"VENDING", "vend_eat1_P",4.1,0,1,1,1,1,1);
        GivePlayerMoney(playerid, -10);
        SetPlayerHealth(playerid, pHealth+20);
        }
        case 8:
        {
        if(GetPlayerMoney(playerid) <10) return SendClientMessage(playerid,0xAA3333AA, "You do not have enough money!");
        new Float:pHealth;
        GetPlayerHealth(playerid, Float:pHealth);
        SendClientMessage(playerid, -1, "You purchased a bottle of Coca-Cola for $10! ((+10 HP))");
        GivePlayerMoney(playerid, -10);
        SetPlayerHealth(playerid, pHealth+10);
        }
        case 9:
        {
        if(GetPlayerMoney(playerid) <15) return SendClientMessage(playerid,0xAA3333AA, "You do not have enough money!");
        new Float:pHealth;
        GetPlayerHealth(playerid, Float:pHealth);
        SendClientMessage(playerid, -1, "You purchased a Cheese Burger for $15! ((+30 HP))");
        ApplyAnimation(playerid,"VENDING", "vend_eat1_P",4.1,0,1,1,1,1,1);
        GivePlayerMoney(playerid, -15);
        SetPlayerHealth(playerid, pHealth+30);
        }
        case 10:
        {
        if(GetPlayerMoney(playerid) <40) return SendClientMessage(playerid,0xAA3333AA, "You do not have enough money!");
        SendClientMessage(playerid, -1, "You purchased a box of cigars for $40! ((/cigar))");
        GivePlayerMoney(playerid, -40);
        (HasBoughtCigar[playerid] = 1);
        }
        case 11:
        {
        if(GetPlayerMoney(playerid) <20) return SendClientMessage(playerid,0xAA3333AA, "You do not have enough money!");
        SendClientMessage(playerid, -1, "You purchased a bottle of beer for $20!");
        GivePlayerMoney(playerid, -20);
        (HasBoughtBeer[playerid] = 1);
        }
    }
}
return 1;
}

public OnPlayerConnect(playerid)
{
(HasBoughtMask[playerid] = 0);
(HasBoughtBeer[playerid] = 0);
(HasBoughtCigar[playerid] = 0);
TogPM{playerid} = 1;
return true;
}

public OnPlayerDisconnect(playerid, reason)
{
(HasBoughtMask[playerid] = 0);
(HasBoughtBeer[playerid] = 0);
(HasBoughtCigar[playerid] = 0);
return true;
}

//===============END OF PUBLICS=====================START OF STOCKS=======================================================================================//

stock NearMessageSender(playerid, Float:radius, string[], col1, col2, col3, col4, col5)
{
	new Float:x, Float:y, Float:z;
	GetPlayerPos(playerid, x, y, z);
	new Float:ix, Float:iy, Float:iz;
	new Float:cx, Float:cy, Float:cz;
	foreach(Player, i)
	{
	        if(GetPlayerInterior(playerid) == GetPlayerInterior(i) && GetPlayerVirtualWorld(playerid) == GetPlayerVirtualWorld(i))
	        {
				GetPlayerPos(i, ix, iy, iz);
				cx = (x - ix);
				cy = (y - iy);
				cz = (z - iz);
				if(((cx < radius/16) && (cx > -radius/16)) && ((cy < radius/16) && (cy > -radius/16)) && ((cz < radius/16) && (cz > -radius/16)))
				{
				    SendClientMessage(i, col1, string);
				}
				else if(((cx < radius/8) && (cx > -radius/8)) && ((cy < radius/8) && (cy > -radius/8)) && ((cz < radius/8) && (cz > -radius/8)))
				{
				    SendClientMessage(i, col2, string);
				}
				else if(((cx < radius/4) && (cx > -radius/4)) && ((cy < radius/4) && (cy > -radius/4)) && ((cz < radius/4) && (cz > -radius/4)))
				{
				    SendClientMessage(i, col3, string);
				}
				else if(((cx < radius/2) && (cx > -radius/2)) && ((cy < radius/2) && (cy > -radius/2)) && ((cz < radius/2) && (cz > -radius/2)))
				{
				    SendClientMessage(i, col4, string);
				}
				else if(((cx < radius) && (cx > -radius)) && ((cy < radius) && (cy > -radius)) && ((cz < radius) && (cz > -radius)))
				{
				    SendClientMessage(i, col5, string);
				}
			}
	}
	return 1;
}

stock NAMEGET(playerid)
{
    new name[MAX_PLAYER_NAME];
    GetPlayerName(playerid,name,sizeof(name));
    for(new i = 0; i < MAX_PLAYER_NAME; i++)
    {
        if(name[i] == '_') name[i] = ' ';
    }
    return name;
}
stock AntiAdv(playerid, text[])
{
    new strR[255], is1=0, r=0;
 	while(strlen(text[is1]))
 	{
  		if('0'<=text[is1]<='9')
  		{
	 		new is2=is1+1, p=0;
	   		while(p==0)
		  	{
		   		if('0'<=text[is2]<='9'&&strlen(text[is2]))
			   	{
				   is2++;
				}
			 	else
			  	{
				   	strmid(strR[r],text,is1,is2,255);
				   	if(strval(strR[r])<255) r++;
				    is1=is2;
				    p=1;
		    	}
		    }
	    }
    	is1++;
 	}
 	if(r>=4)
 	{
	  	new strMy[255];
	  	format(strMy, sizeof(strMy), " \"Your server name here\": %s is attempting to Server Advertise", NAMEGET(playerid));
	  	SendClientMessage(COLOR_GOVERNMENT, 1, strMy);
	   	new pr2;
	  	for(new z=0;z<r;z++)
	  	{

		   	while((pr2=strfind(text,strR[z],true))!=-1)
			{
				for(new i=pr2,j=pr2+strlen(strR[z]);i<j;i++)
				{
					text[i]='*';
				}
			}
	  	}
	  	return 1;
 	}
 	return 0;
}

stock IsPlayerNearPlayer(playerid, targetid, Float:radius)
{
	new Float:x, Float:y, Float:z;
	GetPlayerPos(targetid, x, y, z);
	if(IsPlayerInRangeOfPoint(playerid, radius ,x, y, z))
	{
	    return 1;
	}
	return 0;
}
#endif
Reply
#2

I don't know why you're pulling the source code out of the y_iterate file and turning it into a filterscript, it's not going to work like that. It needs to remain an include. It even needs to include other files from the YSI library, so...
Reply
#3

it came as filterscript and its the foreach code im tryna put in my server cos i need it for a filterscript basicly mate
Reply
#4

Then just add #include <YSI\y_iterate> after the #include <a_samp> line...
Reply
#5

all good but got another problem. ok i guess it was working cos i went back and compiled/ran the filterscript, added it into my server but no commands work, no why?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)