SA-MP Forums Archive
Help with fremove - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Help with fremove (/showthread.php?tid=548241)



Help with fremove - ilepopivanov - 28.11.2014

I made xmas tree system and when I type /izbrisielka(deletexmas) [ID] file is delete but when I click 'Y' gives me some money and create again xmas tree O.o

Код:
CMD:izbrisielka(playerid, params[])//deletexmastree
{
	if(PlayerInfo[playerid][pAdmin] >= 2014)
	{
		new id, elka[999];
		if(sscanf(params, "i",id))  return SendClientMessage(playerid,-1, "{00EAEA}KORISTI:{FF5300}/izbrisielka [ID]");
		format(elka, sizeof(elka), ELKA_FILE, id);
		if(fexist(elka))
		{
  		DestroyDynamicObject(Elka[id]);
		DestroyDynamicObject(Po1[id]);
	    DestroyDynamicObject(Po2[id]);
	    DestroyDynamicObject(Po3[id]);
		DestroyDynamicObject(Po4[id]);
	  	DestroyDynamicObject(Po5[id]);
	  	DestroyDynamicObject(Po6[id]);
		DestroyDynamicObject(Po7[id]);
	  	DestroyDynamicObject(Po8[id]);
	  	Delete3DTextLabel(E3D[id]);
		fremove(elka);
		}
		else
		{
			SendClientMessage(playerid,-1,"{00FFFF}(DWIG){FF5300} Ne postoi elka so toj ID!");
		}
	}
	return 1;
}
Код:
CMD:napravielka(playerid, params[])
{
	if(PlayerInfo[playerid][pAdmin] >= 2014)
	{
	new id,Float:eX,Float:eY,Float:eZ;
	new vopoklon = 9999 + random(30000);
	GetPlayerPos(playerid, eX, eY, eZ);
	if(sscanf(params, "i",id))  return SendClientMessage(playerid,-1, "{00EAEA}KORISTI:{FF5300}/napravielka [ID]");
	ElkaInfo[id][eID] = id;
	ElkaInfo[id][EX] = eX;
	ElkaInfo[id][EY] = eY;
	ElkaInfo[id][EZ] = eZ-1.0;
 	ElkaInfo[id][P1] = eZ-0.4;
	ElkaInfo[id][P2] = eZ-0.4;
	ElkaInfo[id][P3] = eZ-0.4;
  	ElkaInfo[id][P4] = eZ-0.4;
	ElkaInfo[id][P5] = eZ-1.0;
	ElkaInfo[id][P6] = eZ-1.0;
  	ElkaInfo[id][P7] = eZ-1.0;
	ElkaInfo[id][P8] = eZ-1.0;
	ElkaInfo[id][ePoklon] = vopoklon;
	ElkaInfo[id][eZemenPoklon] = 1;
 	E3D[id]=    CreateDynamic3DTextLabel("Stisnete 'Y' za da go zemete poklonot", 0xFF8040FF, ElkaInfo[id][EX],ElkaInfo[id][EY],ElkaInfo[id][EZ], 25.0, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 0, -1, -1, -1, 8.0);
	Elka[id] =  CreateDynamicObject(19076, eX, eY, eZ-1.0, 0.0000, 0.0000, 0.0000);
	Po1[id] =   CreateDynamicObject(19054, eX, eY+1.0, eZ-0.4,0,0,300);
	Po2[id] = 	CreateDynamicObject(19058, eX+1.0, eY, eZ-0.4,0,0,300);
	Po3[id] = 	CreateDynamicObject(19056, eX, eY-1.0, eZ-0.4,0,0,300);
	Po4[id] = 	CreateDynamicObject(19057, eX-1.0, eY, eZ-0.4,0,0,300);
	Po5[id] = 	CreateDynamicObject(19058, eX-1.5, eY+1.5, eZ-1.0,0,0,300);
	Po6[id] = 	CreateDynamicObject(19055, eX+1.5, eY-1.5, eZ-1.0,0,0,300);
	Po7[id] = 	CreateDynamicObject(19057, eX+1.5, eY+1.5, eZ-1.0,0,0,300);
	Po8[id] = 	CreateDynamicObject(19054, eX-1.5, eY-1.5, eZ-1.0,0,0,300);
	SetPlayerPos(playerid, eX+1.5, eY+1.5, eZ+0.5);
	ZacuvajElka(id);
	}
	return 1;
}
Код:
if(newkeys == KEY_YES)
	 {
                for(new i; i < MAX_ELKI; i++)
		{
			if(IsPlayerInRangeOfPoint(playerid, 6.0, ElkaInfo[i][EX], ElkaInfo[i][EY], ElkaInfo[i][EZ]))
			{
				if(ElkaInfo[i][eZemenPoklon] == 1)
				{
			 		GivePlayerMoney(playerid,ElkaInfo[i][ePoklon]);
					ElkaInfo[i][eZemenPoklon] = 0;
					ZacuvajElka(i);
					SCMF(playerid,CRVENA, "{00FFFF}(DWIG){FF5300}Dobivte %d$ od poklonot,so srekja!",ElkaInfo[i][ePoklon]);
				}
				else return SendClientMessage(playerid,CRVENA, "{00FFFF}(DWIG){FF5300}Vekje poklonot e otvoren");
			}
		}
	}



Re: Help with fremove - Misiur - 28.11.2014

Could you show me ZacuvajElka?

(Is this Czech language? It sounds cute to me as a Pole)


Re: Help with fremove - ilepopivanov - 28.11.2014

Quote:
Originally Posted by Misiur
Посмотреть сообщение
Could you show me ZacuvajElka?

(Is this Czech language? It sounds cute to me as a Pole)
Код:
stock ZacuvajElka(idelka)
{
	new eFile[128];
    format(eFile, sizeof(eFile), ELKA_FILE, idelka);
	new INI:File = INI_Open(eFile);
	INI_WriteInt(File,"IDElka",ElkaInfo[idelka][eID]);
	INI_WriteFloat(File,"EX",ElkaInfo[idelka][EX]);
	INI_WriteFloat(File,"EY",ElkaInfo[idelka][EY]);
	INI_WriteFloat(File,"EZ",ElkaInfo[idelka][EZ]);
 	INI_WriteFloat(File,"P1",ElkaInfo[idelka][P1]);
	INI_WriteFloat(File,"P2",ElkaInfo[idelka][P2]);
	INI_WriteFloat(File,"P3",ElkaInfo[idelka][P3]);
  	INI_WriteFloat(File,"P4",ElkaInfo[idelka][P4]);
	INI_WriteFloat(File,"P5",ElkaInfo[idelka][P5]);
	INI_WriteFloat(File,"P6",ElkaInfo[idelka][P6]);
 	INI_WriteFloat(File,"P7",ElkaInfo[idelka][P7]);
	INI_WriteFloat(File,"P8",ElkaInfo[idelka][P8]);
    INI_WriteInt(File,"Poklon",ElkaInfo[idelka][ePoklon]);
	INI_WriteInt(File,"ZemenPoklon",ElkaInfo[idelka][eZemenPoklon]);
	INI_Close(File);
	return 1;
}