SamRossi
Новичок
Так к командам кидаем
Создание зоны:
Удаление зоны:
Сохранение зоны:
В public CheckArmour()
Вырезано из Redux-RP
Создание зоны:
PHP:
if(strcmp(cmd, "/addzona", true) == 0)
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp)) return SCM(playerid, COLOR_GREY, "Используйте: /addzona [ширина от 1 до 500] [высота от 1 до 500]");
new Pos_X = strval(tmp);
if(Pos_X < 1 || Pos_X > 500) return SendClientMessage(playerid, COLOR_GREY, "ширина от 1 до 500!");
tmp = strtok(cmdtext, idx);
if(!strlen(tmp)) return SCM(playerid, COLOR_GREY, "Используйте: /addzona [ширина от 1 до 500] [высота от 1 до 500]");
new Pos_Y = strval(tmp);
if(Pos_Y < 1 || Pos_Y > 500) return SendClientMessage(playerid, COLOR_GREY, "Высота от 1 до 500!");
SetPVarFloat(playerid, "Pos_X", Pos_X),SetPVarFloat(playerid, "Pos_Y", Pos_Y);
CreateZona(playerid);
return true;
}
PHP:
if(strcmp(cmd, "/delzona", true) == 0)
{
if(GetPVarInt(playerid, "PlayerZona") > -1)
{
GangZoneDestroy(GetPVarInt(playerid, "PlayerZona"));
SetPVarInt(playerid, "PlayerZona", -1);
return true;
}
SendClientMessage(playerid, COLOR_GREY, "Вы не создавали зону!!");
return true;
}
PHP:
if(strcmp(cmd, "/createzona", true) == 0)
{
if(GetPVarInt(playerid, "PlayerZona") > -1)
{
SetPVarInt(playerid, "PlayerZona", -1);
CreateZones(playerid);
return true;
}
SendClientMessage(playerid, COLOR_GREY, "Вы не создавали зону!");
return true;
}
В public CheckArmour()
PHP:
CreateZona(playerid) // save zona
{
if(GetPVarInt(playerid, "PlayerZona") > -1) GangZoneDestroy(GetPVarInt(playerid, "PlayerZona"));
new Float: Pos[5], newzona;
GetPlayerPos(playerid,Pos[0],Pos[1],Pos[2]);
Pos[3] = GetPVarFloat(playerid,"Pos_X")+Pos[0], Pos[4] = GetPVarFloat(playerid,"Pos_Y")+Pos[1];
newzona = GangZoneCreate(Pos[0], Pos[1], Pos[3], Pos[4]);
SetPVarInt(playerid, "PlayerZona", newzona);
GangZoneShowForAll(newzona,COLOR_RED);
SetPVarFloat(playerid, "Pos_Xmin", Pos[0]),SetPVarFloat(playerid, "Pos_Ymin", Pos[1]),SetPVarFloat(playerid, "Pos_Xmax", Pos[3]),SetPVarFloat(playerid, "Pos_Ymax", Pos[4]);
}
CreateZones(playerid)
{
new coordsstring[94];
format(coordsstring, sizeof(coordsstring), "(%f,%f,%f,%f),\r\n",GetPVarFloat(playerid, "Pos_Xmin"),GetPVarFloat(playerid, "Pos_Ymin"),GetPVarFloat(playerid, "Pos_Xmax"),GetPVarFloat(playerid, "Pos_Ymax"));
new File: file2 = fopen("gangzones.txt", io_append);
fwrite(file2, coordsstring);
fclose(file2);
}
Вырезано из Redux-RP
