error 017: undefined symbol "mypickup"
#1

Код:
C:\Users\Conrrr\Desktop\SAMPSERVER\pawno\menutestone.pwn(89) : error 017: undefined symbol "mypickup"
C:\Users\Conrrr\Desktop\SAMPSERVER\pawno\menutestone.pwn(928) : error 017: undefined symbol "mypickup"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


2 Errors.
I'm trying to add a weapon pickup for my Cops and Gangs server ._.

Here's my code:

Код:
/********** Cops 'n' Gangs v1.01 by Cona**********
*              Still in beta stage               *
*              Need testers!                     *
*                                                *
**************************************************/


//<<<<<<<<<<<<<<<<<<<<<(INCLUDES)<<<<<<<<<<<<<<<<<<<<<<<//

#include <a_samp>
#include <zcmd>
#include <dini>
#include <sscanf>
#include <dudb>
#include <core>
#include <string>
#include <file>
#include <time>
#include <datagram>
#include <a_players>
#include <a_vehicles>
#include <a_objects>
#include <a_samp>
#include <dutils>
#include <float>




main()
{
	print("Cops n Gangs v1.10 started!");
	print("©2010 TheHoodRat/Base/Cona SA:MP");
	new year, month, day;
	getdate(year, month, day);
	printf("Server loaded at %d/%d/%d.",day,month,year);
}

//<<<<<<<<<<<<<<<<<<<<<(DEFINES)<<<<<<<<<<<<<<<<<<<<<<<//
#define ADMINMENU 25000
#define red 0xE21F1FFF
#define yellow 0xFFFF00FF
#define blue 0x1229FAFF
#define orange 0xF97804FF
#define grey 0xCECECEFF
#define gold 0xB8860BAA
#define mustlogin
#define autologin
#define logchat
#define joinmes
#define leavemes
#define COLOR_WHITE 0xFFFFFFFF
#define TEAM_GANG 0
#define TEAM_GANG1 1
#define TEAM_GANG2 2
#define TEAM_LSPD 3
#define TEAM_LSPD1 4
#define TEAM_LSPD2 5
#define TEAM_GANG_COLOR 0x00D900C8
#define TEAM_LSPD_COLOR 0x2641FEAA
#define PATH "Weapons"
new level[MAX_PLAYERS];
new logged[MAX_PLAYERS];
new gTeam[MAX_PLAYERS];
new bool:AlreadyGiveWeapons[MAX_PLAYERS];
new Menu:AMenu;
new Float:X, Float:Y, Float:Z;
new Text:WelcomeText;




#pragma unused strtok
#pragma unused ret_memcpy
#pragma tabsize 0
#pragma unused SetPlayerToTeamColor



public OnGameModeInit()
{

	SetGameModeText("Cops n Gangs"); // Please change.


    AddPlayerClass(105,2514.9575,-1670.8993,13.6167,73.3932,4,16,30,24,15,200); //Gang
    AddPlayerClass(106,2514.9575,-1670.8993,13.6167,73.3932,4,16,30,24,15,200); //Gang
    AddPlayerClass(107,2514.9575,-1670.8993,13.6167,73.3932,4,16,30,24,15,200); //Gang
    mypickup = CreatePickup(1274, 2, 2504.008056, -1681.196044, 13.546875, 1);

    AddPlayerClass(281,1544.1941,-1675.3660,13.5579,90.0000,3,1,24,70,27,70);//LSPD
    AddPlayerClass(282,1544.1941,-1675.3660,13.5579,90.0000,3,1,24,70,27,70);//LSPD
    AddPlayerClass(283,1544.1941,-1675.3660,13.5579,90.0000,3,1,24,70,27,70);//LSPD




    AddStaticVehicle(402,2508.3909,-1671.7950,13.1619,349.5642,16,86); // Vehicle 1
    AddStaticVehicle(405,2497.6687,-1655.5892,13.1731,79.7754,16,86); // Vehicle 1
    AddStaticVehicle(411,2475.1238,-1655.1711,13.1138,90.7216,16,86); // Vehicle 1
    AddStaticVehicle(429,2493.3228,-1682.7517,13.1208,90.7026,16,86); // Vehicle 1
    AddStaticVehicle(492,2475.7446,-1679.2852,13.1185,57.9572,16,86); // Vehicle 1
    AddStaticVehicle(497,2470.0034,-1670.3381,13.0974,11.2170,0,1); // Vehicle 1
  	AddStaticVehicle(432,2430.8623,-1633.5732,13.4260,358.6529,1,0); // TANK POS
	AddStaticVehicle(456,2525.4302,-1668.6125,15.2574,271.3300,91,63); // TRUCK FOR ROOF OF HYDRA
	AddStaticVehicle(520,2529.5710,-1676.8678,20.6535,91.8399,0,0); // HYDRA
	AddStaticVehicle(497,1526.6870,-1634.0537,13.5595,182.0773,0,1); // PD HELI

    AddStaticVehicle(596,1536.0184,-1667.0193,13.1221,180.3080,0,1); // PD CAR
    AddStaticVehicle(596,1535.9218,-1678.1157,13.1130,0.6165,0,1); // PD CAR
    AddStaticVehicle(596,1540.9456,-1625.5426,13.1040,178.6210,0,1); // PD CAR
    AddStaticVehicle(596,1540.8610,-1630.8378,13.1031,359.5612,0,1); // PD CAR

	print("Classes and Vehicles were loaded successfully!");
	print("Admin Menu loaded successfully!");
	AMenu = CreateMenu("Admin Menu", 1, 50.0, 180.0, 200.0, 200.0);
	AddMenuItem(AMenu, 0, "Spawn Jetpack");
	AddMenuItem(AMenu, 0, "Refill Health and Armor");
	AddMenuItem(AMenu, 0, "Kick All");
	AddMenuItem(AMenu, 0, "Freeze All");
	AddMenuItem(AMenu, 0, "Unfreeze All");
	AddMenuItem(AMenu, 0, "Give All $50000");
	AddMenuItem(AMenu, 0, "Minigun");
	AddMenuItem(AMenu, 0, "Kill All");
	AddMenuItem(AMenu, 0, "Reload FS");
	AddMenuItem(AMenu, 0, "Restart Server");
	AddMenuItem(AMenu, 0, "Exit Menu");
	AddMenuItem(AMenu, 0, "Clear Chat");
	SetTimer("JetPack",1000,1);

WelcomeText = TextDrawCreate(192.000000,112.000000,"~r~Cops n ~b~Gangs ~n~ ~n~~r~No Cheating or flaming ~n~ No absuing ~n~ Always Respect Admins And Players ~n~ No Spamming ~n~ If not doing so can lead you to kick or ban.");
TextDrawUseBox(WelcomeText,1);
TextDrawBoxColor(WelcomeText,0x00000099);
TextDrawTextSize(WelcomeText,527.000000,32.000000);
TextDrawAlignment(WelcomeText,0);
TextDrawBackgroundColor(WelcomeText,0x000000ff);
TextDrawFont(WelcomeText,3);
TextDrawLetterSize(WelcomeText,0.499999,1.200000);
TextDrawColor(WelcomeText,0xffffffff);
TextDrawSetOutline(WelcomeText,1);
TextDrawSetProportional(WelcomeText,1);
TextDrawSetShadow(WelcomeText,1);

	return 1;
}

public OnGameModeExit()
{
    new year, month, day;
	getdate(year, month, day);
	printf("The server was shutdown at %d/%d/%d.",day,month,year);
	return 1;
}

//<<<<<<<<<<<<<<<<<<<<<(TEAMS AND CLASSES)<<<<<<<<<<<<<<<<<<<<<<<//

public OnPlayerRequestClass(playerid, classid)
{

	SetPlayerInterior(playerid,3);
	SetPlayerPos(playerid,-2654.4,1424.2,912.4);
	SetPlayerFacingAngle(playerid, 90.0);
	SetPlayerCameraPos(playerid,-2654.4-1.5,1424.2,912.4+0.7);
    SetPlayerCameraLookAt(playerid,-2654.4,1424.2,912.4+0.7);
	new string[128];
	SetPlayerTeamFromClass(playerid, classid);
	if (classid == 0)
	{
			format(string, sizeof(string), "~y~> ~g~Grove Street");
			GameTextForPlayer(playerid,string,3500,6);
	}
	else if (classid == 1)
	{
			format(string, sizeof(string), "~y~> ~g~Grove Street");
			GameTextForPlayer(playerid,string,3500,6);

	}
	else if (classid == 2)
	{
			format(string, sizeof(string), "~y~> ~g~Grove Street");
			GameTextForPlayer(playerid,string,3500,6);
	}
	else if (classid == 3)
	{
			format(string, sizeof(string), "~y~> ~b~Cops");
			GameTextForPlayer(playerid,string,3500,6);
	}
	else if (classid == 4)
	{
		format(string, sizeof(string), "~y~> ~b~Cops");
		GameTextForPlayer(playerid,string,3500,6);
	}
	else if (classid == 5)
	{
	    format(string, sizeof(string), "~y~> ~b~Cops");
	    GameTextForPlayer(playerid,string,3500,6);
	    }


	return 1;
}

//<<<<<<<<<<<<<<<<<<<<<(CONNECT/DISCONNECT)<<<<<<<<<<<<<<<<<<<<<<<//

public OnPlayerConnect(playerid)
{
    AlreadyGiveWeapons[playerid] = false;
	new pname[MAX_PLAYER_NAME];
	#if defined joinmes
	new string[180];
	GetPlayerName(playerid, pname, sizeof(pname));
    GetPlayerName(playerid, pname, sizeof(pname));
	format(string, sizeof(string), "SERVER: %s has connected to the server.",pname);
	SendClientMessageToAll(grey, string);
	#endif
 	new playerfile[100];
	GetPlayerName(playerid, pname, sizeof(pname));
	format(playerfile, sizeof(playerfile), "Login/Users/%s.ini",pname);
	SendClientMessage(playerid, blue, "Welcome to Cops 'n' Gangs v1.10!");
	if(!dini_Exists(playerfile)) SendClientMessage(playerid, yellow, "You are not registered. Register today to save your stats! (/register)");
	else if(dini_Exists(playerfile)) SendClientMessage(playerid, yellow, "This account already exists. If you would like to login, please (/login).");
	if(dini_Int(playerfile, "Banned") == 1)
	{
	new string1[126];
	format(string1, sizeof(string1), "SERVER: %s has been kicked for ban evasion.", pname);
	SendClientMessageToAll(red, string1);
	}
		TextDrawShowForPlayer(playerid, WelcomeText);
	return 1;

}

public OnPlayerDisconnect(playerid, reason)
{
    SaveWeaponsToFile(playerid);
	if(logged[playerid] == 1)
	{
	new playerfile[100], pname[MAX_PLAYER_NAME];
	GetPlayerName(playerid, pname, sizeof(pname));
	format(playerfile, sizeof(playerfile), "Login/Users/%s.ini",pname);
	dini_IntSet(playerfile, "Level", level[playerid]);
	dini_IntSet(playerfile, "Cash", GetPlayerMoney(playerid));
	dini_IntSet(playerfile, "Score", GetPlayerScore(playerid));
	}
    level[playerid] = 0;
    logged[playerid] = 0;
    #if defined leavemes
	new string[180], pname[MAX_PLAYER_NAME];
	GetPlayerName(playerid, pname, sizeof(pname));
	format(string, sizeof(string), "SERVER: %s has left the server.",pname);
	SendClientMessageToAll(grey, string);
	#endif
	return 1;
}

//<<<<<<<<<<<<<<<<<<<<<(THIS IS DISPLAYED WHEN A PLAYER IS NOT LOGGED IN)<<<<<<<<<<<<<<<<<<<<<<<//

public OnPlayerText(playerid, text[])
{
	SetPVarInt(playerid,"textspam",GetPVarInt(playerid,"textspam")+1);
	SetTimerEx("clearspam",5000,false,"d",playerid);
	if(GetPVarInt(playerid,"textspam") == 5) {
		new string[128];
		new tname[MAX_PLAYER_NAME];
		GetPlayerName(playerid,tname,sizeof(tname));
		format(string,sizeof(string),"KICK: %s(%d) has been kicked for excessive flood (text spam)", tname,playerid);
		SendClientMessageToAll(0xAA3333AA,string);
  		CallRemoteFunction("KickIncrease","d",playerid);
		Kick(playerid);
	}
	else if(GetPVarInt(playerid,"textspam") == 4) {
		SendClientMessage(playerid,0xAA3333AA,"WARNING: Stop spamming or you will be kicked! (wait 5 seconds)");
		return 0;
	}

	#if defined mustlogin
	    if(logged[playerid] == 0)
		{
		new playerfile[100], pname[MAX_PLAYER_NAME];
		GetPlayerName(playerid, pname, sizeof(pname));
		format(playerfile, sizeof(playerfile), "Login/Users/%s.ini",pname);
		if(dini_Exists(playerfile)) SendClientMessage(playerid, red, "Please login before chatting. (/login)");
		else SendClientMessage(playerid, red, "Please register before chatting. (/register");
		return 0;
		}
	#endif
	return 1;
}

//<<<<<<<<<<<<<<<<<<<<<(WHAT IS SHOWN/DONE WHEN A PLAYER/ADMIN LOGS IN)<<<<<<<<<<<<<<<<<<<<<<<//


public OnPlayerRequestSpawn(playerid)
{
    #if defined mustlogin
	if(logged[playerid] == 0)
	{
	new playerfile[100], pname[MAX_PLAYER_NAME];
	GetPlayerName(playerid, pname, sizeof(pname));
	format(playerfile, sizeof(playerfile), "Login/Users/%s.ini",pname);
	#if defined autologin
	if(dini_Exists(playerfile))
	{
	new ip[16];
	GetPlayerIp(playerid, ip, sizeof(ip));
	if(!strcmp(dini_Get(playerfile, "Ip"), ip, true))
	{
		new playerip[20];
		GetPlayerIp(playerid, playerip, sizeof(playerip));
		level[playerid] = dini_Int(playerfile, "Level");
		logged[playerid] = 1;
		dini_Set(playerfile, "Ip", playerip);
		GivePlayerMoney(playerid, dini_Int(playerfile, "Cash"));
		SetPlayerScore(playerid, dini_Int(playerfile, "Score"));
		logged[playerid] = 1;
		SendClientMessage(playerid, red, "You have logged in as an Admin.");
		SendClientMessage(playerid, yellow, "You have automatically logged in!");
		SpawnPlayer(playerid);
		SendClientMessage(playerid, yellow, "Type /cmds for the commands!");
		SendClientMessage(playerid, yellow,"If you don't have any weapons, type /respawn");
		 TextDrawHideForPlayer(playerid, WelcomeText);
		return 1;

	}
	}
	#endif
	if(dini_Exists(playerfile)) SendClientMessage(playerid, red, "Please login before spawning. (/login)");
	else SendClientMessage(playerid, red, "Please register before trying to spawn. (/register)");
	return 0;
	}
	#endif
	return 1;
}

//<<<<<<<<<<<<<<<<<<<<<(LOGIN AND REGISTER)<<<<<<<<<<<<<<<<<<<<<<<//

COMMAND:login(playerid, params[])
{
	if(logged[playerid] == 1) return SendClientMessage(playerid, red, "You are already logged in.");
	ShowPlayerDialog(playerid,200,DIALOG_STYLE_INPUT,"Login","Please enter a password to login to this account!","Login","Cancel");
	return 1;
}

COMMAND:register(playerid, params[])
{
    ShowPlayerDialog(playerid,201,DIALOG_STYLE_INPUT,"Registration","Please enter a password to register this account!","Register","Cancel");
	return 1;
}

//<<<<<<<<<<<<<<<<<<<<<(COMMANDS)<<<<<<<<<<<<<<<<<<<<<<<//

COMMAND:getweaps(playerid, classid, params[])
{
if(classid == 0)
{
		SendClientMessage(playerid, blue, "You have recived the gang weapon pack");
		GivePlayerWeapon (playerid,24,500);
		GivePlayerWeapon (playerid,26,500);
		GivePlayerWeapon (playerid,29,500);
		GivePlayerWeapon (playerid,34,500);
}

else if(classid == 1)
{
		SendClientMessage(playerid, blue, "You have recived the gang weapon pack");
		GivePlayerWeapon (playerid,24,500);
		GivePlayerWeapon (playerid,26,500);
		GivePlayerWeapon (playerid,29,500);
		GivePlayerWeapon (playerid,34,500);
}

if(classid == 2)
{
		SendClientMessage(playerid, blue, "You have recived the gang weapon pack");
		GivePlayerWeapon (playerid,24,500);
		GivePlayerWeapon (playerid,26,500);
		GivePlayerWeapon (playerid,29,500);
		GivePlayerWeapon (playerid,34,500);
}


if(classid == 3)
{
		SendClientMessage(playerid, blue, "You have recived the Cop weapon pack");
		GivePlayerWeapon (playerid,24,500);
		GivePlayerWeapon (playerid,26,500);
		GivePlayerWeapon (playerid,29,500);
		GivePlayerWeapon (playerid,34,500);
}

if(classid == 4)
{
		SendClientMessage(playerid, blue, "You have recived the Cop weapon pack");
		GivePlayerWeapon (playerid,24,500);
		GivePlayerWeapon (playerid,26,500);
		GivePlayerWeapon (playerid,29,500);
		GivePlayerWeapon (playerid,34,500);
}

if(classid == 5)
{
		SendClientMessage(playerid, blue, "You have recived the Cop weapon pack");
		GivePlayerWeapon (playerid,24,500);
		GivePlayerWeapon (playerid,26,500);
		GivePlayerWeapon (playerid,29,500);
		GivePlayerWeapon (playerid,34,500);
}
else 	GivePlayerWeapon (playerid,24,500);
		GivePlayerWeapon (playerid,26,500);
		GivePlayerWeapon (playerid,29,500);
		GivePlayerWeapon (playerid,34,500);

		return 1;

}


COMMAND:cmds(playerid, params[])
{
	if(level[playerid] >= 1)
	{
	SendClientMessage(playerid, blue, "<------------------>");
	SendClientMessage(playerid, blue, "Commands:");
	SendClientMessage(playerid, gold, "[/flip] [/nos] [/hyd] [/kill] [/respawn] [/switchteams]");
		SendClientMessage(playerid, gold, "<------------------>");
 } else SendClientMessage(playerid, red, "Error: You must be registered to use that command.");
	return 1;
}
COMMAND:flip(playerid, params[])
{
	new VehicleID;
    GetPlayerPos(playerid, X, Y, Z);
    VehicleID = GetPlayerVehicleID(playerid);
    SetVehiclePos(VehicleID, X, Y, Z);
    SetVehicleZAngle(VehicleID, 0);
    SendClientMessage(playerid, blue, "Your vehicle have been flipped!");
	return 1;
}
COMMAND:nos(playerid, params[])
{
	if(IsPlayerConnected(playerid))
	if(IsPlayerInAnyVehicle(playerid))
	{
	AddVehicleComponent(GetPlayerVehicleID(playerid), 1010);
    SendClientMessage(playerid, blue, "You added nos to your vehicle !");
	}
    return 1;
}
COMMAND:hyd(playerid, params[])
{
	if(IsPlayerConnected(playerid))
	if(IsPlayerInAnyVehicle(playerid))
 {
	AddVehicleComponent(GetPlayerVehicleID(playerid), 1087);
    SendClientMessage(playerid, blue, "You added hydraulics to your vehicle !");
	}
    return 1;
}

COMMAND:kill(playerid, params[])
{
	SetPlayerHealth(playerid, 0.0);
    return 1;
}

COMMAND:respawn(playerid, params[])
{
    //SetPlayerHealth(playerid, 0.0);
    SpawnPlayer(playerid);
	GameTextForPlayer(blue,"Respawned",3500,6);
    return 1;
    }

COMMAND:vehpos(playerid, params[])
     {
          new currentveh;
          currentveh = GetPlayerVehicleID(playerid);

          new Float:vehx, Float:vehy, Float:vehz;
          GetVehiclePos(currentveh, vehx, vehy, vehz);

          new vehpostext[96];
          format(vehpostext, sizeof(vehpostext), "The current vehicle positions are: %f, %f, %f", vehx, vehy, vehz);

          SendClientMessage(playerid, 0xFFFFFFFF, vehpostext);
          return 1;
     }



//<<<<<<<<<<<<<<<<<<<<<(ADMIN COMMANDS)<<<<<<<<<<<<<<<<<<<<<<<//

COMMAND:amenu(playerid, params[])
{
        if(level[playerid] >= 1)
        {
        ShowMenuForPlayer(AMenu, playerid);
        TogglePlayerControllable(playerid, false);
        } else SendClientMessage(playerid, red, "Error: You must be an Administrator to use that command.");
        return 1;
        }

COMMAND:heal(playerid, params[])
{
	if(level[playerid] >= 1)
	{
	SetPlayerHealth(playerid, 100.00);
	SendClientMessage(playerid, blue, "Your health has been refilled.");
	} else SendClientMessage(playerid, red, "ERROR: You must be an Admin to use this command!");
	return 1;
}
COMMAND:godmodeon(playerid, params[])
{
	if(level[playerid] >= 1)
	{
	SetPlayerHealth(playerid, 10000.00);
	SendClientMessage(playerid, blue, "You have enabled godmode!");
	} else SendClientMessage(playerid, red, "ERROR: You must be an Admin to use this command!");
	return 1;
}
COMMAND:godmodeoff(playerid, params[])
{
	if(level[playerid] >= 1)
	{
	SetPlayerHealth(playerid, 100.00);
	SendClientMessage(playerid, blue, "You have disabled godmode!");
	} else SendClientMessage(playerid, red, "ERROR: You must be an Admin to use this command!");
	return 1;
}
COMMAND:armor(playerid, params[])
{
	if(level[playerid] >= 1)
	{
	SetPlayerArmour(playerid, 100.00);
	SendClientMessage(playerid, blue, "Your armour have been refilled!");
	} else SendClientMessage(playerid, red, "Error: You must be an Administrator to use that command.");
	return 1;
}

COMMAND:ban(playerid, params[])
{
	if(level[playerid] >= 1)
	{
	SetPlayerArmour(playerid, 100.00);
	SendClientMessage(playerid, blue, "Your armour have been refilled!");
	} else SendClientMessage(playerid, red, "Error: You must be an Administrator to use that command.");
	return 1;
}


//<<<<<<<<<<<<<<<<<<<<<(DIALOGS)<<<<<<<<<<<<<<<<<<<<<<<//

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
	if(dialogid == 201)
	{
		if(!strlen(inputtext)) return ShowPlayerDialog(playerid,201,DIALOG_STYLE_INPUT,"Registration","ERROR: You did not enter a password.\nPlease enter a password to register this account!","Register","Cancel");
	    new playerfile[128], pname[MAX_PLAYER_NAME];
		GetPlayerName(playerid, pname, sizeof(pname));
		format(playerfile, sizeof(playerfile), "Login/Users/%s.ini",pname);
	 	if(dini_Exists(playerfile)) return SendClientMessage(playerid, red, "You are already registered!");
		new playerip[20];
		GetPlayerIp(playerid, playerip, sizeof(playerip));
		dini_Create(playerfile);
  		dini_IntSet(playerfile, "Password", udb_hash(inputtext));
		dini_Set(playerfile, "Ip", playerip);
		dini_IntSet(playerfile, "Level", 0);
		dini_IntSet(playerfile, "Cash", 0);
		dini_IntSet(playerfile, "Score", 0);
		logged[playerid] = 1;
		GivePlayerMoney(playerid, 500000);
		SendClientMessage(playerid, yellow, "You have registered your account! You have also been logged in.");
	}
	if(dialogid == 200)
	{
		if(!strlen(inputtext)) return ShowPlayerDialog(playerid,200,DIALOG_STYLE_INPUT,"Login","ERROR: You did not enter a password.\nPlease enter a password to login to this account!","Login","Cancel");
	    new playerfile[100], pname[MAX_PLAYER_NAME];
		GetPlayerName(playerid, pname, sizeof(pname));
		format(playerfile, sizeof(playerfile), "Login/Users/%s.ini",pname);
	 	if(!dini_Exists(playerfile)) return SendClientMessage(playerid, red, "This account is not yet registered, please type /register.");
		new tmp[256];
		tmp = dini_Get(playerfile, "Password");
    	if(udb_hash(inputtext) == strval(tmp))
    	{
		new playerip[20];
		GetPlayerIp(playerid, playerip, sizeof(playerip));
		level[playerid] = dini_Int(playerfile, "Level");
		logged[playerid] = 1;
		dini_Set(playerfile, "Ip", playerip);
		GivePlayerMoney(playerid, dini_Int(playerfile, "Cash"));
		SetPlayerScore(playerid, dini_Int(playerfile, "Score"));
		logged[playerid] = 1;
		SendClientMessage(playerid, yellow, "You have logged in!");
		} else return ShowPlayerDialog(playerid,200,DIALOG_STYLE_INPUT,"Login","ERROR: Invalid Password.\nPlease enter a password to login to this account!","Login","Cancel");
	}
	return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])
{



	if (strcmp("/rcon", cmdtext, true, 4) == 0)
	{
	    if(IsPlayerAdmin(playerid))
		SendClientMessage(playerid,0xFFFFFFAA, "USAGE: /rcon echo [message] - say a message to the server.");
		SendClientMessage(playerid,0xFFFFFFAA, "USAGE: /rcon say [message] - say a message to the server in blue.");
		SendClientMessage(playerid,0xFFFFFFAA, "USAGE: /rcon exec [file.cfg] - execute a .cfg file in your scriptfiles folder.");
		SendClientMessage(playerid,0xFFFFFFAA, "USAGE: /rcon cmdlist - check commands in an alternative way.");
		SendClientMessage(playerid,0xFFFFFFAA, "USAGE: /rcon varlist - check the server settings found in server.cfg.");
		SendClientMessage(playerid,0xFFFFFFAA, "USAGE: /rcon exit - close the servers connection.");
		SendClientMessage(playerid,0xFFFFFFAA, "USAGE: /rcon kick [playerid] - close the assigned id's connection, therefore kicking them.");
		SendClientMessage(playerid,0xFFFFFFAA, "USAGE: /rcon ban [playerid] - close the assigned id's connection, banning them. (Bans can be seen in samp.ban)");
		SendClientMessage(playerid,0xFFFFFFAA, "USAGE: /rcon reloadbans - reload samp.ban in case you edited it and unbanned/banned a player.");
		SendClientMessage(playerid,0xFFFFFFAA, "USAGE: /rcon reloadlog - reloads the log so the info saves in server_log.txt.");
		SendClientMessage(playerid,0xFFFFFFAA, "USAGE: /rcon players - shows a list of currently logged on players.");
		SendClientMessage(playerid,0xFFFFFFAA, "USAGE: /rcon banip [ip] - bans an assigned IP (ex. 127.0.0.1)");
		SendClientMessage(playerid,0xFFFFFFAA, "USAGE: /rcon unbanip [ip] - unbans an assigned IP (ex. 127.0.0.1)");
		SendClientMessage(playerid,0xFFFFFFAA, "USAGE: /rcon gravity [value] - changes the gravity (for happy hour only)");
		SendClientMessage(playerid,0xFFFFFFAA, "USAGE: /rcon weather [id] - sets the weather for all players on the server (weather id's range from 1 to 46, 10 is default)");
		SendClientMessage(playerid,0xFFFFFFAA, "USAGE: /rcon loadfs [fs] - loads an assigned filterscript. (ex. /rcon loadfs objects");
        SendClientMessage(playerid,0xFFFFFFAA, "USAGE: /rcon unloadfs [fs] - unloads an assigned filterscript. (ex. /rcon unloadfs objects");
        SendClientMessage(playerid,0xFFFFFFAA, "USAGE: /rcon reloadfs [fs] - reloads an assigned filterscript. (ex. /rcon reloadfs objects");
        SendClientMessage(playerid,red, "Missed any commands? Scroll up by pressing Page Up on your keyboard.");
		if(!IsPlayerAdmin(playerid)) SendClientMessageToAll(0xDEEE20FF, "SERVER: You are not logged into RCON!");
		return 1;
        }
        if (strcmp("/amenu", cmdtext, true, 5) == 0)
	{
		if(IsPlayerAdmin(playerid))
		ShowMenuForPlayer(AMenu, playerid);
		TogglePlayerControllable(playerid, false);
		if(!IsPlayerAdmin(playerid)) return SendClientMessageToAll(0xDEEE20FF, "SERVER: You are not logged into RCON!");
		return 1;
        }
 return 0;
}

