Код:
#define MAX_TURFS 40
#define TWADMINMENU 4050
#define TWEDITTURFSSELECTION 4051
#define TWEDITTURFSMENU 4052
#define TWEDITFCOLORSSELECTION 4053
#define TWEDITFCOLORSMENU 4054
#define TWEDITTURFSOWNER 4055
#define TWEDITTURFSLOCKED 4056
#define TWEDITTURFSVUL 4057
#define TWEDITTURFSPERKS 4058
TurfWarsAdminMenu(playerid)
{
new string[128];
format(string,sizeof(string),"Edit Turfs...\nEdit Family Colors...");
ShowPlayerDialog(playerid,TWADMINMENU,DIALOG_STYLE_LIST,"Turf Wars - Admin Menu:",string,"Select","Exit");
}
TurfWarsEditTurfsSelection(playerid)
{
new string[2048];
for(new i = 0; i < MAX_TURFS; i++)
{
if(TurfWars[i][twOwnerId] != -1)
{
if(TurfWars[i][twOwnerId] < 0 || TurfWars[i][twOwnerId] > MAX_FAMILY-1)
{
format(string,sizeof(string),"%s%s - \t(Invalid Family)\n",string,TurfWars[i][twName]);
}
else
{
format(string,sizeof(string),"%s%s - \t(%s)\n",string,TurfWars[i][twName],FamilyInfo[TurfWars[i][twOwnerId]][FamilyName]);
}
}
else
{
format(string,sizeof(string),"%s%s - \t(%s)\n",string,TurfWars[i][twName],"Vacant");
}
}
ShowPlayerDialog(playerid,TWEDITTURFSSELECTION,DIALOG_STYLE_LIST,"Turf Wars - Edit Turfs Selection Menu:",string,"Select","Back");
}
TurfWarsEditTurfsMenu(playerid)
{
new string[128];
format(string,sizeof(string),"Edit Dimensions...\nEdit Owners...\nEdit Vulnerable Time...\nEdit Locked...\nEdit Perks...\nReset War...\nDestroy Turf");
ShowPlayerDialog(playerid,TWEDITTURFSMENU,DIALOG_STYLE_LIST,"Turf Wars - Edit Turfs Menu:",string,"Select","Back");
}
TurfWarsEditTurfsOwner(playerid)
{
new string[128];
format(string,sizeof(string),"Please enter a family id that you wish to assign to this turf:\n\nHint: Enter -1 if you wish to vacant the turf.");
ShowPlayerDialog(playerid,TWEDITTURFSOWNER,DIALOG_STYLE_INPUT,"Turf Wars - Edit Turfs Owner Menu:",string,"Change","Back");
}
TurfWarsEditTurfsVul(playerid)
{
new string[128];
format(string,sizeof(string),"Please enter a Vulnerable countdown time for the turf:");
ShowPlayerDialog(playerid,TWEDITTURFSVUL,DIALOG_STYLE_INPUT,"Turf Wars - Edit Turfs Vulnerable Menu:",string,"Change","Back");
}
TurfWarsEditTurfsLocked(playerid)
{
new string[128];
format(string,sizeof(string),"Lock\nUnlock");
ShowPlayerDialog(playerid,TWEDITTURFSLOCKED,DIALOG_STYLE_LIST,"Turf Wars - Edit Turfs Locked Menu:",string,"Change","Back");
}
TurfWarsEditTurfsPerks(playerid)
{
new string[128];
format(string,sizeof(string),"None\nExtortion");
ShowPlayerDialog(playerid,TWEDITTURFSPERKS,DIALOG_STYLE_LIST,"Turf Wars - Edit Turfs Perks Menu:",string,"Change","Back");
}
CMD:twmenu(playerid, params[])
{
if(PlayerInfo[playerid][pAdmin] > 3 || PlayerInfo[playerid][pGangModerator] == 1)
{
TurfWarsAdminMenu(playerid);
}
else
{
SendClientMessageEx(playerid, COLOR_GRAD2, "You are not authorized to use this command!");
}
return 1;
}
CMD:turfinfo(playerid, params[])
{
if(GetPlayerTurfWarsZone(playerid) != -1) {
new string[128];
new tw = GetPlayerTurfWarsZone(playerid);
format(string,sizeof(string),"|___________ (ID: %d) %s ___________|",tw,TurfWars[tw][twName]);
SendClientMessageEx(playerid, COLOR_GREEN, string);
if(TurfWars[tw][twOwnerId] != -1) {
format(string,sizeof(string),"Owner: %s.",FamilyInfo[TurfWars[tw][twOwnerId]][FamilyName]);
}
else {
format(string,sizeof(string),"Owner: Vacant.");
}
SendClientMessageEx(playerid, COLOR_WHITE, string);
format(string,sizeof(string),"Vulnerable: %d Hours.",TurfWars[tw][twVulnerable]);
SendClientMessageEx(playerid, COLOR_WHITE, string);
format(string,sizeof(string),"Locked: %d.",TurfWars[tw][twLocked]);
SendClientMessageEx(playerid, COLOR_WHITE, string);
format(string,sizeof(string),"Active: %d.",TurfWars[tw][twActive]);
SendClientMessageEx(playerid, COLOR_WHITE, string);
if(TurfWars[tw][twActive] != 0) {
format(string,sizeof(string),"Time Left: %d Secs.",TurfWars[tw][twTimeLeft]);
SendClientMessageEx(playerid, COLOR_WHITE, string);
if(TurfWars[tw][twAttemptId] == -1) {
format(string,sizeof(string),"Takeover Faction: Law Enforcement.");
SendClientMessageEx(playerid, COLOR_WHITE, string);
}
else {
format(string,sizeof(string),"Takeover Family: %s.",FamilyInfo[TurfWars[tw][twAttemptId]][FamilyName]);
SendClientMessageEx(playerid, COLOR_WHITE, string);
}
}
switch(TurfWars[tw][twSpecial]) {
case 1:
{
format(string,sizeof(string),"Special Perks: Extortion.");
}
default:
{
format(string,sizeof(string),"Special Perks: None.");
}
}
SendClientMessageEx(playerid, COLOR_WHITE, string);
}
else {
SendClientMessageEx(playerid, COLOR_WHITE, "You are not in a turf!");
}
return 1;
}
CMD:claim(playerid, params[])
{
new string[128];
new tw = GetPlayerTurfWarsZone(playerid);
new family = PlayerInfo[playerid][pFMember];
new rank = PlayerInfo[playerid][pRank];
if(family == 255) {
SendClientMessageEx(playerid, COLOR_GRAD2, "You are not in a family/gang, you can not claim turfs!");
return 1;
}
if(rank < 5) {
SendClientMessageEx(playerid, COLOR_GRAD2, "You have to be at least Rank 5 to claim turfs!");
return 1;
}
if(FamilyInfo[family][FamilyTurfTokens] < 12) {
SendClientMessageEx(playerid, COLOR_GRAD2, "Your family/gang does not have any turf claim tokens, please wait at least 12 hours.");
return 1;
}
if(tw != -1) {
if(TurfWars[tw][twLocked] == 1) {
SendClientMessageEx(playerid, COLOR_GRAD2, "The turf is currently locked by a admin, you can not claim it!");
return 1;
}
if(TurfWars[tw][twVulnerable] == 0) {
if(TurfWars[tw][twActive] == 0) {
if(TurfWars[tw][twOwnerId] == family) {
SendClientMessageEx(playerid, COLOR_GRAD2, "Your family/gang already owns this turf, you are unable to claim it!");
return 1;
}
new count = 0;
foreach(Player, i) {
if(family == PlayerInfo[i][pFMember]) {
if(GetPlayerTurfWarsZone(i) == tw) {
count++;
}
}
}
if(count > 2) {
FamilyInfo[family][FamilyTurfTokens] -= 12;
TakeoverTurfWarsZone(family, tw);
}
else {
SendClientMessageEx(playerid, COLOR_GRAD2, "You need at least 3 of your family/gang members on the turf, to be able to claim it!");
}
}
else {
new count = 0;
new leocount = 0;
if(TurfWars[tw][twAttemptId] == family) {
SendClientMessageEx(playerid, COLOR_GRAD2, "You are already attempting to capture this turf!");
return 1;
}
foreach(Player, i) {
if(TurfWars[tw][twAttemptId] == PlayerInfo[i][pFMember]) {
if(GetPlayerTurfWarsZone(i) == tw) {
count++;
}
}
if(TurfWars[tw][twAttemptId] == -1) {
if(IsACop(i)) {
if(GetPlayerTurfWarsZone(i) == tw) {
leocount++;
}
}
}
}
if(count == 0 && leocount == 0) {
if(family != TurfWars[tw][twOwnerId]) {
FamilyInfo[family][FamilyTurfTokens] -= 12;
}
foreach(Player, i) {
if(PlayerInfo[i][pGangModerator] == 1) {
format(string,sizeof(string),"%s has attempted to takeover turf %d for family %s",GetPlayerNameEx(playerid),tw,FamilyInfo[family][FamilyName]);
SendClientMessageEx(i,COLOR_YELLOW,string);
}
}
TakeoverTurfWarsZone(family, tw);
}
else {
if(leocount == 0) {
format(string,sizeof(string),"There is still %d Attacking Members on the Turf, you must get rid of them before reclaiming!",count);
SendClientMessageEx(playerid, COLOR_GRAD2, string);
}
else {
format(string,sizeof(string),"There is still %d Officers on the Turf, you must get rid of them before reclaiming!",leocount);
SendClientMessageEx(playerid, COLOR_GRAD2, string);
}
}
}
}
else {
SendClientMessageEx(playerid, COLOR_GRAD2, "This turf is currently not vulnerable, you are unable to claim it!");
}
}
else {
SendClientMessageEx(playerid, COLOR_GRAD2, "You have to be in a turf to be able to claim turfs!");
}
if(turfWarsRadar[playerid] == 0) {
ShowTurfWarsRadar(playerid);
}
return 1;
}
//================================================================
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid == TWADMINMENU) // Turf Wars System
{
if(response == 1)
{
switch(listitem)
{
case 0:
{
TurfWarsEditTurfsSelection(playerid);
}
case 1:
{
TurfWarsEditFColorsSelection(playerid);
}
}
}
}
if(dialogid == TWEDITTURFSSELECTION)
{
if(response == 1)
{
for(new i = 0; i < MAX_TURFS; i++)
{
if(listitem == i)
{
SetPVarInt(playerid, "EditingTurfs", i);
TurfWarsEditTurfsMenu(playerid);
}
}
}
else
{
TurfWarsAdminMenu(playerid);
}
}
if(dialogid == TWEDITTURFSMENU)
{
if(response == 1)
{
new tw = GetPVarInt(playerid, "EditingTurfs");
switch(listitem)
{
case 0: // Edit Dim
{
SetPVarInt(playerid, "EditingTurfsStage", 1);
SendClientMessageEx(playerid, COLOR_WHITE, "Goto a location and type (/savetwpos) to edit the West Wall.");
}
case 1: // Edit Owner
{
TurfWarsEditTurfsOwner(playerid);
}
case 2: // Edit Vulnerablity
{
TurfWarsEditTurfsVul(playerid);
}
case 3: // Edit Locks
{
TurfWarsEditTurfsLocked(playerid);
}
case 4: // Edit Perks
{
TurfWarsEditTurfsPerks(playerid);
}
case 5: // Reset War
{
ResetTurfWarsZone(1, tw);
TurfWarsEditTurfsSelection(playerid);
}
case 6: // Destroy Turf
{
DestroyTurfWarsZone(tw);
TurfWarsEditTurfsSelection(playerid);
}
}
}
else
{
TurfWarsEditTurfsSelection(playerid);
}
}
if(dialogid == TWEDITTURFSOWNER)
{
if(response == 1)
{
new tw = GetPVarInt(playerid, "EditingTurfs");
if(IsNull(inputtext))
{
TurfWarsEditTurfsOwner(playerid);
return 1;
}
if(strval(inputtext) < -1 || strval(inputtext) > MAX_FAMILY-1)
{
TurfWarsEditTurfsOwner(playerid);
return 1;
}
SetOwnerTurfWarsZone(1, tw, strval(inputtext));
SaveTurfWars();
TurfWarsEditTurfsMenu(playerid);
}
else
{
TurfWarsEditTurfsMenu(playerid);
}
}
if(dialogid == TWEDITTURFSVUL)
{
if(response == 1)
{
new tw = GetPVarInt(playerid, "EditingTurfs");
if(IsNull(inputtext))
{
TurfWarsEditTurfsVul(playerid);
return 1;
}
if(strval(inputtext) < 0)
{
TurfWarsEditTurfsVul(playerid);
return 1;
}
TurfWars[tw][twVulnerable] = strval(inputtext);
SaveTurfWars();
TurfWarsEditTurfsMenu(playerid);
}
else
{
TurfWarsEditTurfsMenu(playerid);
}
}
if(dialogid == TWEDITTURFSLOCKED)
{
if(response == 1)
{
new tw = GetPVarInt(playerid, "EditingTurfs");
switch(listitem)
{
case 0: // Lock
{
TurfWars[tw][twLocked] = 1;
SaveTurfWars();
TurfWarsEditTurfsMenu(playerid);
}
case 1: // Unlock
{
TurfWars[tw][twLocked] = 0;
SaveTurfWars();
TurfWarsEditTurfsMenu(playerid);
}
}
}
else
{
TurfWarsEditTurfsMenu(playerid);
}
}
if(dialogid == TWEDITTURFSPERKS)
{
if(response == 1)
{
new tw = GetPVarInt(playerid, "EditingTurfs");
TurfWars[tw][twSpecial] = listitem;
SaveTurfWars();
TurfWarsEditTurfsMenu(playerid);
}
else
{
TurfWarsEditTurfsMenu(playerid);
}
}
if(dialogid == TWEDITFCOLORSSELECTION)
{
if(response == 1)
{
for(new i = 0; i < MAX_FAMILY; i++)
{
if(listitem == i)
{
SetPVarInt(playerid, "EditingFamC", i);
TurfWarsEditFColorsMenu(playerid);
}
}
}
else
{
TurfWarsAdminMenu(playerid);
}
}
if(dialogid == TWEDITFCOLORSMENU)
{
if(response == 1)
{
new fam = GetPVarInt(playerid, "EditingFamC");
if(IsNull(inputtext))
{
TurfWarsEditFColorsMenu(playerid);
return 1;
}
if(strval(inputtext) < 0 || strval(inputtext) > 15)
{
TurfWarsEditFColorsMenu(playerid);
return 1;
}
FamilyInfo[fam][FamilyColor] = strval(inputtext);
SaveFamilies();
TurfWarsEditFColorsSelection(playerid);
SyncTurfWarsRadarToAll();
}
else
{
TurfWarsEditFColorsSelection(playerid);
}
}
// Timer Name: TurfWarsUpdate()
// TickRate: 1 secs.
Timer:TurfWarsUpdate[1000]()
{
for(new i = 0; i < MAX_TURFS; i++)
{
if(TurfWars[i][twActive] == 1)
{
if(TurfWars[i][twTimeLeft] > 0)
{
TurfWars[i][twTimeLeft]--;
}
else
{
if(TurfWars[i][twAttemptId] != -1)
{
CaptureTurfWarsZone(TurfWars[i][twAttemptId],i);
}
TurfWars[i][twActive] = 0;
foreach(Player, x)
{
if(turfWarsMiniMap[x] == 1)
{
turfWarsMiniMap[x] = 0;
SetPlayerToTeamColor(x);
}
}
}
}
}
}
I copied this from another script and want to add the turf system to mine, how could I fix these errors? I just need help :S
You must include <a_samp>. Actually, the functions format(), and ShowPlayerDialog() are not defined.