SA-MP Forums Archive
need help with register system - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: need help with register system (/showthread.php?tid=553439)



need help with register system - Rey578 - 29.12.2014

edit.. i fixed it


Re: need help with register system - JaydenJason - 29.12.2014

Quote:
Originally Posted by Rey578
Посмотреть сообщение
I found a register quiz on a gamemode and i tried to combine it with myself.
Everything was working until i started editing OnPlayerText

There's my OnPlayerText
pawn Код:
public OnPlayerText(playerid, text[])
{

    {
        afk_movement[playerid] = AFK_TIME;
        if(character_chosen[playerid])
        {

            if(calling_san[playerid])
            {

                SendSANCall(playerid,text);
                return 0;

            }
            if(racing_sys_writing[playerid] > -1)
            {

                new amount = strval(text);
                if(CharacterInfo[playerid][active_character[playerid]][cMoney] >= amount)
                {

                    if(amount >= 100 && amount <= 10000)
                    {

                        CharacterInfo[playerid][active_character[playerid]][cMoney] -= amount;
                        racing_sys_ticket[playerid] = racing_sys_writing[playerid];
                        racing_sys_stake[playerid] = amount;
                        racing_sys_writing[playerid] = -1;
                        new str[128];
                        SendClientMessage(playerid,COLOR_YELLOW,"|-----Betting Slip-----|");
                        format(str,sizeof(str),"Your bet has been successfully placed!");
                        SendClientMessage(playerid,COLOR_YELLOW,str);
                        format(str,sizeof(str),"You have bet on: %s",racing_sys_names[racing_sys_ticket[playerid]]);
                        SendClientMessage(playerid,COLOR_YELLOW,str);
                        format(str,sizeof(str),"Your bet: $%d",amount);
                        SendClientMessage(playerid,COLOR_YELLOW,str);
                        format(str,sizeof(str),"Odds: %d/%d",racing_sys_odds[racing_sys_ticket[playerid]][0],racing_sys_odds[racing_sys_ticket[playerid]][1]);
                        SendClientMessage(playerid,COLOR_YELLOW,str);
                        TogglePlayerControllable(playerid,1);
                        BizInfo[in_biz[playerid]][bBank] += (amount / 2);
                        return 0;

                    }
                    else
                    {

                        SendClientMessage(playerid,COLOR_LIGHTRED,"You cannot bet under $100 or above $10000");
                        return 0;

                    }

                }
                else
                {

                    SendClientMessage(playerid,COLOR_LIGHTRED,"You do not have this much money.");
                    return 0;

                }

            }
            if(biz_editingentrance[playerid] > -1)
            {

                new amount = strval(text);
                if(amount < 0 || amount > 100000) { SendClientMessage(playerid,COLOR_LIGHTRED,"Entrance fee cannot be below $0 or above $100000"); return 0; }
                BizInfo[biz_editingentrance[playerid]][bEntranceFee] = amount;
                new str[128];
                format(str,sizeof(str),"You have set this businesses entrance fee to $%d",amount);
                SendClientMessage(playerid,COLOR_GREEN,str);
                TogglePlayerControllable(playerid,1);
                new biz = biz_editingentrance[playerid];
                new str2[256];
                format(str2,sizeof(str),"Business Information\n%s\n\nEntrance Fee: $%d\nUse /enter to enter this building",BizInfo[biz][bName],BizInfo[biz][bEntranceFee]);
                Update3DTextLabelText(BizInfo[biz][bPickup],COLOR_LIGHTBLUE,str2);
                biz_editingentrance[playerid] = -1;
                return 0;

            }
            if(calling_nonpolice[playerid] > 0)
            {

                SendPoliceNote(playerid,text);
                return 0;

            }
            if(interview[playerid] > -1)
            {

                SendInterviewMessage(playerid,text);
                return 0;

            }
            if(composing_mail[playerid] > 0)
            {

                ProcessMailStage(playerid,text);
                return 0;

            }
            else if(calling_mechanic[playerid] > 0)
            {

                SendMechanicRequest(playerid,text);
                return 0;

            }
            else if(calling_taxi[playerid])
            {

                SendTaxiRequest(playerid,text);
                return 0;

            }
            else if(setting_fuel_price[playerid])
            {

                new biz = GetClosestBiz(playerid);
                if(IsBusinessOwner(playerid,biz))
                {

                    new price = strval(text);
                    if(price < 1 || price > 50) { SendClientMessageA(playerid,COLOR_LIGHTRED,"Price cannot be above 50 or below 1"); return 0; }
                    BizInfo[biz][bFuelPrice] = price;
                    SendClientMessageA(playerid,COLOR_GREEN,"Fuel price has been set");
                    setting_fuel_price[playerid] = 0;
                    return 0;

                }
                setting_fuel_price[playerid] = false;
                return 0;

            }
            else if(phone_incall[playerid]> -1)
            {

                new other = phone_incall[playerid];
                if(other > -1)
                {

                    new name[MAX_PLAYER_NAME];
                    GetCharacterNameEx(playerid,name);
                    new othername[MAX_PLAYER_NAME];
                    GetCharacterNameEx(other,othername);
                    new str[256];
                    if(strlen(accent[playerid])) { format(str,sizeof(str),"[Cellphone] %s Says: [%s] %s",name,accent[playerid],text); } else { format(str,sizeof(str),"[Cellphone] %s Says: %s",name,text); }
                    SendClientMessageA(other,COLOR_YELLOW,str);
                    GetCharacterName(playerid,name);
                    if(strlen(accent[playerid])) { format(str,sizeof(str),"[Cellphone] %s Says: [%s] %s",name,accent[playerid],text); } else { format(str,sizeof(str),"[Cellphone] %s Says: %s",name,text); }
                    SendLocalICMessage(playerid,str,30.0);
                    return 0;

                }

            }
            else if(biz_editname[playerid] > 0)
            {

                new biz = GetClosestBiz(playerid);
                if(biz == -1) { biz = in_biz[playerid]; }
                if(biz > -1)
                {

                    new rtext[256];
                    rtext = str_replace("~"," ",text);
                    rtext = str_replace("'"," ",rtext);
                    new clean_str[256];
                    mysql_real_escape_string(rtext,clean_str);
                    format(BizInfo[biz][bName],256,"%s",clean_str);
                    SendClientMessageA(playerid,COLOR_GREEN,"The name of your business has been changed.");
                    biz_editname[playerid] = 0;
                    new str[256];
                    format(str,sizeof(str),"Business Information\n%s\n\nEntrance Fee: $%d\nUse /enter to enter this building",BizInfo[biz][bName],BizInfo[biz][bEntranceFee]);
                    Update3DTextLabelText(BizInfo[biz][bPickup],COLOR_LIGHTBLUE,str);
                    return 0;

                }
                else
                {

                    SendClientMessageA(playerid,COLOR_LIGHTRED,"You are not near one of your business.");
                    biz_editname[playerid] = 0;
                    return 0;

                }

            }
            else if(carchoose_color[playerid] > 0)
            {

                new color = strval(text);
                if(color < 0 || color > 126) { SendClientMessageA(playerid,COLOR_LIGHTRED,"Color ID cannot be below 0 or above 126"); return 0; }
                if(carchoose_color[playerid] == 1) { carchoose_color[playerid] = 2; tmp_carcolor1[playerid] = strval(text); SendClientMessageA(playerid,COLOR_GREEN,"Now type the ID of the second car color."); return 0; } else { tmp_carcolor2[playerid] = strval(text); PurchaseVehicle(playerid,vehicle_showroom_position[playerid]); return 0; }

            }
            else if(cooking[playerid])
            {

                ProcessCooking(playerid,text);
                return 0;

            }
            else if(in_911[playerid])
            {

                in_911_stage[playerid] ++;
                RefreshEmerCallStage(playerid,text);
                new str[256];
                new name[MAX_PLAYER_NAME];
                GetCharacterNameEx(playerid,name);
                format(str,sizeof(str),"[Cellphone] %s Says: %s",name,text);
                SendLocalICMessage(playerid,str,30.0);

            }
            else if(biz_withdraw[playerid] > -1)
            {

                new biz = biz_withdraw[playerid];
                if(IsBusinessOwner(playerid,biz))
                {

                    new amount = strval(text);
                    if(amount < 1 || amount > BizInfo[biz][bBank]) { SendClientMessageA(playerid,COLOR_LIGHTRED,"There is not enough money in this bank."); biz_withdraw[playerid] = -1; return 0; }
                    BizInfo[biz][bBank] -= amount;
                    CharacterInfo[playerid][active_character[playerid]][cMoney] += amount;
                    biz_withdraw[playerid] = -1;
                    new str[128];
                    format(str,sizeof(str),"$%d taken from business bank.",amount);
                    SendClientMessage(playerid,COLOR_GREEN,str);
                    return 0;

                }
                else
                {

                    SendErrorMsg(playerid,"You do not own this business.");
                    return 0;

                }

            }
            else if(house_withdraw[playerid] > -1)
            {

                new house = house_withdraw[playerid];
                if(IsHouseOwner(playerid,house))
                {

                    new amount = strval(text);
                    if(amount < 1 || amount > HouseInfo[house][hBank]) { SendClientMessage(playerid,COLOR_LIGHTRED,"There is not enough money in your house to withdraw this amount."); house_withdraw[playerid] = -1; return 0; }
                    HouseInfo[house][hBank] -= amount;
                    CharacterInfo[playerid][active_character[playerid]][cMoney] += amount;
                    house_withdraw[playerid] = -1;
                    new str[128];
                    format(str,sizeof(str),"$%d taken from house bank.",amount);
                    SendClientMessage(playerid,COLOR_GREEN,str);
                    return 0;

                }

            }
            else if(house_settingrent[playerid] > -1)
            {

                new house = house_settingrent[playerid];
                if(IsHouseOwner(playerid,house))
                {

                    new amount = strval(text);
                    if(amount < 1 || amount > 10000) { SendClientMessage(playerid,COLOR_LIGHTRED,"rent cannot be below $1 or above $10000"); house_settingrent[playerid] = -1; return 0; }
                    HouseInfo[house][hRentPrice] = amount;
                    house_settingrent[playerid] = -1;
                    new str[128];
                    format(str,sizeof(str),"House rent set to $%d.",amount);
                    SendClientMessage(playerid,COLOR_GREEN,str);
                    return 0;

                }

            }
            else
            {

                new str[256];
                new name[MAX_PLAYER_NAME];
                GetCharacterNameEx(playerid,name);
                if(!strlen(accent[playerid])) { format(str,sizeof(str),"%s Says: %s",name,text); } else { format(str,sizeof(str),"%s Says: [%s] %s",name,accent[playerid],text); }
                if(!death_mode[playerid]) { SendLocalICMessage(playerid,str,20.0); }
                new anim_time = (1000 + (80 * strlen(text)));
                if(!IsPlayerInAnyVehicle(playerid))
                {

                    if(!in_anim[playerid])
                    {

                        if(!death_mode[playerid] && !sleeping[playerid])
                        {

                            ApplyAnimation(playerid,"PED","IDLE_CHAT",4.0,0,0,0,1,1,1);
                            if(GetPlayerSpecialAction(playerid) != SPECIAL_ACTION_DUCK) SetTimerEx("StopTalk", anim_time, false, "i", playerid);

                        }
                        else
                        {

                            SendErrorMsg(playerid,"You cannot talk whilst dead/asleep.");

                        }

                    }

                }

            }

        }
        else
        {

            SendClientMessageA(playerid,COLOR_LIGHTRED,"Please choose your character first.");

        }
        return 0;
    }
    if(RegistrationStep[playerid] > 0)
    {
        if(strlen(text) >= 128)
        {
            SendClientMessage(playerid, COLOR_LIGHTRED, "[SERVER]: Message is too long.");
        }
        return 0;
    }
        if(RegistrationStep[playerid] == 1)
        {
    //  if(strval(text, "", true) == 0) {
                new idx;
                tmp = strtok(text, idx);

                //format(string, sizeof(string), "* Player:%s answered question of metagaming right or wrong?", noob);
                //SendTesterMessage(COLOR_LIGHTRED, string);
                    strmid(PlayerInfo[playerid][pQuestion1], text, 0, strlen(text), 255);
                //PlayerInfo[playerid][pQuestion1] = strval(text);
                PlayerInfo[playerid][pQuestion1a] = 1;
                RegistrationStep[playerid] = 2;
                SendClientMessage(playerid, COLOR_LIGHTRED, "Ce inseamna MetaGame(MG) ?");
                SendClientMessage(playerid, COLOR_PS, "< Type in the answer >");
                TogglePlayerControllable(playerid,0);
                OnPlayerDataSave(playerid);
                //TogglePlayerControllable(playerid,0);

            return 0;
        }
        else if(RegistrationStep[playerid] == 2)
        {
    //  if(strval(text, "", true) == 0) {
                new idx;
                tmp = strtok(text, idx);

                //format(string, sizeof(string), "* Player:%s answered question of metagaming right or wrong?", noob);
                //SendTesterMessage(COLOR_LIGHTRED, string);
                    strmid(PlayerInfo[playerid][pQuestion2], text, 0, strlen(text), 255);
                //PlayerInfo[playerid][pQuestion1] = strval(text);
                PlayerInfo[playerid][pQuestion2a] = 1;
                RegistrationStep[playerid] = 3;
                SendClientMessage(playerid, COLOR_LIGHTRED, "Ce inseamna Revenge Kill (RK)? ");
                SendClientMessage(playerid, COLOR_PS, "< Type in the answer >");
                TogglePlayerControllable(playerid,0);
                OnPlayerDataSave(playerid);
                //TogglePlayerControllable(playerid,0);

            return 0;
        }
        else if(RegistrationStep[playerid] == 3)
        {
    //  if(strval(text, "", true) == 0) {
                new idx;
                tmp = strtok(text, idx);

                //format(string, sizeof(string), "* Player:%s answered question of metagaming right or wrong?", noob);
                //SendTesterMessage(COLOR_LIGHTRED, string);
                    strmid(PlayerInfo[playerid][pQuestion3], text, 0, strlen(text), 255);
                //PlayerInfo[playerid][pQuestion1] = strval(text);
                PlayerInfo[playerid][pQuestion3a] = 1;
                RegistrationStep[playerid] = 4;
                SendClientMessage(playerid, COLOR_LIGHTRED, "Ce inseamna Roleplay?");
                SendClientMessage(playerid, COLOR_PS, "< Type in the answer >");
                TogglePlayerControllable(playerid,0);
                OnPlayerDataSave(playerid);
                //TogglePlayerControllable(playerid,0);

            return 0;
        }
        else if(RegistrationStep[playerid] == 4)
        {
            //if(strval(text, "", true) == 0) {
                new idx;
                tmp = strtok(text, idx);

                //format(string, sizeof(string), "* Player:%s answered question of metagaming right or wrong?", noob);
                //SendTesterMessage(COLOR_LIGHTRED, string);
                    strmid(PlayerInfo[playerid][pQuestion4], text, 0, strlen(text), 255);
                //PlayerInfo[playerid][pQuestion1] = strval(text);
                PlayerInfo[playerid][pQuestion4a] = 1;
                RegistrationStep[playerid] = 5;
                SendClientMessage(playerid, COLOR_LIGHTRED, "Ce inseamna PowerGame (PG) ?");
                SendClientMessage(playerid, COLOR_PS, "< Type in the answer >");
                TogglePlayerControllable(playerid,0);
                OnPlayerDataSave(playerid);
                //TogglePlayerControllable(playerid,0);

            return 0;
        }
        else if(RegistrationStep[playerid] == 5)
        {
        //  if(strval(text, "", true) == 0) {
                new idx;
                tmp = strtok(text, idx);

                //format(string, sizeof(string), "* Player:%s answered question of metagaming right or wrong?", noob);
                //SendTesterMessage(COLOR_LIGHTRED, string);
                    strmid(PlayerInfo[playerid][pQuestion5], text, 0, strlen(text), 255);
                //PlayerInfo[playerid][pQuestion1] = strval(text);
                PlayerInfo[playerid][pQuestion5a] = 1;
                RegistrationStep[playerid] = 6;
                SendClientMessage(playerid, COLOR_LIGHTRED, "Ce inseamna Mixing?");
                SendClientMessage(playerid, COLOR_PS, "< Type in the answer >");
                TogglePlayerControllable(playerid,0);
                OnPlayerDataSave(playerid);
                //TogglePlayerControllable(playerid,0);

            return 0;
        }
        else if(RegistrationStep[playerid] == 6)
        {
            //  if(strval(text, "", true) == 0) {
                new idx;
                tmp = strtok(text, idx);

                //format(string, sizeof(string), "* Player:%s answered question of metagaming right or wrong?", noob);
                //SendTesterMessage(COLOR_LIGHTRED, string);
                    strmid(PlayerInfo[playerid][pQuestion6], text, 0, strlen(text), 255);
                //PlayerInfo[playerid][pQuestion1] = strval(text);
                PlayerInfo[playerid][pQuestion6a] = 1;
                RegistrationStep[playerid] = 7;
                SendClientMessage(playerid, COLOR_LIGHTRED, "Ce este BunnyHop-ul?");
                SendClientMessage(playerid, COLOR_PS, "< Type in the answer >");
                TogglePlayerControllable(playerid,0);
                OnPlayerDataSave(playerid);
                //TogglePlayerControllable(playerid,0);

            return 0;
        }
        else if(RegistrationStep[playerid] == 7)
        {
            //if(strval(text, "", true) == 0) {
                new idx;
                tmp = strtok(text, idx);

                //format(string, sizeof(string), "* Player:%s answered question of metagaming right or wrong?", noob);
                //SendTesterMessage(COLOR_LIGHTRED, string);
                    strmid(PlayerInfo[playerid][pQuestion7], text, 0, strlen(text), 255);
                //PlayerInfo[playerid][pQuestion1] = strval(text);
                PlayerInfo[playerid][pQuestion7a] = 1;
                RegistrationStep[playerid] = 7;
                SendClientMessage(playerid, COLOR_LIGHTRED, "Ce faci daca vezi un hacker?");
                SendClientMessage(playerid, COLOR_PS, "< Type in the answer >");
                TogglePlayerControllable(playerid,0);
                OnPlayerDataSave(playerid);
                //TogglePlayerControllable(playerid,0);

            return 0;
        }
        else if(RegistrationStep[playerid] == 8)
        {
            //if(strval(text, "", true) == 0) {
                new idx;
                tmp = strtok(text, idx);

                //format(string, sizeof(string), "* Player:%s answered question of metagaming right or wrong?", noob);
                //SendTesterMessage(COLOR_LIGHTRED, string);
                    strmid(PlayerInfo[playerid][pQuestion8], text, 0, strlen(text), 255);
                //PlayerInfo[playerid][pQuestion1] = strval(text);
                PlayerInfo[playerid][pQuestion8a] = 1;
                RegistrationStep[playerid] = 9;
                SendClientMessage(playerid, COLOR_LIGHTRED, "Ai voie sa jefuiesti o persoana de level 1 sau 2?");
                SendClientMessage(playerid, COLOR_PS, "< Type in the answer >");
                TogglePlayerControllable(playerid,0);
                OnPlayerDataSave(playerid);
                //TogglePlayerControllable(playerid,0);
            return 0;
        }
        else if(RegistrationStep[playerid] == 9)
        {
            //if(strval(text, "", true) == 0) {
                new idx;
                tmp = strtok(text, idx);

                //format(string, sizeof(string), "* Player:%s answered question of metagaming right or wrong?", noob);
                //SendTesterMessage(COLOR_LIGHTRED, string);
                strmid(PlayerInfo[playerid][pQuestion9], text, 0, strlen(text), 255);
                //PlayerInfo[playerid][pQuestion1] = strval(text);
                PlayerInfo[playerid][pQuestion9a] = 1;
                RegistrationStep[playerid] = 10;
                SendClientMessage(playerid, COLOR_LIGHTRED, "Ai voie sa inseli un player de bunurile acestuia ? Dar de bani?");
                SendClientMessage(playerid, COLOR_PS, "< Type in the answer >");
                TogglePlayerControllable(playerid,0);
                OnPlayerDataSave(playerid);
                //TogglePlayerControllable(playerid,0);
            return 0;
        }
        else if(RegistrationStep[playerid] == 10)
        {
            //if(strval(text, "", true) == 0) {
                new idx;
                tmp = strtok(text, idx);

    //format(string, sizeof(string), "* Player:%s answered question of metagaming right or wrong?", noob);
                //SendTesterMessage(COLOR_LIGHTRED, string);
                    new noob[MAX_PLAYER_NAME];
                //  new string[128];
                GetPlayerName(playerid, noob, sizeof(noob));
                format(string, sizeof(string), "WARNING: Player:%s has just finished answering his questions /answers to check them all.", noob);
                SendAssistantNote(COLOR_LIGHTRED, string);
                SendAdminBroadcast(COLOR_LIGHTRED, string);
                strmid(PlayerInfo[playerid][pQuestion10], text, 0, strlen(text), 255);
                //PlayerInfo[playerid][pQuestion1] = strval(text);
                PlayerInfo[playerid][pQuestion10a] = 1;
                RegistrationStep[playerid] = 15;
                SetPlayerArmourExs(playerid,0);
                SendClientMessage(playerid, COLOR_LIGHTRED, "SERVER: Answers posted.");
                TogglePlayerControllable(playerid,0);
                OnPlayerDataSave(playerid);
                //TogglePlayerControllable(playerid,0);
            return 0;
        }
    }
    return 0;
}
Errors:
Код:
C:\Users\Alex\Desktop\SAMP\SERVER\gamemodes\test.pwn(7112) : warning 225: unreachable code
C:\Users\Alex\Desktop\SAMP\SERVER\gamemodes\test.pwn(7120) : warning 217: loose indentation
C:\Users\Alex\Desktop\SAMP\SERVER\gamemodes\test.pwn(7128) : warning 217: loose indentation
C:\Users\Alex\Desktop\SAMP\SERVER\gamemodes\test.pwn(7128) : warning 215: expression has no effect
C:\Users\Alex\Desktop\SAMP\SERVER\gamemodes\test.pwn(7128) : error 001: expected token: ";", but found "]"
C:\Users\Alex\Desktop\SAMP\SERVER\gamemodes\test.pwn(7128) : error 029: invalid expression, assumed zero
C:\Users\Alex\Desktop\SAMP\SERVER\gamemodes\test.pwn(7128) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


5 Errors.
Can someone help me? I am a beginner..
Whats line 7112?