public OnPlayerSelectedMenuRow(playerid, row)
{
    HideMenuForPlayer(AMenu, playerid);
    new Menu:current;
    current = GetPlayerMenu(playerid);
    if(current == AMenu)
    {
        switch(row)
        {
            case 0:
			{
			SetPlayerSpecialAction(playerid, SPECIAL_ACTION_USEJETPACK);
			TogglePlayerControllable(playerid, 1);
            }
            case 1:
			{
			SetPlayerHealth(playerid, 100);
			SetPlayerArmour(playerid, 100);
			TogglePlayerControllable(playerid, 1);
            }
            case 2:
			{
							for(new i = 0; i < MAX_PLAYERS; i++)
				{
					if(IsPlayerConnected(i))
					{
						Kick(i);
					}
				}
            }
            case 3:
			{
						{
							for(new i = 0; i < MAX_PLAYERS; i++)
				{
					if(IsPlayerConnected(i))
					{
						TogglePlayerControllable(i, 0);
						TogglePlayerControllable(playerid, 1);
					}
				}
            }
            }
            case 4:
			{
   			{
						{
							for(new i = 0; i < MAX_PLAYERS; i++)
				{
					if(IsPlayerConnected(i))
					{
						TogglePlayerControllable(i, 1);
						TogglePlayerControllable(playerid, 1);
					}
				}
            }
            }
            }
            case 5:
            {
            			{
						{
							for(new i = 0; i < MAX_PLAYERS; i++)
				{
					if(IsPlayerConnected(i))
					{
						GivePlayerMoney(i, 50000);
						GameTextForPlayer(i, "~r~$50000 for everyone!", 5000, 3);
						TogglePlayerControllable(playerid, 1);
					}
				}
            }
            }
            }
            case 6:
            {
            GivePlayerWeapon(playerid, 38, 99999);
            TogglePlayerControllable(playerid, 1);
            }
            case 7:
            {
            			{
						{
							for(new i = 0; i < MAX_PLAYERS; i++)
				{
					if(IsPlayerConnected(i))
					{
						SetPlayerHealth(i, 0);
						TogglePlayerControllable(playerid, 1);
					}
				}
            }
            }
            }
            case 8:
            {
            SendRconCommand("reloadfs AdminMenu");
            TogglePlayerControllable(playerid, 1);
            }
            case 9:
            {
            SendRconCommand("gmx");
            TogglePlayerControllable(playerid, 1);
            }
            case 10:
			{
			TogglePlayerControllable(playerid, 1);
			}
			case 11:
			{
			SendClientMessage(playerid,red," ");
			SendClientMessage(playerid,red," ");
			SendClientMessage(playerid,red," ");
			SendClientMessage(playerid,red," ");
			SendClientMessage(playerid,red," ");
			SendClientMessage(playerid,red," ");
			SendClientMessage(playerid,red," ");
			SendClientMessage(playerid,red," ");
			SendClientMessage(playerid,red," ");
			SendClientMessage(playerid,red," ");
		}
}
    }

	return 1;
}

//<<<<<<<<<<<<<<<<<<<<<(UNUSED FUNCTIONS)<<<<<<<<<<<<<<<<<<<<<<<//

forward clearspam(playerid);
public clearspam(playerid)
{
	SetPVarInt(playerid,"textspam",0);
}

forward JetPack();
public JetPack()
{
	for(new i;i<MAX_PLAYERS;i++)
	{
		if(IsPlayerConnected(i))
	  {
			if(GetPlayerSpecialAction(i) == SPECIAL_ACTION_USEJETPACK)
			{
				new tname[MAX_PLAYER_NAME], string[128];
				GetPlayerName(i, tname, sizeof(tname));
				format(string, sizeof(string), "AC BAN: %s(%d) has been banned for jetpack.",tname,i);
				SendClientMessageToAll(0xAA3333AA, string);
				Ban(i);
			}
		}
  	}
}

forward WeaponCheck();
public WeaponCheck()
{
	new string[128];
	new tname[MAX_PLAYER_NAME];
	for(new j;j<MAX_PLAYERS;j++)
	{
		if(IsPlayerConnected(j) && GetPlayerState(j) == PLAYER_STATE_ONFOOT)
	  {
	    new ttemp = 0;
			for(new i = 0; i < 13; i++)
			{
			  new tweap, tammo;
			  GetPlayerWeaponData(j, i ,tweap ,tammo);
			  format(string,sizeof(string),"wslot%d",i);
			  if(GetPVarInt(j,string) != tweap && tweap != 0)
				{
				  ttemp++;
				}
			}
			if(ttemp != 0)
			{
				SetPVarInt(j,"sww",GetPVarInt(j,"sww")+1);
				if(GetPVarInt(j,"sww") > 2)
				{
			  	GetPlayerName(j,tname,sizeof(tname));
	      		CallRemoteFunction("BanIncrease","d",j);
		        format(string, sizeof(string), "AC BAN: %s has been banned for weapon hacks.", tname);
				SendClientMessageToAll(0xAA3333AA, string);
				Ban(j);
				}
			}
			else if(ttemp == 0)
			{
				SetPVarInt(j,"sww",0);
			}
		}
	}
}

public OnPlayerSpawn(playerid)
{
    SetPlayerInterior(playerid, 0);
    if (!AlreadyGiveWeapons[playerid]) SetTimerEx("LoadWeaponsToFile",250,false,"i",playerid);





    return 1;
}


public OnPlayerDeath(playerid, killerid, reason)
{
	new string[64];
	GivePlayerMoney(playerid, -1000);
	GivePlayerMoney(killerid, 1000);
	format(string, sizeof(string), "KILL: You were killed by %s.", killerid);
	SendClientMessage(playerid, red, string);
	format(string, sizeof(string), "KILL: %s was killed by %s.",playerid,killerid);
	SendClientMessageToAll(red, string);
	if(killerid != INVALID_PLAYER_ID) SetPlayerScore(killerid, GetPlayerScore(killerid) + 1);
	if(playerid != INVALID_PLAYER_ID) SetPlayerScore(playerid, GetPlayerScore(playerid) - 1);
	return 1;
}

public OnVehicleSpawn(vehicleid)
{
	return 1;
}

public OnVehicleDeath(vehicleid, killerid)
{
	return 1;
}



public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
	return 1;
}

public OnPlayerExitVehicle(playerid, vehicleid)
{
	return 1;
}

public OnPlayerStateChange(playerid, newstate, oldstate)
{
	return 1;
}

public OnPlayerEnterCheckpoint(playerid)
{
	return 1;
}

public OnPlayerLeaveCheckpoint(playerid)
{
	return 1;
}

public OnPlayerEnterRaceCheckpoint(playerid)
{
	return 1;
}

public OnPlayerLeaveRaceCheckpoint(playerid)
{
	return 1;
}

public OnRconCommand(cmd[])
{
	return 1;
}

public OnObjectMoved(objectid)
{
	return 1;
}

public OnPlayerObjectMoved(playerid, objectid)
{
	return 1;
}


public OnPlayerPickUpPickup(playerid, pickupid)

{

if(pickupid == mypickup) // Check that the pickup ID of the pickup they picked up is mypickup
    {

        // It is
       SendClientMessage(playerid, 0xFFFFFFFF, "You got the Grove weapons"); // Message the player
	 	GivePlayerWeapon (playerid,24,500);
		GivePlayerWeapon (playerid,26,500);
		GivePlayerWeapon (playerid,29,500);
		GivePlayerWeapon (playerid,34,500); // Give the player the weapons
    }
    // if you need to add more pickups, simply do this:
  //else if (pickupid == (some other pickup))
  // {
        // Another pickup, do something else
   // }
	return 1;
	
}

public OnVehicleMod(playerid, vehicleid, componentid)
{
	return 1;
}

public OnVehiclePaintjob(playerid, vehicleid, paintjobid)
{
	return 1;
}

public OnVehicleRespray(playerid, vehicleid, color1, color2)
{
	return 1;
}

public OnPlayerExitedMenu(playerid)
{
	return 1;
}

public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)
{
	return 1;
}

public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
	return 1;
}

public OnRconLoginAttempt(ip[], password[], success)
{
    if(!success)
    {
        printf("WARNING: Failed RCON Login By IP %s Using Password: %s",ip, password);
        new pip[16];
        for(new i=0; i<MAX_PLAYERS; i++)
        {
            GetPlayerIp(i, pip, sizeof(pip));
            if(!strcmp(ip, pip, true))
            {
                SendClientMessage(i, 0xFFFFFFFF, "SERVER: You were kicked for a failed RCON login.");
                Kick(i);
            }
        }
    }
    return 1;
}

public OnPlayerStreamIn(playerid, forplayerid)
{
	return 1;
}

public OnPlayerStreamOut(playerid, forplayerid)
{
	return 1;
}

public OnVehicleStreamIn(vehicleid, forplayerid)
{
	return 1;
}

public OnVehicleStreamOut(vehicleid, forplayerid)
{
	return 1;
}

public OnPlayerClickPlayer(playerid, clickedplayerid, source)
{
	return 1;
}

SetPlayerTeamFromClass(playerid, classid)
{
  if(classid == 0)
   {
   gTeam[playerid] = TEAM_GANG;
   return 1;
   }
  else if(classid == 1)
  {
  gTeam[playerid] = TEAM_GANG;
  return 1;
  }
  else if(classid == 2)
  {
  gTeam[playerid] = TEAM_GANG;
  return 1;
  }

  else if(classid == 3)
  {
  gTeam[playerid] = TEAM_LSPD;
  return 1;
  }

  else if(classid == 4)
  {
  gTeam[playerid] = TEAM_LSPD;
  return 1;
  }

  else if(classid == 5)
  {
  gTeam[playerid] = TEAM_LSPD;
  return 1;
  }

  return 1;
  }

SetPlayerToTeamColor(playerid)
{
    if (gTeam[playerid] == TEAM_GANG)
    {
        SetPlayerColor(playerid, 0x00D900C8);
    }
    else if (gTeam[playerid] == TEAM_LSPD)
    {
        SetPlayerColor(playerid, 0x2641FEAA);
    }
}

SaveWeaponsToFile(playerid)
{
	new i, path[50], string[128], weaponid, ammo;
    path = GetPlayerFormattedName(playerid);
    if (!dini_Exists(path)) dini_Create(path);
	for (i=0; i<13; i++)
	{
	    GetPlayerWeaponData(playerid,i,weaponid,ammo);
	    format(string,sizeof(string),"Weapon - %d",i);
	    dini_IntSet(path,string,weaponid);
	    format(string,sizeof(string),"AmmoID - %d",i);
	    dini_IntSet(path,string,ammo == 65535 ? 0 : ammo);
	}
}

forward LoadWeaponsToFile(playerid);
public LoadWeaponsToFile(playerid)
{
	new i, path[50], string[128], weaponid, ammo;
    path = GetPlayerFormattedName(playerid);
    ResetPlayerWeapons(playerid);
	for (i=0; i<13; i++)
	{
	    format(string,sizeof(string),"Weapon - %d",i);
	    weaponid = dini_Int(path,string);
	    format(string,sizeof(string),"AmmoID - %d",i);
	    ammo = dini_Int(path,string);
	    GivePlayerWeapon(playerid,weaponid,ammo);
	}
	AlreadyGiveWeapons[playerid] = true;
}

GetPlayerFormattedName(playerid)
{
	new name[24], full[50];
 	GetPlayerName(playerid,name,sizeof(name));
 	format(full,sizeof(full),"%s/%s.txt",PATH,name);
 	return full;
}
I put the pickup code(s) in red. Any help would be appreciated
Reply
#2

pawn Код:
new
     mypickup ;
lulz
Reply
#3

Sorry
Reply
#4

l0ll00l0l0l0lll00l0l0l0ll00l0ll00l0ll

Thanks.
Reply
#5

It still says undefined symbol ._.
Reply
#6

pawn Код:
new
     ._. ;
Reply
#7

Quote:
Originally Posted by AK47317
Посмотреть сообщение
pawn Код:
new
     ._. ;
LOL that was a face

it says this:

Код:
C:\Users\Conrrr\Desktop\SAMPSERVER\pawno\menutestone.pwn(323) : warning 204: symbol is assigned a value that is never used: "mypickup"
C:\Users\Conrrr\Desktop\SAMPSERVER\pawno\menutestone.pwn(930) : error 017: undefined symbol "mypickup"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Error.
Reply
#8

Код:
/********** Cops 'n' Gangs v1.01 by Cona**********
*              Still in beta stage               *
*              Need testers!                     *
*                                                *
**************************************************/


//<<<<<<<<<<<<<<<<<<<<<(INCLUDES)<<<<<<<<<<<<<<<<<<<<<<<//

#include <a_samp>
#include <zcmd>
#include <dini>
#include <sscanf>
#include <dudb>
#include <core>
#include <string>
#include <file>
#include <time>
#include <datagram>
#include <a_players>
#include <a_vehicles>
#include <a_objects>
#include <a_samp>
#include <dutils>
#include <float>




main()
{
	print("Cops n Gangs v1.10 started!");
	print("©2010 TheHoodRat/Base/Cona SA:MP");
	new year, month, day;
	getdate(year, month, day);
	printf("Server loaded at %d/%d/%d.",day,month,year);
}

//<<<<<<<<<<<<<<<<<<<<<(DEFINES)<<<<<<<<<<<<<<<<<<<<<<<//
#define ADMINMENU 25000
#define red 0xE21F1FFF
#define yellow 0xFFFF00FF
#define blue 0x1229FAFF
#define orange 0xF97804FF
#define grey 0xCECECEFF
#define gold 0xB8860BAA
#define COLOR_INFO 0x00ff00ff //Green
#define mustlogin
#define autologin
#define logchat
#define joinmes
#define leavemes
#define COLOR_WHITE 0xFFFFFFFF
#define TEAM_GANG 0
#define TEAM_GANG1 1
#define TEAM_GANG2 2
#define TEAM_LSPD 3
#define TEAM_LSPD1 4
#define TEAM_LSPD2 5
#define TEAM_GANG_COLOR 0x00D900C8
#define TEAM_LSPD_COLOR 0x2641FEAA
#define PATH "Weapons"
new level[MAX_PLAYERS];
new logged[MAX_PLAYERS];
new gTeam[MAX_PLAYERS];
new bool:AlreadyGiveWeapons[MAX_PLAYERS];
new Menu:AMenu;
new Float:X, Float:Y, Float:Z;
new Text:WelcomeText;




#pragma unused strtok
#pragma unused ret_memcpy
#pragma tabsize 0
#pragma unused SetPlayerToTeamColor



public OnGameModeInit()
{
  
	SetGameModeText("Cops n Gangs"); // Please change.


    AddPlayerClass(105,2514.9575,-1670.8993,13.6167,73.3932,4,16,30,24,15,200); //Gang
    AddPlayerClass(106,2514.9575,-1670.8993,13.6167,73.3932,4,16,30,24,15,200); //Gang
    AddPlayerClass(107,2514.9575,-1670.8993,13.6167,73.3932,4,16,30,24,15,200); //Gang
   

    AddPlayerClass(281,1544.1941,-1675.3660,13.5579,90.0000,3,1,24,70,27,70);//LSPD
    AddPlayerClass(282,1544.1941,-1675.3660,13.5579,90.0000,3,1,24,70,27,70);//LSPD
    AddPlayerClass(283,1544.1941,-1675.3660,13.5579,90.0000,3,1,24,70,27,70);//LSPD




    AddStaticVehicle(402,2508.3909,-1671.7950,13.1619,349.5642,16,86); // Vehicle 1
    AddStaticVehicle(405,2497.6687,-1655.5892,13.1731,79.7754,16,86); // Vehicle 1
    AddStaticVehicle(411,2475.1238,-1655.1711,13.1138,90.7216,16,86); // Vehicle 1
    AddStaticVehicle(429,2493.3228,-1682.7517,13.1208,90.7026,16,86); // Vehicle 1
    AddStaticVehicle(492,2475.7446,-1679.2852,13.1185,57.9572,16,86); // Vehicle 1
    AddStaticVehicle(497,2470.0034,-1670.3381,13.0974,11.2170,0,1); // Vehicle 1
  	AddStaticVehicle(432,2430.8623,-1633.5732,13.4260,358.6529,1,0); // TANK POS
	AddStaticVehicle(456,2525.4302,-1668.6125,15.2574,271.3300,91,63); // TRUCK FOR ROOF OF HYDRA
	AddStaticVehicle(520,2529.5710,-1676.8678,20.6535,91.8399,0,0); // HYDRA
	AddStaticVehicle(497,1526.6870,-1634.0537,13.5595,182.0773,0,1); // PD HELI

    AddStaticVehicle(596,1536.0184,-1667.0193,13.1221,180.3080,0,1); // PD CAR
    AddStaticVehicle(596,1535.9218,-1678.1157,13.1130,0.6165,0,1); // PD CAR
    AddStaticVehicle(596,1540.9456,-1625.5426,13.1040,178.6210,0,1); // PD CAR
    AddStaticVehicle(596,1540.8610,-1630.8378,13.1031,359.5612,0,1); // PD CAR

	print("Classes and Vehicles were loaded successfully!");
	print("Admin Menu loaded successfully!");
	AMenu = CreateMenu("Admin Menu", 1, 50.0, 180.0, 200.0, 200.0);
	AddMenuItem(AMenu, 0, "Spawn Jetpack");
	AddMenuItem(AMenu, 0, "Refill Health and Armor");
	AddMenuItem(AMenu, 0, "Kick All");
	AddMenuItem(AMenu, 0, "Freeze All");
	AddMenuItem(AMenu, 0, "Unfreeze All");
	AddMenuItem(AMenu, 0, "Give All $50000");
	AddMenuItem(AMenu, 0, "Minigun");
	AddMenuItem(AMenu, 0, "Kill All");
	AddMenuItem(AMenu, 0, "Reload FS");
	AddMenuItem(AMenu, 0, "Restart Server");
	AddMenuItem(AMenu, 0, "Exit Menu");
	AddMenuItem(AMenu, 0, "Clear Chat");
	SetTimer("JetPack",1000,1);

WelcomeText = TextDrawCreate(192.000000,112.000000,"~r~Cops n ~b~Gangs ~n~ ~n~~r~No Cheating or flaming ~n~ No absuing ~n~ Always Respect Admins And Players ~n~ No Spamming ~n~ If not doing so can lead you to kick or ban.");
TextDrawUseBox(WelcomeText,1);
TextDrawBoxColor(WelcomeText,0x00000099);
TextDrawTextSize(WelcomeText,527.000000,32.000000);
TextDrawAlignment(WelcomeText,0);
TextDrawBackgroundColor(WelcomeText,0x000000ff);
TextDrawFont(WelcomeText,3);
TextDrawLetterSize(WelcomeText,0.499999,1.200000);
TextDrawColor(WelcomeText,0xffffffff);
TextDrawSetOutline(WelcomeText,1);
TextDrawSetProportional(WelcomeText,1);
TextDrawSetShadow(WelcomeText,1);

	return 1;
}

public OnGameModeExit()
{
    new year, month, day;
	getdate(year, month, day);
	printf("The server was shutdown at %d/%d/%d.",day,month,year);
	return 1;
}

//<<<<<<<<<<<<<<<<<<<<<(TEAMS AND CLASSES)<<<<<<<<<<<<<<<<<<<<<<<//

public OnPlayerRequestClass(playerid, classid)
{

	SetPlayerInterior(playerid,3);
	SetPlayerPos(playerid,-2654.4,1424.2,912.4);
	SetPlayerFacingAngle(playerid, 90.0);
	SetPlayerCameraPos(playerid,-2654.4-1.5,1424.2,912.4+0.7);
    SetPlayerCameraLookAt(playerid,-2654.4,1424.2,912.4+0.7);
	new string[128];
	SetPlayerTeamFromClass(playerid, classid);
	if (classid == 0)
	{
			format(string, sizeof(string), "~y~> ~g~Grove Street");
			GameTextForPlayer(playerid,string,3500,6);
	}
	else if (classid == 1)
	{
			format(string, sizeof(string), "~y~> ~g~Grove Street");
			GameTextForPlayer(playerid,string,3500,6);

	}
	else if (classid == 2)
	{
			format(string, sizeof(string), "~y~> ~g~Grove Street");
			GameTextForPlayer(playerid,string,3500,6);
	}
	else if (classid == 3)
	{
			format(string, sizeof(string), "~y~> ~b~Cops");
			GameTextForPlayer(playerid,string,3500,6);
	}
	else if (classid == 4)
	{
		format(string, sizeof(string), "~y~> ~b~Cops");
		GameTextForPlayer(playerid,string,3500,6);
	}
	else if (classid == 5)
	{
	    format(string, sizeof(string), "~y~> ~b~Cops");
	    GameTextForPlayer(playerid,string,3500,6);
	    }


	return 1;
}

//<<<<<<<<<<<<<<<<<<<<<(CONNECT/DISCONNECT)<<<<<<<<<<<<<<<<<<<<<<<//

public OnPlayerConnect(playerid)
{
    AlreadyGiveWeapons[playerid] = false;
	new pname[MAX_PLAYER_NAME];
	#if defined joinmes
	new string[180];
	GetPlayerName(playerid, pname, sizeof(pname));
    GetPlayerName(playerid, pname, sizeof(pname));
	format(string, sizeof(string), "SERVER: %s has connected to the server.",pname);
	SendClientMessageToAll(grey, string);
	#endif
 	new playerfile[100];
	GetPlayerName(playerid, pname, sizeof(pname));
	format(playerfile, sizeof(playerfile), "Login/Users/%s.ini",pname);
	SendClientMessage(playerid, blue, "Welcome to Cops 'n' Gangs v1.10!");
	if(!dini_Exists(playerfile)) SendClientMessage(playerid, yellow, "You are not registered. Register today to save your stats! (/register)");
	else if(dini_Exists(playerfile)) SendClientMessage(playerid, yellow, "This account already exists. If you would like to login, please (/login).");
	if(dini_Int(playerfile, "Banned") == 1)
	{
	new string1[126];
	format(string1, sizeof(string1), "SERVER: %s has been kicked for ban evasion.", pname);
	SendClientMessageToAll(red, string1);
	}
		TextDrawShowForPlayer(playerid, WelcomeText);
	return 1;

}

public OnPlayerDisconnect(playerid, reason)
{
    SaveWeaponsToFile(playerid);
	if(logged[playerid] == 1)
	{
	new playerfile[100], pname[MAX_PLAYER_NAME];
	GetPlayerName(playerid, pname, sizeof(pname));
	format(playerfile, sizeof(playerfile), "Login/Users/%s.ini",pname);
	dini_IntSet(playerfile, "Level", level[playerid]);
	dini_IntSet(playerfile, "Cash", GetPlayerMoney(playerid));
	dini_IntSet(playerfile, "Score", GetPlayerScore(playerid));
	}
    level[playerid] = 0;
    logged[playerid] = 0;
    #if defined leavemes
	new string[180], pname[MAX_PLAYER_NAME];
	GetPlayerName(playerid, pname, sizeof(pname));
	format(string, sizeof(string), "SERVER: %s has left the server.",pname);
	SendClientMessageToAll(grey, string);
	#endif
	return 1;
}

//<<<<<<<<<<<<<<<<<<<<<(THIS IS DISPLAYED WHEN A PLAYER IS NOT LOGGED IN)<<<<<<<<<<<<<<<<<<<<<<<//

public OnPlayerText(playerid, text[])
{
	SetPVarInt(playerid,"textspam",GetPVarInt(playerid,"textspam")+1);
	SetTimerEx("clearspam",5000,false,"d",playerid);
	if(GetPVarInt(playerid,"textspam") == 5) {
		new string[128];
		new tname[MAX_PLAYER_NAME];
		GetPlayerName(playerid,tname,sizeof(tname));
		format(string,sizeof(string),"KICK: %s(%d) has been kicked for excessive flood (text spam)", tname,playerid);
		SendClientMessageToAll(0xAA3333AA,string);
  		CallRemoteFunction("KickIncrease","d",playerid);
		Kick(playerid);
	}
	else if(GetPVarInt(playerid,"textspam") == 4) {
		SendClientMessage(playerid,0xAA3333AA,"WARNING: Stop spamming or you will be kicked! (wait 5 seconds)");
		return 0;
	}

	#if defined mustlogin
	    if(logged[playerid] == 0)
		{
		new playerfile[100], pname[MAX_PLAYER_NAME];
		GetPlayerName(playerid, pname, sizeof(pname));
		format(playerfile, sizeof(playerfile), "Login/Users/%s.ini",pname);
		if(dini_Exists(playerfile)) SendClientMessage(playerid, red, "Please login before chatting. (/login)");
		else SendClientMessage(playerid, red, "Please register before chatting. (/register");
		return 0;
		}
	#endif
	return 1;
}

//<<<<<<<<<<<<<<<<<<<<<(WHAT IS SHOWN/DONE WHEN A PLAYER/ADMIN LOGS IN)<<<<<<<<<<<<<<<<<<<<<<<//


public OnPlayerRequestSpawn(playerid)
{
    #if defined mustlogin
	if(logged[playerid] == 0)
	{
	new playerfile[100], pname[MAX_PLAYER_NAME];
	GetPlayerName(playerid, pname, sizeof(pname));
	format(playerfile, sizeof(playerfile), "Login/Users/%s.ini",pname);
	#if defined autologin
	if(dini_Exists(playerfile))
	{
	new ip[16];
	GetPlayerIp(playerid, ip, sizeof(ip));
	if(!strcmp(dini_Get(playerfile, "Ip"), ip, true))
	{
		new playerip[20];
		GetPlayerIp(playerid, playerip, sizeof(playerip));
		level[playerid] = dini_Int(playerfile, "Level");
		logged[playerid] = 1;
		dini_Set(playerfile, "Ip", playerip);
		GivePlayerMoney(playerid, dini_Int(playerfile, "Cash"));
		SetPlayerScore(playerid, dini_Int(playerfile, "Score"));
		logged[playerid] = 1;
		SendClientMessage(playerid, red, "You have logged in as an Admin.");
		SendClientMessage(playerid, yellow, "You have automatically logged in!");
		SpawnPlayer(playerid);
		SendClientMessage(playerid, yellow, "Type /cmds for the commands!");
		SendClientMessage(playerid, yellow,"If you don't have any weapons, type /respawn");
		 TextDrawHideForPlayer(playerid, WelcomeText);
		    new	mypickup = CreatePickup(1274, 2, 2504.008056, -1681.196044, 13.546875, 1);
		return 1;

	}
	}
	#endif
	if(dini_Exists(playerfile)) SendClientMessage(playerid, red, "Please login before spawning. (/login)");
	else SendClientMessage(playerid, red, "Please register before trying to spawn. (/register)");
	return 0;
	}
	#endif
	return 1;
}

//<<<<<<<<<<<<<<<<<<<<<(LOGIN AND REGISTER)<<<<<<<<<<<<<<<<<<<<<<<//

COMMAND:login(playerid, params[])
{
	if(logged[playerid] == 1) return SendClientMessage(playerid, red, "You are already logged in.");
	ShowPlayerDialog(playerid,200,DIALOG_STYLE_INPUT,"Login","Please enter a password to login to this account!","Login","Cancel");
	return 1;
}

COMMAND:register(playerid, params[])
{
    ShowPlayerDialog(playerid,201,DIALOG_STYLE_INPUT,"Registration","Please enter a password to register this account!","Register","Cancel");
	return 1;
}

//<<<<<<<<<<<<<<<<<<<<<(COMMANDS)<<<<<<<<<<<<<<<<<<<<<<<//

COMMAND:getweaps(playerid, classid, params[])
{
if(classid == 0)
{
		SendClientMessage(playerid, blue, "You have recived the gang weapon pack");
		GivePlayerWeapon (playerid,24,500);
		GivePlayerWeapon (playerid,26,500);
		GivePlayerWeapon (playerid,29,500);
		GivePlayerWeapon (playerid,34,500);
}

else if(classid == 1)
{
		SendClientMessage(playerid, blue, "You have recived the gang weapon pack");
		GivePlayerWeapon (playerid,24,500);
		GivePlayerWeapon (playerid,26,500);
		GivePlayerWeapon (playerid,29,500);
		GivePlayerWeapon (playerid,34,500);
}

if(classid == 2)
{
		SendClientMessage(playerid, blue, "You have recived the gang weapon pack");
		GivePlayerWeapon (playerid,24,500);
		GivePlayerWeapon (playerid,26,500);
		GivePlayerWeapon (playerid,29,500);
		GivePlayerWeapon (playerid,34,500);
}


if(classid == 3)
{
		SendClientMessage(playerid, blue, "You have recived the Cop weapon pack");
		GivePlayerWeapon (playerid,24,500);
		GivePlayerWeapon (playerid,26,500);
		GivePlayerWeapon (playerid,29,500);
		GivePlayerWeapon (playerid,34,500);
}

if(classid == 4)
{
		SendClientMessage(playerid, blue, "You have recived the Cop weapon pack");
		GivePlayerWeapon (playerid,24,500);
		GivePlayerWeapon (playerid,26,500);
		GivePlayerWeapon (playerid,29,500);
		GivePlayerWeapon (playerid,34,500);
}

if(classid == 5)
{
		SendClientMessage(playerid, blue, "You have recived the Cop weapon pack");
		GivePlayerWeapon (playerid,24,500);
		GivePlayerWeapon (playerid,26,500);
		GivePlayerWeapon (playerid,29,500);
		GivePlayerWeapon (playerid,34,500);
}
else 	GivePlayerWeapon (playerid,24,500);
		GivePlayerWeapon (playerid,26,500);
		GivePlayerWeapon (playerid,29,500);
		GivePlayerWeapon (playerid,34,500);

		return 1;

}


COMMAND:cmds(playerid, params[])
{
	if(level[playerid] >= 1)
	{
	SendClientMessage(playerid, blue, "<------------------>");
	SendClientMessage(playerid, blue, "Commands:");
	SendClientMessage(playerid, gold, "[/flip] [/nos] [/hyd] [/kill] [/respawn] [/switchteams]");
		SendClientMessage(playerid, gold, "<------------------>");
 } else SendClientMessage(playerid, red, "Error: You must be registered to use that command.");
	return 1;
}
COMMAND:flip(playerid, params[])
{
	new VehicleID;
    GetPlayerPos(playerid, X, Y, Z);
    VehicleID = GetPlayerVehicleID(playerid);
    SetVehiclePos(VehicleID, X, Y, Z);
    SetVehicleZAngle(VehicleID, 0);
    SendClientMessage(playerid, blue, "Your vehicle have been flipped!");
	return 1;
}
COMMAND:nos(playerid, params[])
{
	if(IsPlayerConnected(playerid))
	if(IsPlayerInAnyVehicle(playerid))
	{
	AddVehicleComponent(GetPlayerVehicleID(playerid), 1010);
    SendClientMessage(playerid, blue, "You added nos to your vehicle !");
	}
    return 1;
}
COMMAND:hyd(playerid, params[])
{
	if(IsPlayerConnected(playerid))
	if(IsPlayerInAnyVehicle(playerid))
 {
	AddVehicleComponent(GetPlayerVehicleID(playerid), 1087);
    SendClientMessage(playerid, blue, "You added hydraulics to your vehicle !");
	}
    return 1;
}

COMMAND:kill(playerid, params[])
{
	SetPlayerHealth(playerid, 0.0);
    return 1;
}

COMMAND:respawn(playerid, params[])
{
    //SetPlayerHealth(playerid, 0.0);
    SpawnPlayer(playerid);
	GameTextForPlayer(blue,"Respawned",3500,6);
    return 1;
    }

COMMAND:vehpos(playerid, params[])
     {
          new currentveh;
          currentveh = GetPlayerVehicleID(playerid);

          new Float:vehx, Float:vehy, Float:vehz;
          GetVehiclePos(currentveh, vehx, vehy, vehz);

          new vehpostext[96];
          format(vehpostext, sizeof(vehpostext), "The current vehicle positions are: %f, %f, %f", vehx, vehy, vehz);

          SendClientMessage(playerid, 0xFFFFFFFF, vehpostext);
          return 1;
     }



//<<<<<<<<<<<<<<<<<<<<<(ADMIN COMMANDS)<<<<<<<<<<<<<<<<<<<<<<<//

COMMAND:amenu(playerid, params[])
{
        if(level[playerid] >= 1)
        {
        ShowMenuForPlayer(AMenu, playerid);
        TogglePlayerControllable(playerid, false);
        } else SendClientMessage(playerid, red, "Error: You must be an Administrator to use that command.");
        return 1;
        }

COMMAND:heal(playerid, params[])
{
	if(level[playerid] >= 1)
	{
	SetPlayerHealth(playerid, 100.00);
	SendClientMessage(playerid, blue, "Your health has been refilled.");
	} else SendClientMessage(playerid, red, "ERROR: You must be an Admin to use this command!");
	return 1;
}
COMMAND:godmodeon(playerid, params[])
{
	if(level[playerid] >= 1)
	{
	SetPlayerHealth(playerid, 10000.00);
	SendClientMessage(playerid, blue, "You have enabled godmode!");
	} else SendClientMessage(playerid, red, "ERROR: You must be an Admin to use this command!");
	return 1;
}
COMMAND:godmodeoff(playerid, params[])
{
	if(level[playerid] >= 1)
	{
	SetPlayerHealth(playerid, 100.00);
	SendClientMessage(playerid, blue, "You have disabled godmode!");
	} else SendClientMessage(playerid, red, "ERROR: You must be an Admin to use this command!");
	return 1;
}
COMMAND:armor(playerid, params[])
{
	if(level[playerid] >= 1)
	{
	SetPlayerArmour(playerid, 100.00);
	SendClientMessage(playerid, blue, "Your armour have been refilled!");
	} else SendClientMessage(playerid, red, "Error: You must be an Administrator to use that command.");
	return 1;
}

COMMAND:ban(playerid, params[])
{
	if(level[playerid] >= 1)
	{
	SetPlayerArmour(playerid, 100.00);
	SendClientMessage(playerid, blue, "Your armour have been refilled!");
	} else SendClientMessage(playerid, red, "Error: You must be an Administrator to use that command.");
	return 1;
}


//<<<<<<<<<<<<<<<<<<<<<(DIALOGS)<<<<<<<<<<<<<<<<<<<<<<<//

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
	if(dialogid == 201)
	{
		if(!strlen(inputtext)) return ShowPlayerDialog(playerid,201,DIALOG_STYLE_INPUT,"Registration","ERROR: You did not enter a password.\nPlease enter a password to register this account!","Register","Cancel");
	    new playerfile[128], pname[MAX_PLAYER_NAME];
		GetPlayerName(playerid, pname, sizeof(pname));
		format(playerfile, sizeof(playerfile), "Login/Users/%s.ini",pname);
	 	if(dini_Exists(playerfile)) return SendClientMessage(playerid, red, "You are already registered!");
		new playerip[20];
		GetPlayerIp(playerid, playerip, sizeof(playerip));
		dini_Create(playerfile);
  		dini_IntSet(playerfile, "Password", udb_hash(inputtext));
		dini_Set(playerfile, "Ip", playerip);
		dini_IntSet(playerfile, "Level", 0);
		dini_IntSet(playerfile, "Cash", 0);
		dini_IntSet(playerfile, "Score", 0);
		logged[playerid] = 1;
		GivePlayerMoney(playerid, 500000);
		SendClientMessage(playerid, yellow, "You have registered your account! You have also been logged in.");
	}
	if(dialogid == 200)
	{
		if(!strlen(inputtext)) return ShowPlayerDialog(playerid,200,DIALOG_STYLE_INPUT,"Login","ERROR: You did not enter a password.\nPlease enter a password to login to this account!","Login","Cancel");
	    new playerfile[100], pname[MAX_PLAYER_NAME];
		GetPlayerName(playerid, pname, sizeof(pname));
		format(playerfile, sizeof(playerfile), "Login/Users/%s.ini",pname);
	 	if(!dini_Exists(playerfile)) return SendClientMessage(playerid, red, "This account is not yet registered, please type /register.");
		new tmp[256];
		tmp = dini_Get(playerfile, "Password");
    	if(udb_hash(inputtext) == strval(tmp))
    	{
		new playerip[20];
		GetPlayerIp(playerid, playerip, sizeof(playerip));
		level[playerid] = dini_Int(playerfile, "Level");
		logged[playerid] = 1;
		dini_Set(playerfile, "Ip", playerip);
		GivePlayerMoney(playerid, dini_Int(playerfile, "Cash"));
		SetPlayerScore(playerid, dini_Int(playerfile, "Score"));
		logged[playerid] = 1;
		SendClientMessage(playerid, yellow, "You have logged in!");
		} else return ShowPlayerDialog(playerid,200,DIALOG_STYLE_INPUT,"Login","ERROR: Invalid Password.\nPlease enter a password to login to this account!","Login","Cancel");
	}
	
	return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])
{


	if (strcmp("/rcon", cmdtext, true, 4) == 0)
	{
	    if(IsPlayerAdmin(playerid))
		SendClientMessage(playerid,0xFFFFFFAA, "USAGE: /rcon echo [message] - say a message to the server.");
		SendClientMessage(playerid,0xFFFFFFAA, "USAGE: /rcon say [message] - say a message to the server in blue.");
		SendClientMessage(playerid,0xFFFFFFAA, "USAGE: /rcon exec [file.cfg] - execute a .cfg file in your scriptfiles folder.");
		SendClientMessage(playerid,0xFFFFFFAA, "USAGE: /rcon cmdlist - check commands in an alternative way.");
		SendClientMessage(playerid,0xFFFFFFAA, "USAGE: /rcon varlist - check the server settings found in server.cfg.");
		SendClientMessage(playerid,0xFFFFFFAA, "USAGE: /rcon exit - close the servers connection.");
		SendClientMessage(playerid,0xFFFFFFAA, "USAGE: /rcon kick [playerid] - close the assigned id's connection, therefore kicking them.");
		SendClientMessage(playerid,0xFFFFFFAA, "USAGE: /rcon ban [playerid] - close the assigned id's connection, banning them. (Bans can be seen in samp.ban)");
		SendClientMessage(playerid,0xFFFFFFAA, "USAGE: /rcon reloadbans - reload samp.ban in case you edited it and unbanned/banned a player.");
		SendClientMessage(playerid,0xFFFFFFAA, "USAGE: /rcon reloadlog - reloads the log so the info saves in server_log.txt.");
		SendClientMessage(playerid,0xFFFFFFAA, "USAGE: /rcon players - shows a list of currently logged on players.");
		SendClientMessage(playerid,0xFFFFFFAA, "USAGE: /rcon banip [ip] - bans an assigned IP (ex. 127.0.0.1)");
		SendClientMessage(playerid,0xFFFFFFAA, "USAGE: /rcon unbanip [ip] - unbans an assigned IP (ex. 127.0.0.1)");
		SendClientMessage(playerid,0xFFFFFFAA, "USAGE: /rcon gravity [value] - changes the gravity (for happy hour only)");
		SendClientMessage(playerid,0xFFFFFFAA, "USAGE: /rcon weather [id] - sets the weather for all players on the server (weather id's range from 1 to 46, 10 is default)");
		SendClientMessage(playerid,0xFFFFFFAA, "USAGE: /rcon loadfs [fs] - loads an assigned filterscript. (ex. /rcon loadfs objects");
        SendClientMessage(playerid,0xFFFFFFAA, "USAGE: /rcon unloadfs [fs] - unloads an assigned filterscript. (ex. /rcon unloadfs objects");
        SendClientMessage(playerid,0xFFFFFFAA, "USAGE: /rcon reloadfs [fs] - reloads an assigned filterscript. (ex. /rcon reloadfs objects");
        SendClientMessage(playerid,red, "Missed any commands? Scroll up by pressing Page Up on your keyboard.");
		if(!IsPlayerAdmin(playerid)) SendClientMessageToAll(0xDEEE20FF, "SERVER: You are not logged into RCON!");
		return 1;
        }
        if (strcmp("/amenu", cmdtext, true, 5) == 0)
	{
		if(IsPlayerAdmin(playerid))
		ShowMenuForPlayer(AMenu, playerid);
		TogglePlayerControllable(playerid, false);
		if(!IsPlayerAdmin(playerid)) return SendClientMessageToAll(0xDEEE20FF, "SERVER: You are not logged into RCON!");
		return 1;
        }
 return 0;
}

public OnPlayerSelectedMenuRow(playerid, row)
{
    HideMenuForPlayer(AMenu, playerid);
    new Menu:current;
    current = GetPlayerMenu(playerid);
    if(current == AMenu)
    {
        switch(row)
        {
            case 0:
			{
			SetPlayerSpecialAction(playerid, SPECIAL_ACTION_USEJETPACK);
			TogglePlayerControllable(playerid, 1);
            }
            case 1:
			{
			SetPlayerHealth(playerid, 100);
			SetPlayerArmour(playerid, 100);
			TogglePlayerControllable(playerid, 1);
            }
            case 2:
			{
							for(new i = 0; i < MAX_PLAYERS; i++)
				{
					if(IsPlayerConnected(i))
					{
						Kick(i);
					}
				}
            }
            case 3:
			{
						{
							for(new i = 0; i < MAX_PLAYERS; i++)
				{
					if(IsPlayerConnected(i))
					{
						TogglePlayerControllable(i, 0);
						TogglePlayerControllable(playerid, 1);
					}
				}
            }
            }
            case 4:
			{
   			{
						{
							for(new i = 0; i < MAX_PLAYERS; i++)
				{
					if(IsPlayerConnected(i))
					{
						TogglePlayerControllable(i, 1);
						TogglePlayerControllable(playerid, 1);
					}
				}
            }
            }
            }
            case 5:
            {
            			{
						{
							for(new i = 0; i < MAX_PLAYERS; i++)
				{
					if(IsPlayerConnected(i))
					{
						GivePlayerMoney(i, 50000);
						GameTextForPlayer(i, "~r~$50000 for everyone!", 5000, 3);
						TogglePlayerControllable(playerid, 1);
					}
				}
            }
            }
            }
            case 6:
            {
            GivePlayerWeapon(playerid, 38, 99999);
            TogglePlayerControllable(playerid, 1);
            }
            case 7:
            {
            			{
						{
							for(new i = 0; i < MAX_PLAYERS; i++)
				{
					if(IsPlayerConnected(i))
					{
						SetPlayerHealth(i, 0);
						TogglePlayerControllable(playerid, 1);
					}
				}
            }
            }
            }
            case 8:
            {
            SendRconCommand("reloadfs AdminMenu");
            TogglePlayerControllable(playerid, 1);
            }
            case 9:
            {
            SendRconCommand("gmx");
            TogglePlayerControllable(playerid, 1);
            }
            case 10:
			{
			TogglePlayerControllable(playerid, 1);
			}
			case 11:
			{
			SendClientMessage(playerid,red," ");
			SendClientMessage(playerid,red," ");
			SendClientMessage(playerid,red," ");
			SendClientMessage(playerid,red," ");
			SendClientMessage(playerid,red," ");
			SendClientMessage(playerid,red," ");
			SendClientMessage(playerid,red," ");
			SendClientMessage(playerid,red," ");
			SendClientMessage(playerid,red," ");
			SendClientMessage(playerid,red," ");
		}
}
    }

	return 1;
}

//<<<<<<<<<<<<<<<<<<<<<(UNUSED FUNCTIONS)<<<<<<<<<<<<<<<<<<<<<<<//

forward clearspam(playerid);
public clearspam(playerid)
{
	SetPVarInt(playerid,"textspam",0);
}

forward JetPack();
public JetPack()
{
	for(new i;i<MAX_PLAYERS;i++)
	{
		if(IsPlayerConnected(i))
	  {
			if(GetPlayerSpecialAction(i) == SPECIAL_ACTION_USEJETPACK)
			{
				new tname[MAX_PLAYER_NAME], string[128];
				GetPlayerName(i, tname, sizeof(tname));
				format(string, sizeof(string), "AC BAN: %s(%d) has been banned for jetpack.",tname,i);
				SendClientMessageToAll(0xAA3333AA, string);
				Ban(i);
			}
		}
  	}
}

forward WeaponCheck();
public WeaponCheck()
{
	new string[128];
	new tname[MAX_PLAYER_NAME];
	for(new j;j<MAX_PLAYERS;j++)
	{
		if(IsPlayerConnected(j) && GetPlayerState(j) == PLAYER_STATE_ONFOOT)
	  {
	    new ttemp = 0;
			for(new i = 0; i < 13; i++)
			{
			  new tweap, tammo;
			  GetPlayerWeaponData(j, i ,tweap ,tammo);
			  format(string,sizeof(string),"wslot%d",i);
			  if(GetPVarInt(j,string) != tweap && tweap != 0)
				{
				  ttemp++;
				}
			}
			if(ttemp != 0)
			{
				SetPVarInt(j,"sww",GetPVarInt(j,"sww")+1);
				if(GetPVarInt(j,"sww") > 2)
				{
			  	GetPlayerName(j,tname,sizeof(tname));
	      		CallRemoteFunction("BanIncrease","d",j);
		        format(string, sizeof(string), "AC BAN: %s has been banned for weapon hacks.", tname);
				SendClientMessageToAll(0xAA3333AA, string);
				Ban(j);
				}
			}
			else if(ttemp == 0)
			{
				SetPVarInt(j,"sww",0);
			}
		}
	}
}

public OnPlayerSpawn(playerid)
{
    SetPlayerInterior(playerid, 0);
    if (!AlreadyGiveWeapons[playerid]) SetTimerEx("LoadWeaponsToFile",250,false,"i",playerid);





    return 1;
}


public OnPlayerDeath(playerid, killerid, reason)
{
	new string[64];
	GivePlayerMoney(playerid, -1000);
	GivePlayerMoney(killerid, 1000);
	format(string, sizeof(string), "KILL: You were killed by %s.", killerid);
	SendClientMessage(playerid, red, string);
	format(string, sizeof(string), "KILL: %s was killed by %s.",playerid,killerid);
	SendClientMessageToAll(red, string);
	if(killerid != INVALID_PLAYER_ID) SetPlayerScore(killerid, GetPlayerScore(killerid) + 1);
	if(playerid != INVALID_PLAYER_ID) SetPlayerScore(playerid, GetPlayerScore(playerid) - 1);
	return 1;
}

public OnVehicleSpawn(vehicleid)
{
	return 1;
}

