Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <a_samp>
- #include <YSI\y_va>
- #include <YSI\y_groups>
- #include <Pawn.CMD>
- #include <sscanf2>
- new nagrada,Float:xPos[3],xPickup,bool:xpokrenut,Group:ghunt;
- public OnFilterScriptInit()
- {
- print("\n--------------------------------------");
- print(" Treasuer Hunt by Common uspjesno ucitan");
- print("--------------------------------------\n");
- ghunt = Group_Create("trhunt");
- return 1;
- }
- public OnPlayerDisconnect(playerid, reason)
- {
- if(xpokrenut && GetPVarInt(playerid, "IsJoined") != 0) { DeletePVar(playerid, "IsJoined"); Group_SetPlayer(ghunt, playerid, false); }
- return 1;
- }
- public OnPlayerEnterCheckpoint(playerid)
- {
- if(xpokrenut && GetPVarInt(playerid, "IsJoined") != 0 && IsPlayerInRangeOfPoint(playerid,1.5,xPos[0],xPos[1],xPos[2]))
- {
- DeletePVar(playerid, "IsJoined"); xpokrenut = false; DestroyPickup(xPickup);
- GivePlayerMoney(playerid,nagrada); DisablePlayerCheckpoint(playerid);
- va_SendClientMessageToAll(-1,"{FCB514}[HUNT] {ffffff}%s je pronasao torbu sa %d$.",GetName(playerid),nagrada); nagrada = 0;
- //ovo dole sam morao ovako napraviti jer se skripta rusi kada izbacujes direktno iz grupe dok traje foreach
- new ide[MAX_PLAYERS],brojka;
- foreach(Group(ghunt), id) { ide[brojka] = id; brojka ++; }
- for(new i; i < brojka; i++)
- {
- Group_SetPlayer(ghunt, ide[i], false); DeletePVar(ide[i], "IsJoined"); DisablePlayerCheckpoint(playerid);
- }
- }
- return 1;
- }
- CMD:ah(playerid, params[])
- {
- if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid,-1, "Nisi ovlasten!");
- SendClientMessage(playerid,-1,"/thunt /ao");
- return 1;
- }
- CMD:ao(playerid, params[])
- {
- if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid,-1, "Nisi ovlasten!");
- new string[40];
- if(sscanf(params,"s[40]",string)) return SendClientMessage(playerid,-1,"/ao [poruka]");
- va_SendClientMessageToAll(-1," [A] Admin %s: %s.",GetName(playerid),string);
- return 1;
- }
- CMD:thunt(playerid, params[])
- {
- if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid,-1, "Nisi ovlasten!");
- if(xpokrenut) return SendClientMessage(playerid,-1,"Event je vec pokrenut");
- if(sscanf(params,"d",nagrada)) return SendClientMessage(playerid,-1,"/thunt [nagrada]");
- va_SendClientMessageToAll(-1,"Pokrenut je treasure hunt sa nagradom %d$. Da se prikljucite /join.",nagrada);
- GetPlayerPos(playerid,xPos[0],xPos[1],xPos[2]); xpokrenut = true;
- xPickup = CreatePickup(1210, 1, xPos[0],xPos[1],xPos[2]);
- return 1;
- }
- CMD:join(playerid, params[])
- {
- if(GetPVarInt(playerid, "IsJoined") == 1 || !xpokrenut) return SendClientMessage(playerid,-1,"Vec ucestvujes ili event nije pokrenut");
- SetPVarInt(playerid, "IsJoined", 1); SendClientMessage(playerid,-1,"Uspjesno si se prikljucio {FCB514}Treasure Huntu");
- SetPlayerCheckpoint(playerid,xPos[0],xPos[1],xPos[2],1.5); Group_SetPlayer(ghunt, playerid, true);
- return 1;
- }
- CMD:left(playerid, params[])
- {
- if(!xpokrenut || GetPVarInt(playerid, "IsJoined") == 0) return SendClientMessage(playerid,-1,"Ne ucestvujes u potrazi ili event nije pokrenut");
- DeletePVar(playerid, "IsJoined"); SendClientMessage(playerid,-1,"Uspjesno si leftao {FCB514}Treasure Hunt");
- DisablePlayerCheckpoint(playerid); Group_SetPlayer(ghunt, playerid, false);
- return 1;
- }
- GetName(id)
- {
- new name[MAX_PLAYER_NAME + 1];
- GetPlayerName(id, name, sizeof(name));
- return name;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement