Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- CUP SISTEM --
- #include <a_samp>
- public OnPlayerDisconnect( playerid, reason ) {
- SavePlayer(playerid);
- return 1;
- }
- ## NEWS ZA CUP ##
- new cup = 0;
- new cnagrada = 0;
- new cpokusaj = 0;
- new codgovor[32];
- new cupobj;
- ## KOLIKO MAX CUPOVA ##
- #define MAX_CUPOVA 1000
- enum Cupovi
- {
- Float:CX, # POZICIJA X
- Float:CY, # POZICIJA Y
- Float:CZ, # POZICIJA X
- CPo
- };
- new C[MAX_CUPOVA][Cupovi];
- new Text3D:CLabel[sizeof(C)]; # TEXT LABEL ZA CUP
- enum {
- DIALOG_CUPODGOVOR ## DIALOG ZA CUP ODGOVOR
- }
- ## KOMANDA
- CMD:napravicup(playerid,params[])
- {
- if(PlayerInfo[playerid][xAdmin] < 6) return GRESKA(playerid, "Nisi ovlasten!");
- if(cup == 1) return SCM( playerid, -1, "Vec je startovan kviz." );
- if(sscanf(params, "s[32]i", codgovor, cnagrada)) return SCM(playerid, -1, "/napravicup (rec) (golda)" );
- if(cnagrada > 50000 || cnagrada < 1) return GRESKA( playerid, "Ne moze vise od $50000 ili manje od $1." ); cup = 1;
- new a[256]; format(a, 256, "{FF0000}MAGICNA REC / {FFFFFF}Admin {FF0000}%s {FFFFFF}je kreirao cup negdje po serveru potrudi se da ga nadjes i pogodi rec!", ImeIgraca(playerid)); SCMTA(-1,a);
- new string[1024];
- new Float:X, Float:Y, Float:Z;
- GetPlayerPos(playerid, X,Y,Z);
- new labelid = 0;
- for(new b = 0; b < sizeof(C); b++)
- {
- if(C[b][CPo] == 1)
- {
- labelid = b + 1;
- }
- }
- C[labelid][CX] = X;
- C[labelid][CY] = Y;
- C[labelid][CZ] = Z;
- C[labelid][CPo] = 1;
- format(string,sizeof(string),"{FF0000}[MAGICNA REC]\n{FFFFFF}Pogodi magicnu rec i obogati se!\nKomanda: {FF0000}/magicnarec\n{FFFFFF}Nagrada: {FF0000}%d golda\n{FFFFFF}Pokusaji: {FF0000}%d", cnagrada, cpokusaj);
- CLabel[labelid] = CreateDynamic3DTextLabel(string ,-1,C[labelid][CX], C[labelid][CY], C[labelid][CZ],20);
- new Float:x, Float:y, Float:z;
- GetPlayerPos(playerid, x,y,z);
- cupobj = CreateDynamicObject(19527, x, y, z-1, 0, 0, 0);
- return true;
- }
- CMD:magicnarec(playerid,params[])
- {
- for(new id; id < MAX_CUPOVA; id++)
- {
- if(IsPlayerInRangeOfPoint(playerid, 2.5, C[id][CX], C[id][CY], C[id][CZ]))
- {
- if(C[id][CPo] == 1)
- {
- SPD( playerid, DIALOG_CUPODGOVOR, DSI, "Magicna Rec", "{FFFFFF}Pogodi /magicnurec i obogati se!", "OK", "");
- }
- else { GRESKA(playerid, "Nisi kod cupa!"); }
- }
- }
- return true;
- }
- public OnDialogResponse( playerid, dialogid, response, listitem, inputtext[])
- {
- //==========================================================================
- else if(dialogid == DIALOG_CUPODGOVOR)
- {
- if(!response) return true;
- if(response)
- {
- if(cup == 0) return GRESKA( playerid, "Nije startovana magicna rec." );
- if(strlen(inputtext) < 1) return GRESKA( playerid, "Moras nesto upisati!" );
- if(!strcmp(codgovor, inputtext, true))
- {
- for(new labelid; labelid < MAX_CUPOVA; labelid++)
- {
- if(IsPlayerInRangeOfPoint(playerid, 4.0, C[labelid][CX], C[labelid][CY], C[labelid][CZ]))
- {
- if(C[labelid][CPo] == 1)
- {
- DestroyDynamic3DTextLabel(CLabel[labelid]);
- C[labelid][CX] = 0;
- C[labelid][CY] = 0;
- C[labelid][CZ] = 0;
- C[labelid][CPo] = 0;
- DestroyDynamicObject(cupobj);
- new mr[400];
- format(mr, 400, "{FF0000}MAGICNA REC / {FFFFFF}Gradjanin {FF0000}(%s) {FFFFFF}je prvi pronasao cup i pogodio rec {FF0000}(%d) golda.", ImeIgraca( playerid ), cnagrada);
- SCMTA(-1, mr);
- new sss[128];
- format(sss, 128, "{FF0000}MAGICNA REC / {FFFFFF}Magicna rec je bila: {FF0000}(%s)", codgovor);
- SCMTA(-1, sss);
- PlayerInfo[playerid][xZlato] += cnagrada;
- cup = 0;
- cnagrada = 1;
- cpokusaj = 0;
- }
- }
- }
- }
- else
- {
- for(new labelid; labelid < MAX_CUPOVA; labelid++)
- {
- if(IsPlayerInRangeOfPoint(playerid, 4.0, C[labelid][CX], C[labelid][CY], C[labelid][CZ]))
- {
- if(C[labelid][CPo] == 1)
- {
- new trcic[400];
- format(trcic, sizeof(trcic), "{FF0000}[MAGICNA REC]\n{FFFFFF}Pogodi magicnu rec i obogati se!\nKomanda: {FF0000}/magicnarec\n{FFFFFF}Nagrada: {FF0000}%d golda\n{FFFFFF}Pokusaji: {FF0000}%d", cnagrada, cpokusaj);
- UpdateDynamic3DTextLabelText(CLabel[labelid], -1, trcic);
- cpokusaj++;
- SCM( playerid,-1, "Ta rec nije ni upola magicna!" );
- }
- }
- }
- }
- }
- }
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement