15.01.2012, 03:21
I spent quite some time fixing up your code and understanding your problem.
You should read everything documented in http://wiki.sa-mp.com.
Rep
pawn Код:
// This is a comment
// uncomment the line below if you want to write a filterscript
//#define FILTERSCRIPT
#include <a_samp>
main()
{
print("\n----------------------------------");
print(" MoustahSsen BlacKxOps");
print("----------------------------------\n");
}
#include <dini>
#include <dudb>
#include <foreach>
#pragma unused ret_memcpy
#define MAX_TEAMS 7
#define TEAM_Latino 1
#define TEAM_Souviet 2
#define TEAM_Arabian 3
#define TEAM_USA 4
#define TEAM_Europian 5
#define TEAM_Japan 6
#define TEAM_Taliban 7
#define TEAM_Latino_COLOR 0x00F3FFAF
#define TEAM_Souviet_COLOR 0xCA0000FF
#define TEAM_Arabian_COLOR 0xD70000FF
#define TEAM_USA_COLOR 0x1400C3FF
#define TEAM_Europian_COLOR 0x005E0089
#define TEAM_Japan_COLOR 0xFAFAFFFF
#define TEAM_Taliban_COLOR 0xFFFFFFFF
new TeamNames[][] = {
{ "Latino" },
{ "Souviet" },
{ "Arabian" },
{ "USA" },
{ "Europian" },
{ "Japan" },
{ "Taliban" }
};
forward AreaCheck();
forward TakeOver(playerid);
new gTeam[MAX_PLAYERS];
new EnteredArea[MAX_PLAYERS]=-1;
new Captured;
new Score[MAX_TEAMS];
new T1[MAX_PLAYERS];
new A;
new AU;
new AG;
public OnGameModeInit()
{
UsePlayerPedAnims();
AddPlayerClass(108,1091.8289,1892.5746,10.8203,181.3648,0,0,0,0,0,0); //Latino (0)
AddPlayerClass(206,1544.0514,-1675.7766,13.5577,98.0974,0,0,0,0,0,0); //Souviet (1)
AddPlayerClass(179,1544.0514,-1675.7766,13.5577,98.0974,0,0,0,0,0,0); //Arabian(2)
AddPlayerClass(287,1544.0514,-1675.7766,13.5577,98.0974,0,0,0,0,0,0); //USA (3)
AddPlayerClass(285,-148.1873,1142.0114,19.7422,16.0408,0,0,0,0,0,0); //Europian(4)
AddPlayerClass(188,1544.0514,-1675.7766,13.5577,98.0974,0,0,0,0,0,0); //Japan (5).
AddPlayerClass(163,1544.0514,-1675.7766,13.5577,98.0974,0,0,0,0,0,0); //Taliban(6)
SetGameModeText("Blank Script");
SetTimer("CheckArea",1000,true);
return 1;
}
public OnGameModeExit()
{
return 1;
}
public OnPlayerRequestClass(playerid, classid)
{
SetPlayerPos(playerid,1984.4445,157.9501,55.9384);
SetPlayerCameraPos(playerid,1984.4445,160.9501,55.9384);
SetPlayerCameraLookAt(playerid,1984.4445,157.9501, 55.9384);
SetPlayerTeamFromClass(playerid, classid);
return 1;
}
public OnPlayerConnect(playerid)
{
EnteredArea[playerid]=-1;
return 1;
}
public OnPlayerDisconnect(playerid, reason)
{
KillTimer(T1[playerid]);
EnteredArea[playerid]=-1;
return 1;
}
public OnPlayerSpawn(playerid)
{
SetPlayerToTeamColor(playerid);
return 1;
}
SetPlayerTeamFromClass(playerid, classid)
{
gTeam[playerid] = classid+1;
}
SetPlayerToTeamColor(playerid)
{
if (gTeam[playerid] == TEAM_Latino)
{
SetPlayerColor(playerid, TEAM_Latino_COLOR);
}
else if (gTeam[playerid] == TEAM_Souviet)
{
SetPlayerColor(playerid, TEAM_Souviet_COLOR);
}
else if (gTeam[playerid] == TEAM_Arabian)
{
SetPlayerColor(playerid, TEAM_Arabian_COLOR);
}
else if (gTeam[playerid] == TEAM_USA)
{
SetPlayerColor(playerid, TEAM_USA_COLOR);
}
else if (gTeam[playerid] == TEAM_Europian)
{
SetPlayerColor(playerid, TEAM_Europian_COLOR);
}
else if (gTeam[playerid] == TEAM_Japan)
{
SetPlayerColor(playerid, TEAM_Japan_COLOR);
}
else if (gTeam[playerid] == TEAM_Taliban)
{
SetPlayerColor(playerid, TEAM_Taliban_COLOR);
}
return 1;
}
public OnPlayerDeath(playerid, killerid, reason)
{
return 1;
}
public OnVehicleSpawn(vehicleid)
{
return 1;
}
public OnVehicleDeath(vehicleid, killerid)
{
return 1;
}
public OnPlayerText(playerid, text[])
{
return 1;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp("/mycommand", cmdtext, true, 10) == 0)
{
// Do something here
return 1;
}
return 0;
}
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 OnPlayerRequestSpawn(playerid)
{
return 1;
}
public OnObjectMoved(objectid)
{
return 1;
}
public OnPlayerObjectMoved(playerid, objectid)
{
return 1;
}
public OnPlayerPickUpPickup(playerid, pickupid)
{
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 OnPlayerSelectedMenuRow(playerid, row)
{
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)
{
return 1;
}
public OnPlayerUpdate(playerid)
{
return 1;
}
stock IsPlayerInArea(playerid,Float:min_x,Float:min_y,Float:max_x,Float:max_y)
{
new Float:X,Float:Y,Float:Z;
GetPlayerPos(playerid, X, Y, Z);
if((X <= max_x && X >= min_x) && (Y <= max_y && Y >= min_y)) return 1;
return 0;
}
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 OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
return 1;
}
public OnPlayerClickPlayer(playerid, clickedplayerid, source)
{
return 1;
}
public AreaCheck()
{
foreach(Player, i)
{
if(IsPlayerInArea(i, 105.1009, 1775.037, 373.692, 1950.205))
{
if(EnteredArea[i] != 5)
{
if(Captured == gTeam[i])
{
SendClientMessage(i,0x23FF00FF, "This area has already been captured by your team!");
EnteredArea[i] = 5;
}
else
{
KillTimer(T1[i]);
EnteredArea[i] = 5;
SendClientMessage(i,0x23FF00FF, "Stay In here for 30 seconds to take over the area!");
T1[i] = SetTimerEx("TakeOver",30000,false,"i",i);
SendClientMessageToAll(0x23FF00FF, "Area 69 is being taken over!");
}
}
else
{
EnteredArea[i] = 0;
KillTimer(T1[i]);
}
}
}
return 1;
}
public TakeOver(playerid)
{
new string[128],string2[64];
if(EnteredArea[playerid] == 5)
{
if(Captured == gTeam[playerid]) return 1;
SetPlayerScore(playerid,GetPlayerScore(playerid)+2);
Score[gTeam[playerid]-1]++;
format(string,sizeof(string),"NEWS: Team %s has captured area 69!",TeamNames[gTeam[playerid]-1]);
SendClientMessageToAll(0xEBFF00FF,string);
format(string2,sizeof(string2),"gTeam%dScore",gTeam[playerid]);
dini_IntSet("/Variables/Variables.ini",string,Score[gTeam[playerid]-1]);
GangZoneHideForAll(A);
GangZoneShowForAll(AU, 0xFF00C3FF);
GangZoneHideForAll(AG);
Captured = gTeam[playerid];
}
return 1;
}
Rep