[POMOC]Gde mi e greska ?

Započeo Harris11, Februar 15, 2014, 21:38:18 POSLE PODNE

prethodna tema - sledeća tema

0 članova i 1 gost pregledaju ovu temu.

// This is a comment
// uncomment the line below if you want to write a filterscript
//#define FILTERSCRIPT

#include <a_samp>
#include <a_samp>
#include <core>
#include <float>
#include <time>
#include <file>
#include <zcmd>
#include <sscanf2>
#include <Dini>
#include <streamer>
#include <utils>
#include <GetVehicleColor>
#include <morphinc>
#include <foreach>
//////////////////////////////////////
forward OnPlayerRegister(playerid, password[]);
forward OnPlayerLogins(playerid,password[]);

#if defined FILTERSCRIPT
#define FIRME_FILE          "Firme/%d.ini"
#define MAX_Firme           400
#define DIALOG_FIRMA2               58
#define ZArabotka_FIRMA            59
#define SCM SendClientMessage
#define SPD ShowPlayerDialog
#define SPC SetPlayerCheckpoint
#define SCMA SendClientMessageToAll
#define BELA 	0xFFFFFFAA
///////////////////////////////////////////
enum firInfo
{
    fProveraVlasnika,
    fVlasnik[45],
	fVrsta,
	fVrstaIme[45],
	fIme[128],
	Float:fUlazX,
    Float:fUlazY,
    Float:fUlazZ,
    fLevel,
	fCena,
    fKasa,
    fInt,
	fZatvoreno,
    fVw,
    fProizvodi,
	fMaxProizvodi,
	fAdresa[64],
	fZarabotka,
}
new FirmaInfo[MAX_Firme][firInfo];
new FirmaPickup[sizeof(FirmaInfo)];
new FirmaMapIcon[sizeof(FirmaInfo)];
new Text3D:FirmaLabel[sizeof(FirmaInfo)];

enum pInfo
{
pPosedovanjeFirme2

};
new PlayerInfo[MAX_PLAYERS][pInfo];


public OnFilterScriptInit()
{
	print("\n--------------------------------------");
	print(" Blank Filterscript by your name here");
	print("--------------------------------------\n");
	return 1;
}

public OnFilterScriptExit()
{
	return 1;
}

#else

main()
{
	print("\n----------------------------------");
	print(" Blank Gamemode by your name here");
	print("----------------------------------\n");
}

#endif