public OnVehicleDeath(vehicleid, killerid)
{
	return 1;
}



public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
	return 1;
}

public OnPlayerExitVehicle(playerid, vehicleid)
{
	return 1;
}

public OnPlayerStateChange(playerid, newstate, oldstate)
{
	return 1;
}

public OnPlayerEnterCheckpoint(playerid)
{
	return 1;
}

public OnPlayerLeaveCheckpoint(playerid)
{
	return 1;
}

public OnPlayerEnterRaceCheckpoint(playerid)
{
	return 1;
}

public OnPlayerLeaveRaceCheckpoint(playerid)
{
	return 1;
}

public OnRconCommand(cmd[])
{
	return 1;
}

public OnObjectMoved(objectid)
{
	return 1;
}

public OnPlayerObjectMoved(playerid, objectid)
{
	return 1;
}


public OnPlayerPickUpPickup(playerid, pickupid)

{

if(pickupid == mypickup) // Check that the pickup ID of the pickup they picked up is mypickup
    {

        // It is
       SendClientMessage(playerid, 0xFFFFFFFF, "You got the Grove weapons"); // Message the player
	 	GivePlayerWeapon (playerid,24,500);
		GivePlayerWeapon (playerid,26,500);
		GivePlayerWeapon (playerid,29,500);
		GivePlayerWeapon (playerid,34,500); // Give the player the weapons
    }
    // if you need to add more pickups, simply do this:
  //else if (pickupid == (some other pickup))
  // {
        // Another pickup, do something else
   // }
	return 1;
	
}

public OnVehicleMod(playerid, vehicleid, componentid)
{
	return 1;
}

public OnVehiclePaintjob(playerid, vehicleid, paintjobid)
{
	return 1;
}

public OnVehicleRespray(playerid, vehicleid, color1, color2)
{
	return 1;
}

public OnPlayerExitedMenu(playerid)
{
	return 1;
}

public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)
{
	return 1;
}

public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
	return 1;
}

public OnRconLoginAttempt(ip[], password[], success)
{
    if(!success)
    {
        printf("WARNING: Failed RCON Login By IP %s Using Password: %s",ip, password);
        new pip[16];
        for(new i=0; i<MAX_PLAYERS; i++)
        {
            GetPlayerIp(i, pip, sizeof(pip));
            if(!strcmp(ip, pip, true))
            {
                SendClientMessage(i, 0xFFFFFFFF, "SERVER: You were kicked for a failed RCON login.");
                Kick(i);
            }
        }
    }
    return 1;
}

public OnPlayerStreamIn(playerid, forplayerid)
{
	return 1;
}

public OnPlayerStreamOut(playerid, forplayerid)
{
	return 1;
}

public OnVehicleStreamIn(vehicleid, forplayerid)
{
	return 1;
}

public OnVehicleStreamOut(vehicleid, forplayerid)
{
	return 1;
}

public OnPlayerClickPlayer(playerid, clickedplayerid, source)
{
	return 1;
}

SetPlayerTeamFromClass(playerid, classid)
{
  if(classid == 0)
   {
   gTeam[playerid] = TEAM_GANG;
   return 1;
   }
  else if(classid == 1)
  {
  gTeam[playerid] = TEAM_GANG;
  return 1;
  }
  else if(classid == 2)
  {
  gTeam[playerid] = TEAM_GANG;
  return 1;
  }

  else if(classid == 3)
  {
  gTeam[playerid] = TEAM_LSPD;
  return 1;
  }

  else if(classid == 4)
  {
  gTeam[playerid] = TEAM_LSPD;
  return 1;
  }

  else if(classid == 5)
  {
  gTeam[playerid] = TEAM_LSPD;
  return 1;
  }

  return 1;
  }

SetPlayerToTeamColor(playerid)
{
    if (gTeam[playerid] == TEAM_GANG)
    {
        SetPlayerColor(playerid, 0x00D900C8);
    }
    else if (gTeam[playerid] == TEAM_LSPD)
    {
        SetPlayerColor(playerid, 0x2641FEAA);
    }
}

SaveWeaponsToFile(playerid)
{
	new i, path[50], string[128], weaponid, ammo;
    path = GetPlayerFormattedName(playerid);
    if (!dini_Exists(path)) dini_Create(path);
	for (i=0; i<13; i++)
	{
	    GetPlayerWeaponData(playerid,i,weaponid,ammo);
	    format(string,sizeof(string),"Weapon - %d",i);
	    dini_IntSet(path,string,weaponid);
	    format(string,sizeof(string),"AmmoID - %d",i);
	    dini_IntSet(path,string,ammo == 65535 ? 0 : ammo);
	}
}

forward LoadWeaponsToFile(playerid);
public LoadWeaponsToFile(playerid)
{
	new i, path[50], string[128], weaponid, ammo;
    path = GetPlayerFormattedName(playerid);
    ResetPlayerWeapons(playerid);
	for (i=0; i<13; i++)
	{
	    format(string,sizeof(string),"Weapon - %d",i);
	    weaponid = dini_Int(path,string);
	    format(string,sizeof(string),"AmmoID - %d",i);
	    ammo = dini_Int(path,string);
	    GivePlayerWeapon(playerid,weaponid,ammo);
	}
	AlreadyGiveWeapons[playerid] = true;
}

GetPlayerFormattedName(playerid)
{
	new name[24], full[50];
 	GetPlayerName(playerid,name,sizeof(name));
 	format(full,sizeof(full),"%s/%s.txt",PATH,name);
 	return full;
}
thats the script
Reply
#9

Put
pawn Код:
new
    mypickup
;
At TOP of your script, where your includes are.
Reply
#10

Код:
/********** Cops 'n' Gangs v1.01 by Cona**********
*              Still in beta stage               *
*              Need testers!                     *
*                                                *
**************************************************/


//<<<<<<<<<<<<<<<<<<<<<(INCLUDES)<<<<<<<<<<<<<<<<<<<<<<<//

#include <a_samp>
#include <zcmd>
#include <dini>
#include <sscanf>
#include <dudb>
#include <core>
#include <string>
#include <file>
#include <time>
#include <datagram>
#include <a_players>
#include <a_vehicles>
#include <a_objects>
#include <a_samp>
#include <dutils>
#include <float>




main()
{
	print("Cops n Gangs v1.10 started!");
	print("©2010 TheHoodRat/Base/Cona SA:MP");
	new year, month, day;
	getdate(year, month, day);
	printf("Server loaded at %d/%d/%d.",day,month,year);
}

//<<<<<<<<<<<<<<<<<<<<<(DEFINES)<<<<<<<<<<<<<<<<<<<<<<<//
#define ADMINMENU 25000
#define red 0xE21F1FFF
#define yellow 0xFFFF00FF
#define blue 0x1229FAFF
#define orange 0xF97804FF
#define grey 0xCECECEFF
#define gold 0xB8860BAA
#define mustlogin
#define autologin
#define logchat
#define joinmes
#define leavemes
#define COLOR_WHITE 0xFFFFFFFF
#define TEAM_GANG 0
#define TEAM_GANG1 1
#define TEAM_GANG2 2
#define TEAM_LSPD 3
#define TEAM_LSPD1 4
#define TEAM_LSPD2 5
#define TEAM_GANG_COLOR 0x00D900C8
#define TEAM_LSPD_COLOR 0x2641FEAA
#define PATH "Weapons"
new level[MAX_PLAYERS];
new logged[MAX_PLAYERS];
new gTeam[MAX_PLAYERS];
new bool:AlreadyGiveWeapons[MAX_PLAYERS];
new Menu:AMenu;
new Float:X, Float:Y, Float:Z;
new Text:WelcomeText;
new mypickup;




#pragma unused strtok
#pragma unused ret_memcpy
#pragma tabsize 0
#pragma unused SetPlayerToTeamColor



public OnGameModeInit()
{

	SetGameModeText("Cops n Gangs"); // Please change.


    AddPlayerClass(105,2514.9575,-1670.8993,13.6167,73.3932,4,16,30,24,15,200); //Gang
    AddPlayerClass(106,2514.9575,-1670.8993,13.6167,73.3932,4,16,30,24,15,200); //Gang
    AddPlayerClass(107,2514.9575,-1670.8993,13.6167,73.3932,4,16,30,24,15,200); //Gang
    mypickup = CreatePickup(1274, 2, 2504.008056, -1681.196044, 13.546875, 1);

    AddPlayerClass(281,1544.1941,-1675.3660,13.5579,90.0000,3,1,24,70,27,70);//LSPD
    AddPlayerClass(282,1544.1941,-1675.3660,13.5579,90.0000,3,1,24,70,27,70);//LSPD
    AddPlayerClass(283,1544.1941,-1675.3660,13.5579,90.0000,3,1,24,70,27,70);//LSPD




    AddStaticVehicle(402,2508.3909,-1671.7950,13.1619,349.5642,16,86); // Vehicle 1
    AddStaticVehicle(405,2497.6687,-1655.5892,13.1731,79.7754,16,86); // Vehicle 1
    AddStaticVehicle(411,2475.1238,-1655.1711,13.1138,90.7216,16,86); // Vehicle 1
    AddStaticVehicle(429,2493.3228,-1682.7517,13.1208,90.7026,16,86); // Vehicle 1
    AddStaticVehicle(492,2475.7446,-1679.2852,13.1185,57.9572,16,86); // Vehicle 1
    AddStaticVehicle(497,2470.0034,-1670.3381,13.0974,11.2170,0,1); // Vehicle 1
  	AddStaticVehicle(432,2430.8623,-1633.5732,13.4260,358.6529,1,0); // TANK POS
	AddStaticVehicle(456,2525.4302,-1668.6125,15.2574,271.3300,91,63); // TRUCK FOR ROOF OF HYDRA
	AddStaticVehicle(520,2529.5710,-1676.8678,20.6535,91.8399,0,0); // HYDRA
	AddStaticVehicle(497,1526.6870,-1634.0537,13.5595,182.0773,0,1); // PD HELI

    AddStaticVehicle(596,1536.0184,-1667.0193,13.1221,180.3080,0,1); // PD CAR
    AddStaticVehicle(596,1535.9218,-1678.1157,13.1130,0.6165,0,1); // PD CAR
    AddStaticVehicle(596,1540.9456,-1625.5426,13.1040,178.6210,0,1); // PD CAR
    AddStaticVehicle(596,1540.8610,-1630.8378,13.1031,359.5612,0,1); // PD CAR

	print("Classes and Vehicles were loaded successfully!");
	print("Admin Menu loaded successfully!");
	AMenu = CreateMenu("Admin Menu", 1, 50.0, 180.0, 200.0, 200.0);
	AddMenuItem(AMenu, 0, "Spawn Jetpack");
	AddMenuItem(AMenu, 0, "Refill Health and Armor");
	AddMenuItem(AMenu, 0, "Kick All");
	AddMenuItem(AMenu, 0, "Freeze All");
	AddMenuItem(AMenu, 0, "Unfreeze All");
	AddMenuItem(AMenu, 0, "Give All $50000");
	AddMenuItem(AMenu, 0, "Minigun");
	AddMenuItem(AMenu, 0, "Kill All");
	AddMenuItem(AMenu, 0, "Reload FS");
	AddMenuItem(AMenu, 0, "Restart Server");
	AddMenuItem(AMenu, 0, "Exit Menu");
	AddMenuItem(AMenu, 0, "Clear Chat");
	SetTimer("JetPack",1000,1);

WelcomeText = TextDrawCreate(192.000000,112.000000,"~r~Cops n ~b~Gangs ~n~ ~n~~r~No Cheating or flaming ~n~ No absuing ~n~ Always Respect Admins And Players ~n~ No Spamming ~n~ If not doing so can lead you to kick or ban.");
TextDrawUseBox(WelcomeText,1);
TextDrawBoxColor(WelcomeText,0x00000099);
TextDrawTextSize(WelcomeText,527.000000,32.000000);
TextDrawAlignment(WelcomeText,0);
TextDrawBackgroundColor(WelcomeText,0x000000ff);
TextDrawFont(WelcomeText,3);
TextDrawLetterSize(WelcomeText,0.499999,1.200000);
TextDrawColor(WelcomeText,0xffffffff);
TextDrawSetOutline(WelcomeText,1);
TextDrawSetProportional(WelcomeText,1);
TextDrawSetShadow(WelcomeText,1);

	return 1;
}

public OnGameModeExit()
{
    new year, month, day;
	getdate(year, month, day);
	printf("The server was shutdown at %d/%d/%d.",day,month,year);
	return 1;
}

//<<<<<<<<<<<<<<<<<<<<<(TEAMS AND CLASSES)<<<<<<<<<<<<<<<<<<<<<<<//

public OnPlayerRequestClass(playerid, classid)
{

	SetPlayerInterior(playerid,3);
	SetPlayerPos(playerid,-2654.4,1424.2,912.4);
	SetPlayerFacingAngle(playerid, 90.0);
	SetPlayerCameraPos(playerid,-2654.4-1.5,1424.2,912.4+0.7);
    SetPlayerCameraLookAt(playerid,-2654.4,1424.2,912.4+0.7);
	new string[128];
	SetPlayerTeamFromClass(playerid, classid);
	if (classid == 0)
	{
			format(string, sizeof(string), "~y~> ~g~Grove Street");
			GameTextForPlayer(playerid,string,3500,6);
	}
	else if (classid == 1)
	{
			format(string, sizeof(string), "~y~> ~g~Grove Street");
			GameTextForPlayer(playerid,string,3500,6);

	}
	else if (classid == 2)
	{
			format(string, sizeof(string), "~y~> ~g~Grove Street");
			GameTextForPlayer(playerid,string,3500,6);
	}
	else if (classid == 3)
	{
			format(string, sizeof(string), "~y~> ~b~Cops");
			GameTextForPlayer(playerid,string,3500,6);
	}
	else if (classid == 4)
	{
		format(string, sizeof(string), "~y~> ~b~Cops");
		GameTextForPlayer(playerid,string,3500,6);
	}
	else if (classid == 5)
	{
	    format(string, sizeof(string), "~y~> ~b~Cops");
	    GameTextForPlayer(playerid,string,3500,6);
	    }


	return 1;
}

//<<<<<<<<<<<<<<<<<<<<<(CONNECT/DISCONNECT)<<<<<<<<<<<<<<<<<<<<<<<//

public OnPlayerConnect(playerid)
{
    AlreadyGiveWeapons[playerid] = false;
	new pname[MAX_PLAYER_NAME];
	#if defined joinmes
	new string[180];
	GetPlayerName(playerid, pname, sizeof(pname));
    GetPlayerName(playerid, pname, sizeof(pname));
	format(string, sizeof(string), "SERVER: %s has connected to the server.",pname);
	SendClientMessageToAll(grey, string);
	#endif
 	new playerfile[100];
	GetPlayerName(playerid, pname, sizeof(pname));
	format(playerfile, sizeof(playerfile), "Login/Users/%s.ini",pname);
	SendClientMessage(playerid, blue, "Welcome to Cops 'n' Gangs v1.10!");
	if(!dini_Exists(playerfile)) SendClientMessage(playerid, yellow, "You are not registered. Register today to save your stats! (/register)");
	else if(dini_Exists(playerfile)) SendClientMessage(playerid, yellow, "This account already exists. If you would like to login, please (/login).");
	if(dini_Int(playerfile, "Banned") == 1)
	{
	new string1[126];
	format(string1, sizeof(string1), "SERVER: %s has been kicked for ban evasion.", pname);
	SendClientMessageToAll(red, string1);
	}
		TextDrawShowForPlayer(playerid, WelcomeText);
	return 1;

}

public OnPlayerDisconnect(playerid, reason)
{
    SaveWeaponsToFile(playerid);
	if(logged[playerid] == 1)
	{
	new playerfile[100], pname[MAX_PLAYER_NAME];
	GetPlayerName(playerid, pname, sizeof(pname));
	format(playerfile, sizeof(playerfile), "Login/Users/%s.ini",pname);
	dini_IntSet(playerfile, "Level", level[playerid]);
	dini_IntSet(playerfile, "Cash", GetPlayerMoney(playerid));
	dini_IntSet(playerfile, "Score", GetPlayerScore(playerid));
	}
    level[playerid] = 0;
    logged[playerid] = 0;
    #if defined leavemes
	new string[180], pname[MAX_PLAYER_NAME];
	GetPlayerName(playerid, pname, sizeof(pname));
	format(string, sizeof(string), "SERVER: %s has left the server.",pname);
	SendClientMessageToAll(grey, string);
	#endif
	return 1;
}

//<<<<<<<<<<<<<<<<<<<<<(THIS IS DISPLAYED WHEN A PLAYER IS NOT LOGGED IN)<<<<<<<<<<<<<<<<<<<<<<<//

public OnPlayerText(playerid, text[])
{
	SetPVarInt(playerid,"textspam",GetPVarInt(playerid,"textspam")+1);
	SetTimerEx("clearspam",5000,false,"d",playerid);
	if(GetPVarInt(playerid,"textspam") == 5) {
		new string[128];
		new tname[MAX_PLAYER_NAME];
		GetPlayerName(playerid,tname,sizeof(tname));
		format(string,sizeof(string),"KICK: %s(%d) has been kicked for excessive flood (text spam)", tname,playerid);
		SendClientMessageToAll(0xAA3333AA,string);
  		CallRemoteFunction("KickIncrease","d",playerid);
		Kick(playerid);
	}
	else if(GetPVarInt(playerid,"textspam") == 4) {
		SendClientMessage(playerid,0xAA3333AA,"WARNING: Stop spamming or you will be kicked! (wait 5 seconds)");
		return 0;
	}

	#if defined mustlogin
	    if(logged[playerid] == 0)
		{
		new playerfile[100], pname[MAX_PLAYER_NAME];
		GetPlayerName(playerid, pname, sizeof(pname));
		format(playerfile, sizeof(playerfile), "Login/Users/%s.ini",pname);
		if(dini_Exists(playerfile)) SendClientMessage(playerid, red, "Please login before chatting. (/login)");
		else SendClientMessage(playerid, red, "Please register before chatting. (/register");
		return 0;
		}
	#endif
	return 1;
}

//<<<<<<<<<<<<<<<<<<<<<(WHAT IS SHOWN/DONE WHEN A PLAYER/ADMIN LOGS IN)<<<<<<<<<<<<<<<<<<<<<<<//


public OnPlayerRequestSpawn(playerid)
{
    #if defined mustlogin
	if(logged[playerid] == 0)
	{
	new playerfile[100], pname[MAX_PLAYER_NAME];
	GetPlayerName(playerid, pname, sizeof(pname));
	format(playerfile, sizeof(playerfile), "Login/Users/%s.ini",pname);
	#if defined autologin
	if(dini_Exists(playerfile))
	{
	new ip[16];
	GetPlayerIp(playerid, ip, sizeof(ip));
	if(!strcmp(dini_Get(playerfile, "Ip"), ip, true))
	{
		new playerip[20];
		GetPlayerIp(playerid, playerip, sizeof(playerip));
		level[playerid] = dini_Int(playerfile, "Level");
		logged[playerid] = 1;
		dini_Set(playerfile, "Ip", playerip);
		GivePlayerMoney(playerid, dini_Int(playerfile, "Cash"));
		SetPlayerScore(playerid, dini_Int(playerfile, "Score"));
		logged[playerid] = 1;
		SendClientMessage(playerid, red, "You have logged in as an Admin.");
		SendClientMessage(playerid, yellow, "You have automatically logged in!");
		SpawnPlayer(playerid);
		SendClientMessage(playerid, yellow, "Type /cmds for the commands!");
		SendClientMessage(playerid, yellow,"If you don't have any weapons, type /respawn");
		 TextDrawHideForPlayer(playerid, WelcomeText);
		return 1;

	}
	}
	#endif
	if(dini_Exists(playerfile)) SendClientMessage(playerid, red, "Please login before spawning. (/login)");
	else SendClientMessage(playerid, red, "Please register before trying to spawn. (/register)");
	return 0;
	}
	#endif
	return 1;
}

//<<<<<<<<<<<<<<<<<<<<<(LOGIN AND REGISTER)<<<<<<<<<<<<<<<<<<<<<<<//

COMMAND:login(playerid, params[])
{
	if(logged[playerid] == 1) return SendClientMessage(playerid, red, "You are already logged in.");
	ShowPlayerDialog(playerid,200,DIALOG_STYLE_INPUT,"Login","Please enter a password to login to this account!","Login","Cancel");
	return 1;
}

COMMAND:register(playerid, params[])
{
    ShowPlayerDialog(playerid,201,DIALOG_STYLE_INPUT,"Registration","Please enter a password to register this account!","Register","Cancel");
	return 1;
}

//<<<<<<<<<<<<<<<<<<<<<(COMMANDS)<<<<<<<<<<<<<<<<<<<<<<<//

COMMAND:getweaps(playerid, classid, params[])
{
if(classid == 0)
{
		SendClientMessage(playerid, blue, "You have recived the gang weapon pack");
		GivePlayerWeapon (playerid,24,500);
		GivePlayerWeapon (playerid,26,500);
		GivePlayerWeapon (playerid,29,500);
		GivePlayerWeapon (playerid,34,500);
}

else if(classid == 1)
{
		SendClientMessage(playerid, blue, "You have recived the gang weapon pack");
		GivePlayerWeapon (playerid,24,500);
		GivePlayerWeapon (playerid,26,500);
		GivePlayerWeapon (playerid,29,500);
		GivePlayerWeapon (playerid,34,500);
}

if(classid == 2)
{
		SendClientMessage(playerid, blue, "You have recived the gang weapon pack");
		GivePlayerWeapon (playerid,24,500);
		GivePlayerWeapon (playerid,26,500);
		GivePlayerWeapon (playerid,29,500);
		GivePlayerWeapon (playerid,34,500);
}


if(classid == 3)
{
		SendClientMessage(playerid, blue, "You have recived the Cop weapon pack");
		GivePlayerWeapon (playerid,24,500);
		GivePlayerWeapon (playerid,26,500);
		GivePlayerWeapon (playerid,29,500);
		GivePlayerWeapon (playerid,34,500);
}

if(classid == 4)
{
		SendClientMessage(playerid, blue, "You have recived the Cop weapon pack");
		GivePlayerWeapon (playerid,24,500);
		GivePlayerWeapon (playerid,26,500);
		GivePlayerWeapon (playerid,29,500);
		GivePlayerWeapon (playerid,34,500);
}

if(classid == 5)
{
		SendClientMessage(playerid, blue, "You have recived the Cop weapon pack");
		GivePlayerWeapon (playerid,24,500);
		GivePlayerWeapon (playerid,26,500);
		GivePlayerWeapon (playerid,29,500);
		GivePlayerWeapon (playerid,34,500);
}
else 	GivePlayerWeapon (playerid,24,500);
		GivePlayerWeapon (playerid,26,500);
		GivePlayerWeapon (playerid,29,500);
		GivePlayerWeapon (playerid,34,500);

		return 1;

}


COMMAND:cmds(playerid, params[])
{
	if(level[playerid] >= 1)
	{
	SendClientMessage(playerid, blue, "<------------------>");
	SendClientMessage(playerid, blue, "Commands:");
	SendClientMessage(playerid, gold, "[/flip] [/nos] [/hyd] [/kill] [/respawn] [/switchteams]");
		SendClientMessage(playerid, gold, "<------------------>");
 } else SendClientMessage(playerid, red, "Error: You must be registered to use that command.");
	return 1;
}
COMMAND:flip(playerid, params[])
{
	new VehicleID;
    GetPlayerPos(playerid, X, Y, Z);
    VehicleID = GetPlayerVehicleID(playerid);
    SetVehiclePos(VehicleID, X, Y, Z);
    SetVehicleZAngle(VehicleID, 0);
    SendClientMessage(playerid, blue, "Your vehicle have been flipped!");
	return 1;
}
COMMAND:nos(playerid, params[])
{
	if(IsPlayerConnected(playerid))
	if(IsPlayerInAnyVehicle(playerid))
	{
	AddVehicleComponent(GetPlayerVehicleID(playerid), 1010);
    SendClientMessage(playerid, blue, "You added nos to your vehicle !");
	}
    return 1;
}
COMMAND:hyd(playerid, params[])
{
	if(IsPlayerConnected(playerid))
	if(IsPlayerInAnyVehicle(playerid))
 {
	AddVehicleComponent(GetPlayerVehicleID(playerid), 1087);
    SendClientMessage(playerid, blue, "You added hydraulics to your vehicle !");
	}
    return 1;
}

COMMAND:kill(playerid, params[])
{
	SetPlayerHealth(playerid, 0.0);
    return 1;
}

COMMAND:respawn(playerid, params[])
{
    //SetPlayerHealth(playerid, 0.0);
    SpawnPlayer(playerid);
	GameTextForPlayer(blue,"Respawned",3500,6);
    return 1;
    }

COMMAND:vehpos(playerid, params[])
     {
          new currentveh;
          currentveh = GetPlayerVehicleID(playerid);

          new Float:vehx, Float:vehy, Float:vehz;
          GetVehiclePos(currentveh, vehx, vehy, vehz);

          new vehpostext[96];
          format(vehpostext, sizeof(vehpostext), "The current vehicle positions are: %f, %f, %f", vehx, vehy, vehz);

          SendClientMessage(playerid, 0xFFFFFFFF, vehpostext);
          return 1;
     }



//<<<<<<<<<<<<<<<<<<<<<(ADMIN COMMANDS)<<<<<<<<<<<<<<<<<<<<<<<//

COMMAND:amenu(playerid, params[])
{
        if(level[playerid] >= 1)
        {
        ShowMenuForPlayer(AMenu, playerid);
        TogglePlayerControllable(playerid, false);
        } else SendClientMessage(playerid, red, "Error: You must be an Administrator to use that command.");
        return 1;
        }

COMMAND:heal(playerid, params[])
{
	if(level[playerid] >= 1)
	{
	SetPlayerHealth(playerid, 100.00);
	SendClientMessage(playerid, blue, "Your health has been refilled.");
	} else SendClientMessage(playerid, red, "ERROR: You must be an Admin to use this command!");
	return 1;
}
COMMAND:godmodeon(playerid, params[])
{
	if(level[playerid] >= 1)
	{
	SetPlayerHealth(playerid, 10000.00);
	SendClientMessage(playerid, blue, "You have enabled godmode!");
	} else SendClientMessage(playerid, red, "ERROR: You must be an Admin to use this command!");
	return 1;
}
COMMAND:godmodeoff(playerid, params[])
{
	if(level[playerid] >= 1)
	{
	SetPlayerHealth(playerid, 100.00);
	SendClientMessage(playerid, blue, "You have disabled godmode!");
	} else SendClientMessage(playerid, red, "ERROR: You must be an Admin to use this command!");
	return 1;
}
COMMAND:armor(playerid, params[])
{
	if(level[playerid] >= 1)
	{
	SetPlayerArmour(playerid, 100.00);
	SendClientMessage(playerid, blue, "Your armour have been refilled!");
	} else SendClientMessage(playerid, red, "Error: You must be an Administrator to use that command.");
	return 1;
}

COMMAND:ban(playerid, params[])
{
	if(level[playerid] >= 1)
	{
	SetPlayerArmour(playerid, 100.00);
	SendClientMessage(playerid, blue, "Your armour have been refilled!");
	} else SendClientMessage(playerid, red, "Error: You must be an Administrator to use that command.");
	return 1;
}


