Jump to content
  • 0

sistem pet help


caltabos

Question

Ba am luat de pe net un sistem de pet l-am pus in gm si merge, dar am incercat sa adaug Tip Pet (Sa selecteze animalul.).

Asta era sistemul normal:

#define DIALOG_PET                 363
#define DIALOG_PET2               364

pInfo:  pPetName[30],  pPetPoints,   pPetLevel,   pPet,    pPetStatus

Dialoguri:

        case DIALOG_PET: {
            switch(listitem) {
                case 0: {
                    if(!response) return 1;
                    if(PlayerInfo[playerid][pPetStatus] == 0) {
                        PlayerInfo[playerid][pPetStatus] = 1;
                        format(string, sizeof(string),"Status\t{26B309}Mounted\nNume Pet\t{FFFF00}%s\nBeneficii pet\nUpgradeaza pet\t%d loiality points.",PlayerInfo[playerid][pPetName],PlayerInfo[playerid][pPetPoints]);
                        SetPlayerAttachedObject(playerid, 6, 19078, 17, 0.021065, -0.100726, 0.143000, 357.120239, 1.712298, 349.232513, 1.000000, 1.000000, 1.120420 );
                        format(string, sizeof(string), "{f4e500}Lvl %d. {41fe00}%s",PlayerInfo[playerid][pPetLevel],PlayerInfo[playerid][pPetName]);
                        Pet[playerid] = CreateDynamic3DTextLabel(string, COLOR_WHITE, 357.120239, 1.712298, 349.232513, 20, playerid);
                        SCMEx(playerid, -1, "Ai trezit pe {41fe00}%s {FFFFFF}si s-a pus pe umarul tau",PlayerInfo[playerid][pPetName]);
                    
                        format(query, sizeof(query),"UPDATE `users` SET `PetStatus` = '1' WHERE `Name` = '%s'", GetName(playerid));
                        mysql_tquery(SQL, query, " ", " ");
                        Update(playerid, pPetStatusx);        
                    }
                    else {
                        RemovePet(playerid);
                        SCMEx(playerid, -1, "Ai trimis pe {41fe00}%s {FFFFFF}la culcare",PlayerInfo[playerid][pPetName]);
                        PlayerInfo[playerid][pPetStatus] = 0;    
                        
                        format(query, sizeof(query),"UPDATE `users` SET `PetStatus` = '0' WHERE `Name` = '%s'", GetName(playerid));
                        mysql_tquery(SQL, query, " ", " ");

                        Update(playerid, pPetStatusx);    
                    }    
                } case 1: {
                    if(    !response) return 1;
                    format(string, sizeof(string),"Numele actual al pet-ului este {41fe00}%s{FFFFFF}.\nDaca doresti sa il schimbi,te rugam sa introduci numele dorit in casuta de mai jos.",PlayerInfo[playerid][pPetName]);
                    ShowPlayerDialog(playerid, DIALOG_PET2, DIALOG_STYLE_INPUT, "Pet name change", string, "Change", "Cancel");
                } case 2: {
                    Checkstatuspet(playerid);                    
    
                } case 3: {
                    if(PlayerInfo[playerid][pPetPoints] < 90) return SendClientMessage(playerid, -1, "Nu poti creste pet-ul in level deoarece nu ai Loiality Points necesare(90)");
                    PlayerInfo[playerid][pPetPoints] -= 90;
                    PlayerInfo[playerid][pPetLevel] ++;
                    Update(playerid, pPetPointsx);
                    Update(playerid, pPetLevelx);
                    SCMEx(playerid, -1, "Acum pet-ul tau are level {41fe00}%d",PlayerInfo[playerid][pPetLevel]);
                    DestroyDynamic3DTextLabel(Pet[playerid]);    

                    format(string, sizeof(string), "{f4e500}Lvl %d. {41fe00}%s",PlayerInfo[playerid][pPetName],PlayerInfo[playerid][pPetLevel]);
                    Pet[playerid] = CreateDynamic3DTextLabel(string, COLOR_WHITE, 357.120239, 1.712298, 349.232513, 20, playerid);
                }
            }    
        }
        case DIALOG_PET2: {
            if(!response) return 1;
            if(!isnull(inputtext)) {
                if(strlen(inputtext) >= 5 && strlen(inputtext) <= 15) {
                    DestroyDynamic3DTextLabel(Pet[playerid]);    
                    format(query, sizeof(query),"UPDATE `users` SET `PetName` = '%s' WHERE `Name` = '%s'",inputtext, GetName(playerid));
                    mysql_tquery(SQL, query, "", "");
                    format(PlayerInfo[playerid][pPetName], 30, inputtext);
                    SCMEx(playerid, -1, "Ai schimbat numele pet-ului in {41fe00}%s",PlayerInfo[playerid][pPetName]);
                    Update(playerid, pPetNamex);    


                    format(string, sizeof(string), "{f4e500}Lvl %d. {41fe00}%s",PlayerInfo[playerid][pPetLevel],PlayerInfo[playerid][pPetName]);
                    Pet[playerid] = CreateDynamic3DTextLabel(string, COLOR_WHITE, 357.120239, 1.712298, 349.232513, 20, playerid);
                }
                else {
                    SCM(playerid, COLOR_YELLOW, "Error: Nume pet invalid. (5 - 15 litere)");
                    format(string, sizeof(string), "Numele actual al pet-ului este {41fe00}%s\nDaca doresti sa il schimbi te rugam introdu numele dorit in casuta de mai jos\nNumele trebuie sa fie de minin 5 caractere si maxim 15",PlayerInfo[playerid][pPetName]);
                    ShowPlayerDialog(playerid, DIALOG_PET2, DIALOG_STYLE_INPUT, "Change pet name", string, "Change", "Cancel");    
                }
            }
            else {
                SCM(playerid, COLOR_YELLOW, "Error: Nume pet invalid. (5 - 15 litere)");
                format(string, sizeof(string), "Numele actual al pet-ului este {41fe00}%s\nDaca doresti sa il schimbi te rugam introdu numele dorit in casuta de mai jos\n Numele trebuie sa fie de minin 5 caractere si maxim 15",PlayerInfo[playerid][pPetName]);
                ShowPlayerDialog(playerid, DIALOG_PET2, DIALOG_STYLE_INPUT, "Change pet name", string, "Change", "Cancel");
            }
        }


 

Si eu am adaugat:

La define-uri

#define DIALOG_PET3

La DIALOG_PET am pus acolo dupa loiality points \nTip Pet (si la comanda /pet tot asa)

Tot la dialog_pet am pus jos sub case 3 :

                } case 4: {
                    if(    !response) return 1;
                    format(string, sizeof(string),"Papagal\nHipopotam\nRechin\nDelfin\nTestoasa");
                    ShowPlayerDialog(playerid, DIALOG_PET3, DIALOG_STYLE_LIST, "Tip Pet", string, "Select", "Cancel");
                }

si am adaugat dialogul:

        case DIALOG_PET3 {
            switch(listitem) {
                case: 0 {
                    SendClientMessage(playerid, COLOR_YELLOW, "Ai selectat papagal!");
                    SetPlayerAttachedObject(playerid, 0, 19078, 17, 0.021065, -0.100726, 0.143000, 357.120239, 1.712298, 349.232513, 1.000000, 1.000000, 1.120420 );
                }
                case: 1 {
                    SendClientMessage(playerid, COLOR_YELLOW, "Ai selectat hipopotam!");
                    SetPlayerAttachedObject(playerid, 1, 1371, 17, 0.021065, -0.100726, 0.143000, 357.120239, 1.712298, 349.232513, 1.000000, 1.000000, 1.120420 );
                }
                case: 2 {
                    SendClientMessage(playerid, COLOR_YELLOW, "Ai selectat rechin!");
                    SetPlayerAttachedObject(playerid, 2, 1608, 17, 0.021065, -0.100726, 0.143000, 357.120239, 1.712298, 349.232513, 1.000000, 1.000000, 1.120420 );
                }
                case: 3 {
                    SendClientMessage(playerid, COLOR_YELLOW, "Ai selectat delfin!");
                    SetPlayerAttachedObject(playerid, 3, 1607, 17, 0.021065, -0.100726, 0.143000, 357.120239, 1.712298, 349.232513, 1.000000, 1.000000, 1.120420 );
                }
                case: 4 {
                    SendClientMessage(playerid, COLOR_YELLOW, "Ai selectat testoasa!");
                    SetPlayerAttachedObject(playerid, 4, 1609, 17, 0.021065, -0.100726, 0.143000, 357.120239, 1.712298, 349.232513, 1.000000, 1.000000, 1.120420 );
                }
            }
        }

Dar imi da PAWN COMPILER HAS STOP WORKING!! Va rog ajutati-ma!!!!

Edited by caltabos
Link to comment
Share on other sites

12 answers to this question

Recommended Posts

  • 0

Pentru erori iti recomand sa te uiti peste asta: https://wiki.sa-mp.com/wiki/Control_Structures#case

Ai aici raspunsurile la toate!

Fii atent ca n.ai pus bine.. de aia si primesti crash la pawno si toate cele.. Probleme simple, dar daca descoperi singurel din link-ul de mai sus nu vei mai repeta greseala.. daca iti dau codul corect.. nu.i bine.

Edited by Cordyandrey
Link to comment
Share on other sites

  • 0

 asa trb sa arate scriptul la caseuri:


format(query, sizeof(query),"UPDATE `users` SET `PetStatus` = '0' WHERE `Name` = '%s'", GetName(playerid));
                        mysql_tquery(SQL, query, " ", " ");

                        Update(playerid, pPetStatusx);    
                    }    
                }

               case 1:  {
                    if(!response) return 1;
                    format(string, sizeof(string),"Numele actual al pet-ului este {41fe00}%s{FFFFFF}.\nDaca doresti sa il schimbi,te rugam sa introduci numele dorit in casuta de mai jos.",PlayerInfo[playerid][pPetName]);
                    ShowPlayerDialog(playerid, DIALOG_PET2, DIALOG_STYLE_INPUT, "Pet name change", string, "Change", "Cancel");
                }

                case 2: {
                    Checkstatuspet(playerid);                

.               }

Link to comment
Share on other sites

  • 0

Sa fim seriosi, nimeni n-a stat sa invete wiki script samp :)) Cel mai bine inveti prin exemple, nu incurajez copy pasteul dar pentru inceput iti sugerez sa faci niste sisteme oarecum mai usoare, sa urmaresti tutoriale. Parerea mea e ca ai inceput pe un GM chiar bun. Doar ca trebuie sa prinzi anumite chestii.. cand mai bagi un sistem noi mai schimbi si cu variabilele tale adica nu dai copy paste si astepti sa ai cel mai tare sistem.. asa toti ar avea gm wow, nu? Cel mai bine e sa incepi cu lucruri basice si nu ma refer la pus un text cu Bine ai venit pe server.. e prea banal ci sa gandesti niste sisteme doar sa ai exemplu chiar in gm.ul tau cum am facut eu.. Am in gm puncte premium.. faci ci puncte roll e aceeasi chestie doar ca trebuie sa redenumesti intr.un fel variabilele si daca faci asta inveti. Asta e cel mai important.

  • Like 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more details you can also review our Terms of Use and Privacy Policy.