public OnGameModeInit()
{
	// Don't use these lines if it's a filterscript
	SetGameModeText("Blank Script");
	AddPlayerClass(0, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
	return 1;
}

public OnGameModeExit()
{
	return 1;
}

public OnPlayerRequestClass(playerid, classid)
{
	SetPlayerPos(playerid, 1958.3783, 1343.1572, 15.3746);
	SetPlayerCameraPos(playerid, 1958.3783, 1343.1572, 15.3746);
	SetPlayerCameraLookAt(playerid, 1958.3783, 1343.1572, 15.3746);
	return 1;
}

public OnPlayerConnect(playerid)
{

  PlayerInfo[playerid][pPosedovanjeFirme2] = 0;

	return 1;
}

public OnPlayerDisconnect(playerid, reason)
{
	return 1;
}

public OnPlayerSpawn(playerid)
{
	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[])
{

CMD:napravifirmu(playerid, params[])
{
	new id,level,cena,ime[128],zarabotka,Float:X,Float:Y,Float:Z,string[400],ffirme1[80];
	GetPlayerPos(playerid,X,Y,Z);
	if(sscanf(params, "s[128]iiii", ime,id , level, cena, zarabotka)) return SCM(playerid,COLOR_RED,"/napravifirmu [ime] [id] [level] [cena] [zarabotka]");
	{
			if(IsPlayerAdmin(playerid) || PlayerInfo[playerid][pAdmin] >= 1338)
		    {
				if(id >= MAX_Firme) return SCM(playerid,BELA, "{FF0000}[Greska!]{BFC0C2} Maksimalni limit vikendica je dostignut obavesti skriptera o ovome!");
				format(ffirme1, sizeof(ffirme1), FIRME_FILE, id);
				if(fexist(ffirme1)) return SCM(playerid,BELA, "{FF0000}[Greska!]{BFC0C2} Vikendica sa tim IDom postoji!");
				FirmaInfo[id][fIme] = ime;
				FirmaInfo[id][fCena] = cena;
				FirmaInfo[id][fLevel] = level;
				FirmaInfo[id][fUlazX] = X;
			    FirmaInfo[id][fUlazY] = Y;
				FirmaInfo[id][fUlazZ] = Z;
				FirmaInfo[id][fZarabotka] = zarabotka;
				FirmaInfo[id][fProveraVlasnika] = 0;
			 	FirmaInfo[id][fZatvoreno] = 1;
			    strmid(FirmaInfo[id][fAdresa],UlicaFirme(id),0,strlen(UlicaFirme(id)),255);
			    strmid(FirmaInfo[id][fVlasnik],"Niko",0,strlen("Niko"),255);
	      		format(string,sizeof(string),"{3375F0}Firmata se Prodava!\n{FAE805}Ime: {FF0909}%s\n{FAE805}Zarabotka: {FF0909}$%d\n{FAE805}Cena: {FF0909}$%d\n{FAE805}Level: {FF0909}%d\n{FAE805}Adresa: {FF0909}%s {FAE805}Br: {FF0909}%d",FirmaInfo[id][fIme],FirmaInfo[id][fZarabotka],FirmaInfo[id][fCena],FirmaInfo[id][fLevel],FirmaInfo[id][fAdresa],id);
			    //VikendicaLabel[id] = Create3DTextLabel(string ,0x33CCFFAA,X,Y,Z,25,0,1);
                FirmaLabel[id] = CreateDynamic3DTextLabel(string, 0x33CCFFAA, X,Y,Z, 25.0, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 0, -1, -1, -1, 6.0);
				FirmaPickup[id] = CreatePickup(1274, 1, FirmaInfo[id][fUlazX], FirmaInfo[id][fUlazY], FirmaInfo[id][fUlazZ]);
				FirmaMapIcon[id] = CreateDynamicMapIcon(FirmaInfo[id][fUlazX], FirmaInfo[id][fUlazY], FirmaInfo[id][fUlazZ], 52, -1, -1, -1, -1, 100);
				SCMF(playerid,BELA,"{FFFFFF}[GLD]:{00C0FF} Vikendica ID {FFFFFF}%d{00C0FF} je uspesno kreirana!",id); SacuvajFirme(id);
			} else return SCM(playerid,BELA,"{FF0000}[Greska!]{BFC0C2} Samo Admini!");

	}
	return 1;
}
CMD:kupifirma(playerid, params[])
{

    #pragma unused params
    for(new i; i < sizeof(FirmaInfo); i++)
	{
    	if(IsPlayerInRangeOfPoint(playerid, 3.0, FirmaInfo[i][fUlazX], FirmaInfo[i][fUlazY], FirmaInfo[i][fUlazZ]))
    	{
    		if(!strcmp(FirmaInfo[i][fVlasnik], "Niko", true) && FirmaInfo[i][fProveraVlasnika] == 0)
    		{
				if(PlayerInfo[playerid][pPosedovanjeFirme2] != 0) return SCM(playerid,BELA, "{FF0000}[Greska!]{BFC0C2} Veke imate Firma!");
				if(GetPlayerScore(playerid) < FirmaInfo[i][fLevel]) return SCM(playerid,BELA,"{FF0000}[Greska!]{BFC0C2} Nemate dovoljan level za kupovinu firme!");
				if(GetPlayerMoney(playerid) < FirmaInfo[i][fCena]) return SCM(playerid,BELA, "{FF0000}[Greska!]{BFC0C2} Nemate dovoljno novca za kupovinu firme!");
				strmid(FirmaInfo[i][fVlasnik], ImeIgraca(playerid), 0, strlen(ImeIgraca(playerid)), 255);
				FirmaInfo[i][fProveraVlasnika] = 1; PlayerInfo[playerid][pPosedovanjeFirme2] = i;
				FirmaInfo[i][fZatvoreno] = 0; GivePlayerMoney(playerid, -FirmaInfo[i][fCena]); FirmaLP(i); SacuvajFirme(i); OnPlayerUpdate(playerid);
				SCM(playerid,BELA, "{FFFFFF}[GLD]:{00C0FF} Cestito Kupivte!");
				SCM(playerid,BELA, "{FFFFFF}[GLD]:{00C0FF} Za komande na firma koristi /firma!");
				return 1;
			}
			else return SCM(playerid, BELA, "{FF0000}[Greska!]{BFC0C2} Taa firma ne e na prodaja!");
		}
	}
    return 1;
}
CMD:firma(playerid, params[])
{
			#pragma unused params
		    new string[256],i = PlayerInfo[playerid][pPosedovanjeFirme2];
			if(i == 0) return SCM(playerid,BELA,"{FF0000}[Greska!]{BFC0C2} Nemate firmu!");
			if(strcmp(FirmaInfo[PlayerInfo[playerid][pPosedovanjeFirme2]][fVlasnik], ImeIgraca(playerid), true)) return SCM(playerid,BELA, "{FF0000}[Greska!]{BFC0C2} Ne ste vlasnik na firma!");
			if(IsPlayerInRangeOfPoint(playerid, 3.0, FirmaInfo[i][fUlazX], FirmaInfo[i][fUlazY], FirmaInfo[i][fUlazZ]))
			{
			    format(string,sizeof(string),"Prodadi\nVidi kolku imas pari vo kasa\nPodigni pari od kasa");
			    SPD(playerid, DIALOG_FIRMA2, DIALOG_STYLE_LIST, "Firma Opcije", string, "Izberi", "Izlezi");
			    return 1;
			}else return SCM(playerid,BELA,"{FF0000}[Greska!]{BFC0C2} Ne ste pred vasata firma!");
			return 1;
}


	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)
{
   format(var, 32, "Firma=%d\n",PlayerInfo[playerid][pPosedovanjeFirme2]);fwrite(hFile, var);
	return 1;
}

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[])
{
	if(dialogid == DIALOG_FIRMA2)
	    {
		    if(!response) return 1;
			if(PlayerInfo[playerid][pPosedovanjeFirme2] == 0) return SCM(playerid,BELA, "{FF0000}[Greska!]{BFC0C2} Nemate Biznis!");
			new i = PlayerInfo[playerid][pPosedovanjeFirme2];
			switch(listitem)
			{
				case 0:
				{
				 	if(!IsPlayerInRangeOfPoint(playerid, 15.0, FirmaInfo[i][fUlazX], FirmaInfo[i][fUlazY], FirmaInfo[i][fUlazZ])) return SCM(playerid,BELA,"{FF0000}[Greska!]{BFC0C2} Ne ste kaj vasta Firma!");
			 		GivePlayerMoney(playerid,FirmaInfo[i][fCena]/2);
					FirmaInfo[i][fProveraVlasnika] = 0; FirmaInfo[i][fKasa] = 0;
					strmid(FirmaInfo[i][bVlasnik], "Niko", 0, strlen("Niko"), 255); PlayerInfo[playerid][pPosedovanjeFirme2] = 0;
					SacuvajFirme(i); FirmaLP(i); OnPlayerUpdate(playerid);
					format(string,sizeof(string),"{FFFFFF}[GLD]:{00C0FF}Ja prodadovte Firmata za{FFFFFF}$%d {00C0FF}!",FirmaInfo[i][fCena]);
					SCM(playerid,BELA,string);
				}
				case 1:
				{
        				format(string,sizeof(string),"Kasa: %d ",FirmaInfo[i][fKasa]);
						SCM(playerid,BELA,string);
				}
				case 2:
				{
						SPD(playerid,ZArabotka_FIRMA,DIALOG_STYLE_INPUT, "Podigni Pari", "Vnesite Suma na pari \nkoja sakate da ja podignete od vasata firma", "Podigni", "Izlezi");

				}
			}
		}
		if(dialogid == ZArabotka_FIRMA)
		{
			if(PlayerInfo[playerid][pPosedovanjeFirme2] == 0) return SCM(playerid,BELA, "{FF0000}[Greska!]{BFC0C2} Nemate Firma!");
			new i = PlayerInfo[playerid][pPosedovanjeFirme2];
			if(response)
			{
				new iznos;
				if(sscanf(inputtext, "i", iznos)) return SPD(playerid,ZArabotka_FIRMA,DIALOG_STYLE_INPUT, "Podigni Pari", "Vnesite Suma na pari \nkoja sakate da ja podignete od vasata firma", "Podigni", "Izlezi");
				if(iznos > FirmaInfo[i][fKasa]) return SCM(playerid,BELA,"{FF0000}[Greska!]{BFC0C2} Nemate Tolku pari vo Firmata!");
				FirmaInfo[i][fKasa] -= iznos; GivePlayerMoney(playerid,iznos); SacuvajFirme(i);
				format(string,sizeof(string),"{FFFFFF}[GLD]:{00C0FF} Izvadivte $%d od vasata firma",iznos);
				SCM(playerid,BELA,string);
			}
		}

	return 1;
}