//<<<<<<<<<<<<<<<<<<<<<(DIALOGS)<<<<<<<<<<<<<<<<<<<<<<<//

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
	if(dialogid == 201)
	{
		if(!strlen(inputtext)) return ShowPlayerDialog(playerid,201,DIALOG_STYLE_INPUT,"Registration","ERROR: You did not enter a password.\nPlease enter a password to register this account!","Register","Cancel");
	    new playerfile[128], pname[MAX_PLAYER_NAME];
		GetPlayerName(playerid, pname, sizeof(pname));
		format(playerfile, sizeof(playerfile), "Login/Users/%s.ini",pname);
	 	if(dini_Exists(playerfile)) return SendClientMessage(playerid, red, "You are already registered!");
		new playerip[20];
		GetPlayerIp(playerid, playerip, sizeof(playerip));
		dini_Create(playerfile);
  		dini_IntSet(playerfile, "Password", udb_hash(inputtext));
		dini_Set(playerfile, "Ip", playerip);
		dini_IntSet(playerfile, "Level", 0);
		dini_IntSet(playerfile, "Cash", 0);
		dini_IntSet(playerfile, "Score", 0);
		logged[playerid] = 1;
		GivePlayerMoney(playerid, 500000);
		SendClientMessage(playerid, yellow, "You have registered your account! You have also been logged in.");
	}
	if(dialogid == 200)
	{
		if(!strlen(inputtext)) return ShowPlayerDialog(playerid,200,DIALOG_STYLE_INPUT,"Login","ERROR: You did not enter a password.\nPlease enter a password to login to this account!","Login","Cancel");
	    new playerfile[100], pname[MAX_PLAYER_NAME];
		GetPlayerName(playerid, pname, sizeof(pname));
		format(playerfile, sizeof(playerfile), "Login/Users/%s.ini",pname);
	 	if(!dini_Exists(playerfile)) return SendClientMessage(playerid, red, "This account is not yet registered, please type /register.");
		new tmp[256];
		tmp = dini_Get(playerfile, "Password");
    	if(udb_hash(inputtext) == strval(tmp))
    	{
		new playerip[20];
		GetPlayerIp(playerid, playerip, sizeof(playerip));
		level[playerid] = dini_Int(playerfile, "Level");
		logged[playerid] = 1;
		dini_Set(playerfile, "Ip", playerip);
		GivePlayerMoney(playerid, dini_Int(playerfile, "Cash"));
		SetPlayerScore(playerid, dini_Int(playerfile, "Score"));
		logged[playerid] = 1;
		SendClientMessage(playerid, yellow, "You have logged in!");
		} else return ShowPlayerDialog(playerid,200,DIALOG_STYLE_INPUT,"Login","ERROR: Invalid Password.\nPlease enter a password to login to this account!","Login","Cancel");
	}
	return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])
{



	if (strcmp("/rcon", cmdtext, true, 4) == 0)
	{
	    if(IsPlayerAdmin(playerid))
		SendClientMessage(playerid,0xFFFFFFAA, "USAGE: /rcon echo [message] - say a message to the server.");
		SendClientMessage(playerid,0xFFFFFFAA, "USAGE: /rcon say [message] - say a message to the server in blue.");
		SendClientMessage(playerid,0xFFFFFFAA, "USAGE: /rcon exec [file.cfg] - execute a .cfg file in your scriptfiles folder.");
		SendClientMessage(playerid,0xFFFFFFAA, "USAGE: /rcon cmdlist - check commands in an alternative way.");
		SendClientMessage(playerid,0xFFFFFFAA, "USAGE: /rcon varlist - check the server settings found in server.cfg.");
		SendClientMessage(playerid,0xFFFFFFAA, "USAGE: /rcon exit - close the servers connection.");
		SendClientMessage(playerid,0xFFFFFFAA, "USAGE: /rcon kick [playerid] - close the assigned id's connection, therefore kicking them.");
		SendClientMessage(playerid,0xFFFFFFAA, "USAGE: /rcon ban [playerid] - close the assigned id's connection, banning them. (Bans can be seen in samp.ban)");
		SendClientMessage(playerid,0xFFFFFFAA, "USAGE: /rcon reloadbans - reload samp.ban in case you edited it and unbanned/banned a player.");
		SendClientMessage(playerid,0xFFFFFFAA, "USAGE: /rcon reloadlog - reloads the log so the info saves in server_log.txt.");
		SendClientMessage(playerid,0xFFFFFFAA, "USAGE: /rcon players - shows a list of currently logged on players.");
		SendClientMessage(playerid,0xFFFFFFAA, "USAGE: /rcon banip [ip] - bans an assigned IP (ex. 127.0.0.1)");
		SendClientMessage(playerid,0xFFFFFFAA, "USAGE: /rcon unbanip [ip] - unbans an assigned IP (ex. 127.0.0.1)");
		SendClientMessage(playerid,0xFFFFFFAA, "USAGE: /rcon gravity [value] - changes the gravity (for happy hour only)");
		SendClientMessage(playerid,0xFFFFFFAA, "USAGE: /rcon weather [id] - sets the weather for all players on the server (weather id's range from 1 to 46, 10 is default)");
		SendClientMessage(playerid,0xFFFFFFAA, "USAGE: /rcon loadfs [fs] - loads an assigned filterscript. (ex. /rcon loadfs objects");
        SendClientMessage(playerid,0xFFFFFFAA, "USAGE: /rcon unloadfs [fs] - unloads an assigned filterscript. (ex. /rcon unloadfs objects");
        SendClientMessage(playerid,0xFFFFFFAA, "USAGE: /rcon reloadfs [fs] - reloads an assigned filterscript. (ex. /rcon reloadfs objects");
        SendClientMessage(playerid,red, "Missed any commands? Scroll up by pressing Page Up on your keyboard.");
		if(!IsPlayerAdmin(playerid)) SendClientMessageToAll(0xDEEE20FF, "SERVER: You are not logged into RCON!");
		return 1;
        }
        if (strcmp("/amenu", cmdtext, true, 5) == 0)
	{
		if(IsPlayerAdmin(playerid))
		ShowMenuForPlayer(AMenu, playerid);
		TogglePlayerControllable(playerid, false);
		if(!IsPlayerAdmin(playerid)) return SendClientMessageToAll(0xDEEE20FF, "SERVER: You are not logged into RCON!");
		return 1;
        }
 return 0;
}

public OnPlayerSelectedMenuRow(playerid, row)
{
    HideMenuForPlayer(AMenu, playerid);
    new Menu:current;
    current = GetPlayerMenu(playerid);
    if(current == AMenu)
    {
        switch(row)
        {
            case 0:
			{
			SetPlayerSpecialAction(playerid, SPECIAL_ACTION_USEJETPACK);
			TogglePlayerControllable(playerid, 1);
            }
            case 1:
			{
			SetPlayerHealth(playerid, 100);
			SetPlayerArmour(playerid, 100);
			TogglePlayerControllable(playerid, 1);
            }
            case 2:
			{
							for(new i = 0; i < MAX_PLAYERS; i++)
				{
					if(IsPlayerConnected(i))
					{
						Kick(i);
					}
				}
            }
            case 3:
			{
						{
							for(new i = 0; i < MAX_PLAYERS; i++)
				{
					if(IsPlayerConnected(i))
					{
						TogglePlayerControllable(i, 0);
						TogglePlayerControllable(playerid, 1);
					}
				}
            }
            }
            case 4:
			{
   			{
						{
							for(new i = 0; i < MAX_PLAYERS; i++)
				{
					if(IsPlayerConnected(i))
					{
						TogglePlayerControllable(i, 1);
						TogglePlayerControllable(playerid, 1);
					}
				}
            }
            }
            }
            case 5:
            {
            			{
						{
							for(new i = 0; i < MAX_PLAYERS; i++)
				{
					if(IsPlayerConnected(i))
					{
						GivePlayerMoney(i, 50000);
						GameTextForPlayer(i, "~r~$50000 for everyone!", 5000, 3);
						TogglePlayerControllable(playerid, 1);
					}
				}
            }
            }
            }
            case 6:
            {
            GivePlayerWeapon(playerid, 38, 99999);
            TogglePlayerControllable(playerid, 1);
            }
            case 7:
            {
            			{
						{
							for(new i = 0; i < MAX_PLAYERS; i++)
				{
					if(IsPlayerConnected(i))
					{
						SetPlayerHealth(i, 0);
						TogglePlayerControllable(playerid, 1);
					}
				}
            }
            }
            }
            case 8:
            {
            SendRconCommand("reloadfs AdminMenu");
            TogglePlayerControllable(playerid, 1);
            }
            case 9:
            {
            SendRconCommand("gmx");
            TogglePlayerControllable(playerid, 1);
            }
            case 10:
			{
			TogglePlayerControllable(playerid, 1);
			}
			case 11:
			{
			SendClientMessage(playerid,red," ");
			SendClientMessage(playerid,red," ");
			SendClientMessage(playerid,red," ");
			SendClientMessage(playerid,red," ");
			SendClientMessage(playerid,red," ");
			SendClientMessage(playerid,red," ");
			SendClientMessage(playerid,red," ");
			SendClientMessage(playerid,red," ");
			SendClientMessage(playerid,red," ");
			SendClientMessage(playerid,red," ");
		}
}
    }

	return 1;
}

//<<<<<<<<<<<<<<<<<<<<<(UNUSED FUNCTIONS)<<<<<<<<<<<<<<<<<<<<<<<//

forward clearspam(playerid);
public clearspam(playerid)
{
	SetPVarInt(playerid,"textspam",0);
}

forward JetPack();
public JetPack()
{
	for(new i;i<MAX_PLAYERS;i++)
	{
		if(IsPlayerConnected(i))
	  {
			if(GetPlayerSpecialAction(i) == SPECIAL_ACTION_USEJETPACK)
			{
				new tname[MAX_PLAYER_NAME], string[128];
				GetPlayerName(i, tname, sizeof(tname));
				format(string, sizeof(string), "AC BAN: %s(%d) has been banned for jetpack.",tname,i);
				SendClientMessageToAll(0xAA3333AA, string);
				Ban(i);
			}
		}
  	}
}

forward WeaponCheck();
public WeaponCheck()
{
	new string[128];
	new tname[MAX_PLAYER_NAME];
	for(new j;j<MAX_PLAYERS;j++)
	{
		if(IsPlayerConnected(j) && GetPlayerState(j) == PLAYER_STATE_ONFOOT)
	  {
	    new ttemp = 0;
			for(new i = 0; i < 13; i++)
			{
			  new tweap, tammo;
			  GetPlayerWeaponData(j, i ,tweap ,tammo);
			  format(string,sizeof(string),"wslot%d",i);
			  if(GetPVarInt(j,string) != tweap && tweap != 0)
				{
				  ttemp++;
				}
			}
			if(ttemp != 0)
			{
				SetPVarInt(j,"sww",GetPVarInt(j,"sww")+1);
				if(GetPVarInt(j,"sww") > 2)
				{
			  	GetPlayerName(j,tname,sizeof(tname));
	      		CallRemoteFunction("BanIncrease","d",j);
		        format(string, sizeof(string), "AC BAN: %s has been banned for weapon hacks.", tname);
				SendClientMessageToAll(0xAA3333AA, string);
				Ban(j);
				}
			}
			else if(ttemp == 0)
			{
				SetPVarInt(j,"sww",0);
			}
		}
	}
}

public OnPlayerSpawn(playerid)
{
    SetPlayerInterior(playerid, 0);
    if (!AlreadyGiveWeapons[playerid]) SetTimerEx("LoadWeaponsToFile",250,false,"i",playerid);





    return 1;
}


public OnPlayerDeath(playerid, killerid, reason)
{
	new string[64];
	GivePlayerMoney(playerid, -1000);
	GivePlayerMoney(killerid, 1000);
	format(string, sizeof(string), "KILL: You were killed by %s.", killerid);
	SendClientMessage(playerid, red, string);
	format(string, sizeof(string), "KILL: %s was killed by %s.",playerid,killerid);
	SendClientMessageToAll(red, string);
	if(killerid != INVALID_PLAYER_ID) SetPlayerScore(killerid, GetPlayerScore(killerid) + 1);
	if(playerid != INVALID_PLAYER_ID) SetPlayerScore(playerid, GetPlayerScore(playerid) - 1);
	return 1;
}

public OnVehicleSpawn(vehicleid)
{
	return 1;
}

public OnVehicleDeath(vehicleid, killerid)
{
	return 1;
}



public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
	return 1;
}

public OnPlayerExitVehicle(playerid, vehicleid)
{
	return 1;
}

public OnPlayerStateChange(playerid, newstate, oldstate)
{
	return 1;
}

public OnPlayerEnterCheckpoint(playerid)
{
	return 1;
}

public OnPlayerLeaveCheckpoint(playerid)
{
	return 1;
}

public OnPlayerEnterRaceCheckpoint(playerid)
{
	return 1;
}

public OnPlayerLeaveRaceCheckpoint(playerid)
{
	return 1;
}

public OnRconCommand(cmd[])
{
	return 1;
}

public OnObjectMoved(objectid)
{
	return 1;
}

public OnPlayerObjectMoved(playerid, objectid)
{
	return 1;
}


public OnPlayerPickUpPickup(playerid, pickupid)

{

if(pickupid == mypickup) // Check that the pickup ID of the pickup they picked up is mypickup
    {

        // It is
       SendClientMessage(playerid, 0xFFFFFFFF, "You got the Grove weapons"); // Message the player
	 	GivePlayerWeapon (playerid,24,500);
		GivePlayerWeapon (playerid,26,500);
		GivePlayerWeapon (playerid,29,500);
		GivePlayerWeapon (playerid,34,500); // Give the player the weapons
    }
    // if you need to add more pickups, simply do this:
  //else if (pickupid == (some other pickup))
  // {
        // Another pickup, do something else
   // }
	return 1;
	
}

public OnVehicleMod(playerid, vehicleid, componentid)
{
	return 1;
}

public OnVehiclePaintjob(playerid, vehicleid, paintjobid)
{
	return 1;
}

public OnVehicleRespray(playerid, vehicleid, color1, color2)
{
	return 1;
}

public OnPlayerExitedMenu(playerid)
{
	return 1;
}

public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)
{
	return 1;
}

public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
	return 1;
}

public OnRconLoginAttempt(ip[], password[], success)
{
    if(!success)
    {
        printf("WARNING: Failed RCON Login By IP %s Using Password: %s",ip, password);
        new pip[16];
        for(new i=0; i<MAX_PLAYERS; i++)
        {
            GetPlayerIp(i, pip, sizeof(pip));
            if(!strcmp(ip, pip, true))
            {
                SendClientMessage(i, 0xFFFFFFFF, "SERVER: You were kicked for a failed RCON login.");
                Kick(i);
            }
        }
    }
    return 1;
}

public OnPlayerStreamIn(playerid, forplayerid)
{
	return 1;
}

public OnPlayerStreamOut(playerid, forplayerid)
{
	return 1;
}

public OnVehicleStreamIn(vehicleid, forplayerid)
{
	return 1;
}

public OnVehicleStreamOut(vehicleid, forplayerid)
{
	return 1;
}

public OnPlayerClickPlayer(playerid, clickedplayerid, source)
{
	return 1;
}

SetPlayerTeamFromClass(playerid, classid)
{
  if(classid == 0)
   {
   gTeam[playerid] = TEAM_GANG;
   return 1;
   }
  else if(classid == 1)
  {
  gTeam[playerid] = TEAM_GANG;
  return 1;
  }
  else if(classid == 2)
  {
  gTeam[playerid] = TEAM_GANG;
  return 1;
  }

  else if(classid == 3)
  {
  gTeam[playerid] = TEAM_LSPD;
  return 1;
  }

  else if(classid == 4)
  {
  gTeam[playerid] = TEAM_LSPD;
  return 1;
  }

  else if(classid == 5)
  {
  gTeam[playerid] = TEAM_LSPD;
  return 1;
  }

  return 1;
  }

SetPlayerToTeamColor(playerid)
{
    if (gTeam[playerid] == TEAM_GANG)
    {
        SetPlayerColor(playerid, 0x00D900C8);
    }
    else if (gTeam[playerid] == TEAM_LSPD)
    {
        SetPlayerColor(playerid, 0x2641FEAA);
    }
}

SaveWeaponsToFile(playerid)
{
	new i, path[50], string[128], weaponid, ammo;
    path = GetPlayerFormattedName(playerid);
    if (!dini_Exists(path)) dini_Create(path);
	for (i=0; i<13; i++)
	{
	    GetPlayerWeaponData(playerid,i,weaponid,ammo);
	    format(string,sizeof(string),"Weapon - %d",i);
	    dini_IntSet(path,string,weaponid);
	    format(string,sizeof(string),"AmmoID - %d",i);
	    dini_IntSet(path,string,ammo == 65535 ? 0 : ammo);
	}
}

forward LoadWeaponsToFile(playerid);
public LoadWeaponsToFile(playerid)
{
	new i, path[50], string[128], weaponid, ammo;
    path = GetPlayerFormattedName(playerid);
    ResetPlayerWeapons(playerid);
	for (i=0; i<13; i++)
	{
	    format(string,sizeof(string),"Weapon - %d",i);
	    weaponid = dini_Int(path,string);
	    format(string,sizeof(string),"AmmoID - %d",i);
	    ammo = dini_Int(path,string);
	    GivePlayerWeapon(playerid,weaponid,ammo);
	}
	AlreadyGiveWeapons[playerid] = true;
}

GetPlayerFormattedName(playerid)
{
	new name[24], full[50];
 	GetPlayerName(playerid,name,sizeof(name));
 	format(full,sizeof(full),"%s/%s.txt",PATH,name);
 	return full;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)