Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Santa Claus system by Hrustanovic
- // ============================== { includes } ============================== //
- #include < a_samp >
- #include < zcmd >
- #include < a_actor >
- #include < YSI\y_ini >
- // =============================== { maxovi } =============================== //
- #define MAX_SANTA_CLAUS (50)
- #define MAX_PLAYER (500) // vi ne morate ovo ima vam vec u scripti logicno
- // =============================== { fajlovi } ============================== //
- #define SC_FILE "SantaClaus/%d.ini"
- // =============================== { colors } =============================== //
- #define server "{0B68F4}"
- #define bela "{FFFFFF}"
- // ============================== { script } ================================ //
- #define function%0(%1) forward%0(%1); \
- public%0(%1)
- // ============================ { santa claus } ============================= //
- enum SantaClaus
- {
- Float:scX,
- Float:scY,
- Float:scZ,
- Float:scR
- }
- new Santa_Claus[MAX_SANTA_CLAUS][SantaClaus];
- // =============================== { new-ovi } ============================== //
- new DedaMraz_Actor[MAX_SANTA_CLAUS];
- // ============================== { commands } ============================== //
- CMD:csc(playerid, params[])
- {
- // ovdje dodati provjere nemoj zaboravit jer ako ubacis a ne dodas svaka ce ti budala moc kreirat deda mraza
- // ====================================================================== //
- new SantaClaus_ID = SledeciDedaMraz(), string[500], msg[500], Float:Pos[4];
- // ====================================================================== //
- GetPlayerPos(playerid, Pos[0], Pos[1], Pos[2]); GetPlayerFacingAngle(playerid, Pos[3]);
- // ====================================================================== //
- DedaMraz_Actor[SantaClaus_ID] = CreateActor(25002, Pos[0], Pos[1], Pos[2], Pos[3]); ApplyActorAnimation(DedaMraz_Actor[SantaClaus_ID], "PED", "IDLE_CHAT", 4.1, 1, 0, 0, 0, 0);
- // ====================================================================== //
- Santa_Claus[SantaClaus_ID][scX] = Pos[0];
- Santa_Claus[SantaClaus_ID][scY] = Pos[1];
- Santa_Claus[SantaClaus_ID][scZ] = Pos[2];
- Santa_Claus[SantaClaus_ID][scR] = Pos[3];
- // ====================================================================== //
- format(string, sizeof(string), ""server" (( "bela" Merry Christmas and Happy New Year - 2018 "server" ))");
- Create3DTextLabel(string, 0x33CCFFAA, Pos[0], Pos[1], Pos[2], 5.0, 0, 0);
- // ====================================================================== //
- format(msg, sizeof(msg), ""server"CREATE: "bela"Administrator "server"%s "bela"je kreirao Santa Claus-a ID: "server"%d", GetName(playerid), SantaClaus_ID);
- SendClientMessage(playerid, -1, msg);
- // ====================================================================== //
- SaveSantaClaus(SantaClaus_ID);
- return 1;
- }
- // ========================================================================== //
- CMD:gifts(playerid, params[])
- {
- // ================================================================== //
- for(new i; i < sizeof(Santa_Claus); i++)
- {
- // ============================================================== //
- if(IsPlayerInRangeOfPoint(playerid, 3.0, Santa_Claus[i][scX], Santa_Claus[i][scY], Santa_Claus[i][scZ]))
- {
- // ============================================================== //
- switch(random(3))
- {
- // ============================================================== //
- case 0:
- {
- // ============================================================== //
- new h_money = random(5000), string[500]; GivePlayerMoney(playerid, h_money);
- // ============================================================== //
- format(string, sizeof(string), ""server"INFO: "bela"Santa Claus ti je poklonio "server"%d$"bela". Merry Christmas and Happy New Year!", h_money);
- SendClientMessage(playerid, -1, string);
- // ============================================================== //
- }
- // ============================================================== //
- case 1:
- {
- // ============================================================== //
- new string[500]; SetPlayerScore(playerid, GetPlayerScore(playerid)+1);
- // ============================================================== //
- format(string, sizeof(string), ""server"INFO: "bela"Santa Claus ti je dao Level-Up "server"(%d)"bela". Merry Christmas and Happy New Year!", GetPlayerScore(playerid));
- SendClientMessage(playerid, -1, string);
- // ============================================================== //
- }
- // ============================================================== //
- case 2:
- {
- // ============================================================== //
- new string[500]; format(string, sizeof(string), ""server"INFO: "bela"Ti si na crnoj listi kod Santa Claus-a. Za tebe nema poklona. Budi dobar sljedece godine!");
- SendClientMessage(playerid, -1, string);
- // ============================================================== //
- }
- }
- }
- }
- return 1;
- }
- // ============================== { callback } ============================== //
- public OnGameModeInit()
- {
- // ====================================================================== //
- for(new scid = 1; scid < MAX_SANTA_CLAUS; scid++)
- {
- new scidFile[50];
- format(scidFile, sizeof(scidFile), SC_FILE, scid);
- if(fexist(scidFile))
- {
- INI_ParseFile(scidFile, "LoadSantaClaus", .bExtra = true, .extra = scid);
- DedaMraz_Actor[scid] = CreateActor(25002, Santa_Claus[scid][scX], Santa_Claus[scid][scY], Santa_Claus[scid][scZ], Santa_Claus[scid][scR]);
- ApplyActorAnimation(DedaMraz_Actor[scid], "PED", "IDLE_CHAT", 4.1, 1, 0, 0, 0, 0);
- new string[500]; format(string, sizeof(string), ""server" (( "bela" Merry Christmas and Happy New Year - 2018 "server" ))");
- Create3DTextLabel(string, 0x33CCFFAA, Santa_Claus[scid][scX], Santa_Claus[scid][scY], Santa_Claus[scid][scZ], 5.0, 0, 0);
- }
- }
- // ====================================================================== //
- return 1;
- }
- // =============================== { stocks } =============================== //
- stock SledeciDedaMraz() //stock by Slay_
- {
- new id = -1;
- for(new loop = (0), provjera = (-1), Data_[64] = "\0"; loop != MAX_SANTA_CLAUS; ++ loop)
- {
- provjera = (loop + 1);
- format(Data_, (sizeof Data_), SC_FILE, provjera);
- if(!fexist(Data_))
- {
- id = (provjera);
- break;
- }
- }
- return id;
- }
- // ========================================================================== //
- stock SaveSantaClaus(SantaClaus_ID)
- {
- new aFile[40];
- format(aFile, sizeof(aFile), SC_FILE, SantaClaus_ID);
- new INI:File = INI_Open(aFile);
- INI_WriteFloat(File,"SantaClaus_X", Santa_Claus[SantaClaus_ID][scX]);
- INI_WriteFloat(File,"SantaClaus_Y", Santa_Claus[SantaClaus_ID][scY]);
- INI_WriteFloat(File,"SantaClaus_Z", Santa_Claus[SantaClaus_ID][scZ]);
- INI_WriteFloat(File,"SantaClaus_R", Santa_Claus[SantaClaus_ID][scR]);
- INI_Close(File);
- return 1;
- }
- // ========================================================================== //
- stock GetName(playerid)
- {
- new Ime_Igraca[MAX_PLAYER_NAME];
- GetPlayerName(playerid, Ime_Igraca, MAX_PLAYER_NAME);
- return Ime_Igraca;
- }
- // ============================== { function } ============================== //
- function LoadSantaClaus(SantaClaus_ID, name[], value[])
- {
- INI_Float("SantaClaus_X", Santa_Claus[SantaClaus_ID][scX]);
- INI_Float("SantaClaus_Y", Santa_Claus[SantaClaus_ID][scY]);
- INI_Float("SantaClaus_Z", Santa_Claus[SantaClaus_ID][scZ]);
- INI_Float("SantaClaus_R", Santa_Claus[SantaClaus_ID][scR]);
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement