18.02.2014, 20:02
Howdy, This is my first attempt trying to make dynamic gangzones.
So I had all of the coordinates set:
They just do not show at all!
Here is my command:
None of them work.
So I had all of the coordinates set:
They just do not show at all!
Here is my command:
pawn Код:
CMD:turfedit(playerid, params[])
{
if(pInfo[playerid][pAdmin] >= 4)
{
new String[128], Option[32], TurfID,Query[128];
if(sscanf(params, "ds[32]",TurfID, Option))
{
SendClientMessage(playerid, COLOR_GREY, "Usage: /turfedit [Turf ID] [Option]");
SendClientMessage(playerid, COLOR_GREY, "Options: North, South, East, West");
}
else
{
if(strcmp(Option, "north", true) == 0)
{
new Float:X, Float:Y, Float: Z;
GetPlayerPos(playerid, X,Y,Z);
TurfData[TurfID][North] = Y;
format(Query, sizeof(Query), "UPDATE GangZone SET North=%f", Y);
mysql_query(Query);
GangZoneDestroy(TurfData[TurfID][tTurfID]);
TurfData[TurfID][tTurfID] = GangZoneCreate(TurfData[TurfID][West], TurfData[TurfID][South], TurfData[TurfID][East], TurfData[TurfID][North]);
switch(TurfData[TurfID][TurfColor])
{
case 0: GangZoneShowForAll(TurfData[TurfID][tTurfID], COLOR_WHITE), SendClientMessage(playerid, COLOR_WHITE, "White");
case 1: GangZoneShowForAll(TurfData[TurfID][tTurfID], COLOR_BLUE);
case 2: GangZoneShowForAll(TurfData[TurfID][tTurfID], COLOR_GREEN);
case 3: GangZoneShowForAll(TurfData[TurfID][tTurfID], COLOR_YELLOW);
case 4: GangZoneShowForAll(TurfData[TurfID][tTurfID], COLOR_ORANGE);
case 5: GangZoneShowForAll(TurfData[TurfID][tTurfID], COLOR_PURPLE);
case 6: GangZoneShowForAll(TurfData[TurfID][tTurfID], COLOR_RED);
}
format(String, sizeof String," GangZone location %d updated to North: %f South: %f, East: %f, West: %f",TurfID, TurfData[TurfID][North], TurfData[TurfID][South], TurfData[TurfID][East], TurfData[TurfID][West]);
SendClientMessage(playerid, COLOR_GREY, String);
}
if(strcmp(Option, "south", true) == 0)
{
new Float:X, Float:Y, Float: Z;
GetPlayerPos(playerid, X,Y,Z);
TurfData[TurfID][South] = Y;
format(Query, sizeof(Query), "UPDATE GangZone SET South=%f", Y);
mysql_query(Query);
GangZoneDestroy(TurfData[TurfID][tTurfID]);
TurfData[TurfID][tTurfID] = GangZoneCreate(TurfData[TurfID][West], TurfData[TurfID][South], TurfData[TurfID][East], TurfData[TurfID][North]);
switch(TurfData[TurfID][TurfColor])
{
case 0: GangZoneShowForAll(TurfData[TurfID][tTurfID], COLOR_WHITE);
case 1: GangZoneShowForAll(TurfData[TurfID][tTurfID], COLOR_BLUE);
case 2: GangZoneShowForAll(TurfData[TurfID][tTurfID], COLOR_GREEN);
case 3: GangZoneShowForAll(TurfData[TurfID][tTurfID], COLOR_YELLOW);
case 4: GangZoneShowForAll(TurfData[TurfID][tTurfID], COLOR_ORANGE);
case 5: GangZoneShowForAll(TurfData[TurfID][tTurfID], COLOR_PURPLE);
case 6: GangZoneShowForAll(TurfData[TurfID][tTurfID], COLOR_RED);
}
format(String, sizeof String," GangZone location %d updated to North: %f South: %f, East: %f, West: %f",TurfID, TurfData[TurfID][North], TurfData[TurfID][South], TurfData[TurfID][East], TurfData[TurfID][West]);
SendClientMessage(playerid, COLOR_GREY, String);
}
if(strcmp(Option, "east", true) == 0)
{
new Float:X, Float:Y, Float: Z;
GetPlayerPos(playerid, X,Y,Z);
TurfData[TurfID][East] = Y;
format(Query, sizeof(Query), "UPDATE GangZone SET East=%f", Y);
mysql_query(Query);
GangZoneDestroy(TurfData[TurfID][tTurfID]);
TurfData[TurfID][tTurfID] = GangZoneCreate(TurfData[TurfID][West], TurfData[TurfID][South], TurfData[TurfID][East], TurfData[TurfID][North]);
switch(TurfData[TurfID][TurfColor])
{
case 0: GangZoneShowForAll(TurfData[TurfID][tTurfID], COLOR_WHITE);
case 1: GangZoneShowForAll(TurfData[TurfID][tTurfID], COLOR_BLUE);
case 2: GangZoneShowForAll(TurfData[TurfID][tTurfID], COLOR_GREEN);
case 3: GangZoneShowForAll(TurfData[TurfID][tTurfID], COLOR_YELLOW);
case 4: GangZoneShowForAll(TurfData[TurfID][tTurfID], COLOR_ORANGE);
case 5: GangZoneShowForAll(TurfData[TurfID][tTurfID], COLOR_PURPLE);
case 6: GangZoneShowForAll(TurfData[TurfID][tTurfID], COLOR_RED);
}
format(String, sizeof String," GangZone location %d updated to North: %f South: %f, East: %f, West: %f",TurfID, TurfData[TurfID][North], TurfData[TurfID][South], TurfData[TurfID][East], TurfData[TurfID][West]);
SendClientMessage(playerid, COLOR_GREY, String);
}
if(strcmp(Option, "west", true) == 0)
{
new Float:X, Float:Y, Float: Z;
GetPlayerPos(playerid, X,Y,Z);
TurfData[TurfID][East] = Y;
format(Query, sizeof(Query), "UPDATE GangZone SET West=%f", Y);
mysql_query(Query);
GangZoneDestroy(TurfData[TurfID][tTurfID]);
TurfData[TurfID][tTurfID] = GangZoneCreate(TurfData[TurfID][West], TurfData[TurfID][South], TurfData[TurfID][East], TurfData[TurfID][North]);
format(String, sizeof String," GangZone location %d updated to North: %f South: %f, East: %f, West: %f",TurfID, TurfData[TurfID][North], TurfData[TurfID][South], TurfData[TurfID][East], TurfData[TurfID][West]);
SendClientMessage(playerid, COLOR_GREY, String);
switch(TurfData[TurfID][TurfColor])
{
case 0: GangZoneShowForAll(TurfData[TurfID][tTurfID], COLOR_WHITE);
case 1: GangZoneShowForAll(TurfData[TurfID][tTurfID], COLOR_BLUE);
case 2: GangZoneShowForAll(TurfData[TurfID][tTurfID], COLOR_GREEN);
case 3: GangZoneShowForAll(TurfData[TurfID][tTurfID], COLOR_YELLOW);
case 4: GangZoneShowForAll(TurfData[TurfID][tTurfID], COLOR_ORANGE);
case 5: GangZoneShowForAll(TurfData[TurfID][tTurfID], COLOR_PURPLE);
case 6: GangZoneShowForAll(TurfData[TurfID][tTurfID], COLOR_RED);
}
}
}
}
else
{
Bad_Rank(playerid, COLOR_GREY);
}
return 1;
}
None of them work.