SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help > Help Archive

 
 
Thread Tools Display Modes
Old 02/08/2010, 06:15 PM   #1
Lilcuete
Gangsta
 
Join Date: Sep 2009
Posts: 568
Reputation: 1
Default [HELP]when i type /secure or when 3 people type /secure server crashes

Well i just added a /secure command and when i do /secure or when 3 people do /secure it crashes server can someone please help me fix it is very important thanks heres code.
Code:
if(strcmp(cmd, "/secure", true) == 0)
{
	if(IsPlayerConnected(playerid))
	{
		if (PlayerToPoint(6.0, playerid,361.8300,173.2659,1008.3828))
		{
			////printf("Found House :%d",i);
			AccountMenu(playerid);
			return 1;

		}
		else
		{
			SendClientMessage(playerid,COLOR_GREEN,"You are not at the city hall");
			return 1;

		}

	}
}
Heres the AccountMenu function
Code:
forward AccountMenu(playerid,menuid);
public AccountMenu(playerid,menuid)
{
	new dstring[1024];
	new sex[32];
	new origin[32];
	switch (menuid)
	{
		case 0:
		{
			new playername[MAX_PLAYER_NAME];
			GetPlayerName(playerid, playername, sizeof(playername));
			if(PlayerInfo[playerid][pSex] == 1) sex = "Male";
			if(PlayerInfo[playerid][pSex] == 2) sex = "Female";
 		    if(PlayerInfo[playerid][pOrigin] == 1) origin = "United States of America";
			if(PlayerInfo[playerid][pOrigin] == 2) origin = "Europe";
			if(PlayerInfo[playerid][pOrigin] == 3) origin = "Asia";
			if(PlayerInfo[playerid][pOrigin] == 4) origin = "Africa";
			if(PlayerInfo[playerid][pOrigin] == 5) origin = "Russia";
			if(IsPlayerConnected(playerid))
			{
				format(dstring, sizeof(dstring), "Name - (%s)\nPassword - (xxxx)\nAge - (%d)\nSex - (%s)\nOrigin - (%s)\nSocial Security - (%d)\nSell House\nSell Business\nQuit Job",playername,PlayerInfo[playerid][pAge],sex,origin,PlayerInfo[playerid][pSocial]);
				ShowPlayerDialog(playerid,DACCT,DIALOG_STYLE_LIST,"Government(U.S. Registration)",dstring,"Select","Exit");
				return 1;
			}
		}
	    case 1:
		{
		    format(dstring, sizeof(dstring), "Please input your new name, make sure you login with it next time:");
		    ShowPlayerDialog(playerid,DACCT2,DIALOG_STYLE_INPUT,"Government(U.S. Registration) - Account Name Management",dstring,"Ok","Back");
	    	return 1;
		}
		case 2:
		{
		    format(dstring, sizeof(dstring), "Please input your new password, make sure you login with it next time:");
		    ShowPlayerDialog(playerid,DACCT3,DIALOG_STYLE_INPUT,"Government(U.S. Registration) - Account Password Management",dstring,"Ok","Back");
	    	return 1;
		}
		case 3:
		{
		    format(dstring, sizeof(dstring), "Please input your new age, make sure you are 17 or older:");
		    ShowPlayerDialog(playerid,DACCT4,DIALOG_STYLE_INPUT,"Government(U.S. Registration) - Account Age Management",dstring,"Ok","Back");
	    	return 1;
		}
		case 4:
		{
		    format(dstring, sizeof(dstring), "Please select your new sex that you want to change to:");
		    ShowPlayerDialog(playerid,DACCT5,DIALOG_STYLE_MSGBOX,"Government(U.S. Registration) - Account Sex Management",dstring,"Male","Female");
	    	return 1;
	    	
 	    }
		case 5:
		{
            format(dstring, sizeof(dstring), "United States of America\nEurope\nAsia\nAfrica\nRussia");
		    ShowPlayerDialog(playerid,DACCT6,DIALOG_STYLE_LIST,"Government(U.S. Registration) - Account Origin Management",dstring,"Select","Back");
	    	return 1;
		}
		case 6:
		{
		    format(dstring, sizeof(dstring), "Register here for Social Security Number");
		    ShowPlayerDialog(playerid,DACCT7,DIALOG_STYLE_MSGBOX,"Government(U.S. Registration) - Account Registration Management",dstring,"Register","Back");
	    	return 1;
		}
		case 7:
		{
            format(dstring, sizeof(dstring), "Are you sure you want to sell your house?");
		    ShowPlayerDialog(playerid,DACCT8,DIALOG_STYLE_MSGBOX,"(Realstate) - Sell House",dstring,"Yes","Back");
	    	return 1;
		}
		case 8:
		{
            format(dstring, sizeof(dstring), "Are you sure you want to sell your business?");
		    ShowPlayerDialog(playerid,DACCT9,DIALOG_STYLE_MSGBOX,"(Realstate) -Sell business",dstring,"Yes","Back");
	    	return 1;
		}
		case 9:
		{
            format(dstring, sizeof(dstring), "Are you sure you want to quit your job?");
		    ShowPlayerDialog(playerid,DACCT10,DIALOG_STYLE_MSGBOX,"(Manager) - Quit Job",dstring,"Yes","Back");
	    	return 1;

		}
	}
}
and heres OnDialogResponse
Code:
public  OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{

    new idcar = GetPlayerVehicleID(playerid);
/*if(dialogid == 1)
{
    if(!response) SendClientMessage(playerid, 0xFFFFFFFF, "You canceled!");
    new string[128];
    new sendername[MAX_PLAYER_NAME];
    GetPlayerName(playerid, sendername, sizeof(sendername));
    if((strcmp("Johny_Thunder", inputtext, true, strlen(inputtext)) == 0) && (strlen(inputtext) == strlen("Johny_Thunder")))
    {
        SendClientMessage(playerid, COLOR_WHITE, "Thank you for voting.");
        PlayerInfo[playerid][pVoted] = 1;
        Votes[0] ++;
format(string, sizeof(string), "%s Voted for Johny Thunder.", sendername);
VoteLog(string);
}
else if((strcmp("Megan_Homes", inputtext, true, strlen(inputtext)) == 0) && (strlen(inputtext) == strlen("Megan_Homes")))
{
SendClientMessage(playerid, COLOR_WHITE, "Thank you for voting.");
PlayerInfo[playerid][pVoted] = 1;
Votes[1] ++;
format(string, sizeof(string), "%s Voted for Megan Homes.", sendername);
VoteLog(string);
}
else if((strcmp("Kin_Kohaku_Inagawa", inputtext, true, strlen(inputtext)) == 0) && (strlen(inputtext) == strlen("Kin_Kohaku_Inagawa")))
{
SendClientMessage(playerid, COLOR_WHITE, "Thank you for voting.");
PlayerInfo[playerid][pVoted] = 1;
Votes[2] ++;
format(string, sizeof(string), "%s Voted for Kin Kohaku Inagawa.", sendername);
VoteLog(string);
}
else
{
SendClientMessage(playerid, COLOR_LIGHTRED, "Invalid Name, Firstname_Lastname.");
}
return 1;
}*/
//-------------------------Government Registration-----------------------------------//
    if (dialogid == DACCT) {
        if (response == 1) {
            switch (listitem) {
                case 0:
                {
                    AccountMenu(playerid,1);
                }
                case 1:
                {
                    AccountMenu(playerid,2);
                }
                case 2:
                {
                    AccountMenu(playerid,3);
                }
                case 3:
                {
                    AccountMenu(playerid,4);
                }
                case 4:
                {
                    AccountMenu(playerid,5);
                }
                case 5:
                {
                    AccountMenu(playerid,6);
                }
                case 6:
                {
                    AccountMenu(playerid,7);
                }
                case 7:
                {
                    AccountMenu(playerid,8);
                }
                case 8:
                {
                    AccountMenu(playerid,9);
                }
                case 9:
                {
                    AccountMenu(playerid,10);
                   
                }
            }
        }
    }
    if (dialogid == DACCT2) {
        if (response == 1) {
			new string[256];
            new sendername[MAX_PLAYER_NAME];
            new sendername2[MAX_PLAYER_NAME];
            GetPlayerName(playerid, sendername2, sizeof(sendername2));
            GetPlayerName(playerid, sendername, sizeof(sendername));
            if(PlayerInfo[playerid][pChanges] == 0) {
                if(GetPlayerPCash(playerid) < 100000) {
                    SendClientMessage(playerid, COLOR_GRAD2, "You need Atleast $150,000 to get a name change.");
                    return 1;
                }
            }
            format(string, sizeof(string), "users/%s.ini", inputtext);
            if(dini_Exists(string)) {
                SendClientMessage(playerid, COLOR_WHITE, "User Already Exist.");
                return 1;
            }
            if(!NameIsRP(inputtext)) {
                SendClientMessage(playerid, COLOR_YELLOW2, "Immigration: your name is not acceptable.");
                return 1;
            }
            PlayerInfo[playerid][pBanned] = 1;
            OnPlayerDataSave(playerid);
            if(PlayerInfo[playerid][pChanges] == 0) {
                GivePlayerPCash(playerid,-100000);
            }
            else {
                PlayerInfo[playerid][pChanges] --;
            }
            format(string, 256, "AdmWarning: %s has changed his name to %s.", sendername,inputtext);
            ABroadCast(COLOR_YELLOW,string,1);
            format(string, sizeof(string), "Your name has been changed to %s ",inputtext);
            SendClientMessage(playerid,COLOR_WHITE,string);
            PayLog(string);
            new stringpass[256];
            format(string, sizeof(string), "users/%s.ini", sendername);
            stringpass = dini_Get(string, "Key");
            SetPlayerName(playerid, inputtext);
            PlayerInfo[playerid][pBanned] = 0;
            format(string, sizeof(string), "users/%s.ini", inputtext);
            if(!dini_Exists(string)) {
                dini_Create(string);
                dini_Set(string, "Key", stringpass);
            }
            OnPlayerDataSave(playerid);
            if(PlayerInfo[playerid][pCarkey] != SCRIPT_CARS) {
                if(strcmp(CarInfo[PlayerInfo[playerid][pCarkey]][cOwner], sendername2, true) == 0) {
                    strmid(CarInfo[PlayerInfo[playerid][pCarkey]][cOwner], inputtext, 0, strlen(inputtext), 255);
                    SaveCars();
                }
            }
            if(PlayerInfo[playerid][pCarkey2] != SCRIPT_CARS) {
                if(strcmp(CarInfo[PlayerInfo[playerid][pCarkey2]][cOwner], sendername2, true) == 0) {
                    strmid(CarInfo[PlayerInfo[playerid][pCarkey2]][cOwner], inputtext, 0, strlen(inputtext), 255);
                    SaveCars();
                }
            }
            if(PlayerInfo[playerid][pCarkey3] != SCRIPT_CARS) {
                if(strcmp(CarInfo[PlayerInfo[playerid][pCarkey3]][cOwner], sendername2, true) == 0) {
                    strmid(CarInfo[PlayerInfo[playerid][pCarkey3]][cOwner], inputtext, 0, strlen(inputtext), 255);
                    SaveCars();
                }
            }
            if(PlayerInfo[playerid][pHousekey] != 255) {
                if(strcmp(HouseInfo[PlayerInfo[playerid][pHousekey]][hOwner], sendername2, true) == 0) {
                    strmid(HouseInfo[PlayerInfo[playerid][pHousekey]][hOwner], inputtext, 0, strlen(inputtext), 255);
                    OnPropUpdate();
                }
            }
            if(PlayerInfo[playerid][pPbiskey] != 255) {
                if (PlayerInfo[playerid][pPbiskey] >= 100) {
                    if(strcmp(SBizzInfo[PlayerInfo[playerid][pPbiskey]][sbOwner], sendername2, true) == 0) {
                        strmid(SBizzInfo[PlayerInfo[playerid][pPbiskey]][sbOwner], inputtext, 0, strlen(inputtext), 255);
                        OnPropUpdate();
                    }
                    else {
                        if(strcmp(BizzInfo[PlayerInfo[playerid][pPbiskey]][bOwner], sendername2, true) == 0) {
                            strmid(BizzInfo[PlayerInfo[playerid][pPbiskey]][bOwner], inputtext, 0, strlen(inputtext), 255);
                            OnPropUpdate();
                        }
                    }
                }

            }
        }

        else {
           //AccountMenu(playerid,0);

        }
    }
    if (dialogid == DACCT3) {
        if (response == 1) {
            new string[256];
            strmid(PlayerInfo[playerid][pPassword], inputtext, 0, strlen(inputtext), 255);
            SendClientMessage(playerid, COLOR_YELLOW, "   Password has been changed successfuly");
            format(string, sizeof(string), "users/%s.ini", PlayerName(playerid));
            if(dini_Exists(string)) {
                dini_Create(string);
                dini_Set(string, "Key", PlayerInfo[playerid][pPassword]);
            }
            OnPlayerDataSave(playerid);
          
        }
        else {
            

        }
    }
    if (dialogid == DACCT4) {
        if (response == 1) {
            if(IsNull(inputtext)) {
                AccountMenu(playerid,3);
                return 1;
            }
            if(strval(inputtext) <= 16) {
                AccountMenu(playerid,3);
                return 1;
            }
            if(strval(inputtext) >= 100) {
                AccountMenu(playerid,3);
                return 1;
            }
            PlayerInfo[playerid][pAge] = strval(inputtext);
            new string[256];
            format(string, sizeof(string), "Your age is now %d ",PlayerInfo[playerid][pAge]);
            SendClientMessage(playerid,COLOR_WHITE,string);
            OnPlayerDataSave(playerid);
           
        }
        else {
           
        }
    }
    if (dialogid == DACCT5) {
        if (response == 1) {
            PlayerInfo[playerid][pSex] = 1;
            SendClientMessage(playerid,COLOR_WHITE,"You are now a Male");
            OnPlayerDataSave(playerid);
          
        }
        else {
            PlayerInfo[playerid][pSex] = 2;
            SendClientMessage(playerid,COLOR_WHITE,"You are now a Female");
            OnPlayerDataSave(playerid);
            
        }
    }
    if (dialogid == DACCT6) {
        if (response == 1) {
            switch (listitem) {
                case 0:
                {
                    PlayerInfo[playerid][pOrigin] = 1;
                    SendClientMessage(playerid,COLOR_WHITE,"You are now from United Staes Of America");
                    OnPlayerDataSave(playerid);
                   //AccountMenu(playerid,0);
                }
                case 1:
                {
                    PlayerInfo[playerid][pOrigin] = 2;
                    SendClientMessage(playerid,COLOR_WHITE,"You are now from Europe");
                    OnPlayerDataSave(playerid);
                   //AccountMenu(playerid,0);
                }
                case 2:
                {
                    PlayerInfo[playerid][pOrigin] = 3;
                    SendClientMessage(playerid,COLOR_WHITE,"You are now from Asia");
                    OnPlayerDataSave(playerid);
                   //AccountMenu(playerid,0);
                }
                case 3:
                {
                    PlayerInfo[playerid][pOrigin] = 4;
                     SendClientMessage(playerid,COLOR_WHITE,"You are now from Africa");
                     OnPlayerDataSave(playerid);
                   //AccountMenu(playerid,0);
                }
                case 4:
                {
                    PlayerInfo[playerid][pOrigin] = 5;
                    SendClientMessage(playerid,COLOR_WHITE,"You are now from Russia");
                    OnPlayerDataSave(playerid);
                   //AccountMenu(playerid,0);
                }

            }
        }
        else {
           //AccountMenu(playerid,0);
        }
    }
    if (dialogid == DACCT7) {
        if (response == 1) {
           
                  
                    new randsocial = 1000 + random(9999999);
                    PlayerInfo[playerid][pSocial] = randsocial;
                    new string[256];
                    format(string, sizeof(string), "You have just registerd as a U.S. Citizen  social security(%d) ",PlayerInfo[playerid][pSocial]);
                    SendClientMessage(playerid,COLOR_WHITE,string);
                    OnPlayerDataSave(playerid);
                   //AccountMenu(playerid,0);
                   }
        else {
           //AccountMenu(playerid,0);
        }
    }
    if (dialogid == DACCT8) {
        if (response == 1) {
            if(PlayerInfo[playerid][pHousekey] == 255) {
               //AccountMenu(playerid,0);
                return 1;
            }
            new string[256];
            new sendername[MAX_PLAYER_NAME];
            new house = PlayerInfo[playerid][pHousekey];
            RemoveAllFurn(house);
            HouseInfo[house][hHel] = 0;
            HouseInfo[house][hArm] = 0;
            HouseInfo[house][hSafe] = 0;
            HouseInfo[house][hFridge] = 0;
            HouseInfo[house][hClothes] = 0;
            HouseInfo[house][hClothes2] = 0;
            HouseInfo[house][hClothes3] = 0;
            HouseInfo[house][hHealthx] = 0;
            HouseInfo[house][hHealthy] = 0;
            HouseInfo[house][hHealthz] = 0;
            HouseInfo[house][hArmourx] = 0;
            HouseInfo[house][hArmoury] = 0;
            HouseInfo[house][hArmourz] = 0;
            HouseInfo[house][hLock] = 0;
            HouseInfo[house][hOwned] = 0;
            HouseInfo[house][hVec] = 418;
            HouseInfo[house][hVcol1] = -1;
            HouseInfo[house][hVcol2] = -1;
            SafeInfo[house][sDrugs] = 0;
            SafeInfo[house][sMats] = 0;
            SafeInfo[house][sGun][0] = 0;
            SafeInfo[house][sGun][1] = 0;
            SafeInfo[house][sGun][2] = 0;
            SafeInfo[house][sGun][3] = 0;
            SafeInfo[house][sAmmo][0] = 0;
            SafeInfo[house][sAmmo][1] = 0;
            SafeInfo[house][sAmmo][2] = 0;
            SafeInfo[house][sAmmo][3] = 0;
            GetPlayerName(playerid, sendername, sizeof(sendername));
            strmid(HouseInfo[house][hOwner], "The State", 0, strlen("The State"), 255);
            GivePlayerPCash(playerid,HouseInfo[house][hValue]);
            PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
            format(string, sizeof(string), "~w~Congratulations~n~ You have sold your property for ~n~~g~$%d", HouseInfo[house][hValue]);
            GameTextForPlayer(playerid, string, 10000, 3);
            PlayerInfo[playerid][pHousekey] = 255;
            DestroyPickup(HouseInfo[house][hPickupID2]);
            HouseInfo[house][hPickupID]=CreatePickup(1273, 1, HouseInfo[house][hEntrancex], HouseInfo[house][hEntrancey], HouseInfo[house][hEntrancez]);
            Delete3DTextLabel(Text5);
            Delete3DTextLabel(Text3);
            OnPropUpdate();
            SaveSafe();
            OnPlayerDataSave(playerid);
        }
        else {
           //AccountMenu(playerid,0);
        }
    }
    if (dialogid == DACCT9) {
        if (response == 1) {
            if(PlayerInfo[playerid][pPbiskey] == 255) {
               //AccountMenu(playerid,0);
                return 1;
            }
            new string[256];
            new sendername[MAX_PLAYER_NAME];
            new bouse = PlayerInfo[playerid][pPbiskey];
            BizzInfo[bouse][bLocked] = 1;
            BizzInfo[bouse][bOwned] = 0;
            GetPlayerName(playerid, sendername, sizeof(sendername));
            strmid(BizzInfo[bouse][bOwner], "The State", 0, strlen("The State"), 255);
            strmid(BizzInfo[bouse][bExtortion], "No-one", 0, strlen("No-one"), 255);
//ConsumingMoney[playerid] = 1;
            GivePlayerPCash(playerid,BizzInfo[bouse][bTill]);
            PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
            format(string, sizeof(string), "~w~Congratulations~n~ You have sold your property for ~n~~g~$%d", BizzInfo[bouse][bBuyPrice]);
            GameTextForPlayer(playerid, string, 10000, 3);
            DestroyPickup(BizzInfo[bouse][bPickupID]);
            BizzInfo[bouse][bPickupID]=CreatePickup(1272, 1, BizzInfo[bouse][bEntranceX], BizzInfo[bouse][bEntranceY], BizzInfo[bouse][bEntranceZ]);
            BizzInfo[bouse][bTill] = 0;
            PlayerInfo[playerid][pPbiskey] = 255;
            OnPropUpdate();
            GivePlayerPCash(playerid,BizzInfo[bouse][bBuyPrice]);
        }
        else {
           //AccountMenu(playerid,0);
        }
    }
    if (dialogid == DACCT10) {
        if (response == 1) {
            SendClientMessage(playerid, COLOR_LIGHTBLUE, "* You have quit your job");
            PlayerInfo[playerid][pJob] = 0;
        
        }
        else {
           //AccountMenu(playerid,0);
        }
    }
Thanks please help me fix this ASAP thanks .
Lilcuete is offline  
Old 02/08/2010, 06:33 PM   #2
Conroy
Huge Clucker
 
Join Date: Sep 2009
Location: Scotland
Posts: 440
Reputation: 16
Default Re: [HELP]when i type /secure or when 3 people type /secure server crashes

You use AccountMenu(playerid); in the command but the function header has AccountMenu(playerid,menuid)
Conroy is offline  
Old 02/08/2010, 06:40 PM   #3
Lilcuete
Gangsta
 
Join Date: Sep 2009
Posts: 568
Reputation: 1
Default Re: [HELP]when i type /secure or when 3 people type /secure server crashes

LOL thanks man i made a stupid mistake lol.It works too.

Last edited by Lilcuete; 02/08/2010 at 07:21 PM.
Lilcuete is offline  
 

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[FilterScript] >> Belt Secure System << (DKN) ipsBruno Filterscripts 12 13/07/2010 08:51 AM
[SOLVED] Enable Textdraw when type a command and disable when type the ...... RyDeR` Help Archive 2 11/08/2009 10:02 PM
My server does not show up in the internet tab | But it shows if you type ip in aspire5630 Server Support 10 25/06/2009 04:24 PM
What type of server do you prefere? DM,Stunt,RP ect CAMERON_BANFIELD Everything and Nothing 9 16/06/2009 11:53 AM


All times are GMT. The time now is 07:12 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.