public OnPlayerClickPlayer(playerid, clickedplayerid, source)
{
	return 1;
}
public OnPlayerRegister(playerid, password[])
{
 format(var, 32, "Firma=%d\n",PlayerInfo[playerid][pPosedovanjeFirme2]);fwrite(hFile, var);
return 1;
}
public OnPlayerLogins(playerid,password[])
{
if( strcmp( key , "Firma" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pPosedovanjeFirme2] = strval( val ); }
return 1;
}
stock FirmaLP(idfirme)
{
	new string[400];
 	if(FirmaInfo[idfirme][fProveraVlasnika] == 0)
	{
		DestroyPickup(FirmaPickup[idfirme]);
       	format(string,sizeof(string),"{3375F0}Firmata se Prodava!\n{FAE805}Ime: {FF0909}%s\n{FAE805}Zarabotka: {FF0909}$%d\n{FAE805}Cena: {FF0909}$%d\n{FAE805}Level: {FF0909}%d\n{FAE805}Adresa: {FF0909}%s {FAE805}Br: {FF0909}%d",FirmaInfo[idfirme][fIme],FirmaInfo[idfirme][fZarabotka],FirmaInfo[idfirme][fCena],FirmaInfo[idfirme][fLevel],FirmaInfo[idfirme][fAdresa],idfirme);
        UpdateDynamic3DTextLabelText(FirmaLabel[idfirme], 0x33CCFFAA, string);
		FirmaPickup[idfirme] = CreatePickup(1274, 1, FirmaInfo[idfirme][fUlazX], FirmaInfo[idfirme][fUlazY], FirmaInfo[idfirme][fUlazZ]);
		FirmaMapIcon[idfirme] = CreateDynamicMapIcon( FirmaInfo[idfirme][fUlazX], FirmaInfo[idfirme][fUlazY], FirmaInfo[idfirme][fUlazZ], 52, -1, -1, -1, -1, 100);
	}
	else if(FirmaInfo[idfirme][fProveraVlasnika] == 1)
	{
		DestroyPickup(FirmaPickup[idfirme]);
		format(string,sizeof(string),"{00C0FF}[ {F3FF02}%s{00C0FF} ]\n{FAE805}Gazda: {FF0909}%s\n{FAE805}Zarabotka: {FF0909}$%d\n{FAE805}Adresa: {FF0909}%s {FAE805}Br: {FF0909}%d",FirmaInfo[idfirme][fIme],FirmaInfo[idfirme][fVlasnik],FirmaInfo[idfirme][fZarabotka],FirmaInfo[idfirme][fAdresa],idfirme);
        UpdateDynamic3DTextLabelText(FirmaLabel[idfirme], 0x33CCFFAA, string);
		FirmaPickup[idfirme] = CreatePickup(1274, 1, FirmaInfo[idfirme][fUlazX], FirmaInfo[idfirme][fUlazY], FirmaInfo[idfirme][fUlazZ]);
		FirmaMapIcon[idfirme] = CreateDynamicMapIcon( FirmaInfo[idfirme][fUlazX], FirmaInfo[idfirme][fUlazY], FirmaInfo[idfirme][fUlazZ], 52, -1, -1, -1, -1, 100);
	}
	return 1;
}
stock SacuvajFirme(idfirme)
{
	new fFile[128];
    format(fFile, sizeof(fFile), FIRME_FILE, idfirme);
	new INI:File = INI_Open(fFile);
	INI_WriteInt(File,"ProveraVlasnika",FirmaInfo[idfirme][fProveraVlasnika]);
	INI_WriteString(File,"Vlasnik",FirmaInfo[idfirme][fVlasnik]);
	INI_WriteInt(File,"Vrsta",FirmaInfo[idfirme][fVrsta]);
	INI_WriteString(File,"VrstaIme",FirmaInfo[idfirme][fVrstaIme]);
	INI_WriteString(File,"Ime",FirmaInfo[idfirme][fIme]);
	INI_WriteFloat(File,"UlazX",FirmaInfo[idfirme][fUlazX]);
	INI_WriteFloat(File,"UlazY",FirmaInfo[idfirme][fUlazY]);
	INI_WriteFloat(File,"UlazZ",FirmaInfo[idfirme][fUlazZ]);
	INI_WriteInt(File,"Level",FirmaInfo[idfirme][fLevel]);
    INI_WriteInt(File,"Cena",FirmaInfo[idfirme][fCena]);
    INI_WriteInt(File,"Kasa",FirmaInfo[idfirme][fKasa]);
    INI_WriteInt(File,"Interior",FirmaInfo[idfirme][fInt]);
    INI_WriteInt(File,"Zatvoreno",FirmaInfo[idfirme][fZatvoreno]);
    INI_WriteInt(File,"VW",FirmaInfo[idfirme][fVw]);
    INI_WriteInt(File,"Proizvodi",FirmaInfo[idfirme][fProizvodi]);
    INI_WriteInt(File,"MaxProizvodi",FirmaInfo[idfirme][fMaxProizvodi]);
    INI_WriteString(File,"Adresa",FirmaInfo[idfirme][fAdresa]);
    INI_WriteInt(File,"Zarabotka",FirmaInfo[idfirme][fZarabotka]);
	INI_Close(File);
	return 1;
}


Mi vade error unfinden PlayerInfo a ima to
Poslednja Izmena: Februar 15, 2014, 21:44:12 POSLE PODNE od Harris11



Koji error ti baca?

[FS] Bank Sistem
[TuT] Array Sistem (Napredna)


"Pa krenite na mene i provesce te se super ko kapetan Kuka kada levom brise dupe"

www.denis-lapi.com

Iskreno pregledao sam kod koji si dao, način na koji si počeo je katastrofičan ne bih ti preporučio da nastaviš sa kodiranje bar dok još ne naučiš o tome!

Pragma unused help i params se ne koriste za ZCMD nema nikakvog efekta sa i bez toga jedino što imaš višak linija u kodu.
Kod ti je skroz ne optimiziran od samog starta i ako imaš samo par stvari definisanih očigledno ih kopiraš iz jednog jako ne preglednog gamemoda!


forum.sa-mp.com info:
Over 1000 posts.
Over 50 reputation.