Merging +REP [EASY for you, not me]
#1

How do I put this code
pawn Код:
if(dialogid == DIALOGWEAPONS)
    {
        if(response)
        {
            switch(listitem)
            {
                case 0:
            {
                if(GetPlayerMoney(playerid) <1500) return SendClientMessage(playerid, COLOR_GRAD, "You don't have enough money to buy this item!");
                SendClientMessage(playerid, COLOR_GRAD, "You bought a deagle for 15k!");
                GivePlayerMoney(playerid, -1500);
                GivePlayerWeapon(playerid,24, 9999999);
            }
                case 1:
            {
                if(GetPlayerMoney(playerid) <2500) return SendClientMessage(playerid, COLOR_GRAD, "You don't have enough money to buy this item!");
                SendClientMessage(playerid, COLOR_GRAD, "You bought a shotgun for 2.5k!");
                GivePlayerMoney(playerid, -2500);
                GivePlayerWeapon(playerid, 25, 9999999);
            }
                case 2:
            {
                if(GetPlayerMoney(playerid) <5000) return SendClientMessage(playerid, COLOR_GRAD, "You don't have enough money to buy this item!");
                SendClientMessage(playerid, COLOR_GRAD, "You bought an MP5 for 5k!");
                GivePlayerMoney(playerid, -5000);
                GivePlayerWeapon(playerid, 29 ,9999999);
            }
                case 3:
            {
                if(GetPlayerMoney(playerid) <170000) return SendClientMessage(playerid, COLOR_GRAD, "You don't have enough money to buy this item!");
                SendClientMessage(playerid, COLOR_GRAD, "You bought a spas12 for 170k!");
                GivePlayerMoney(playerid, -170000);
                GivePlayerWeapon(playerid, 27, 9999999);
            }
                case 4:
            {
                if(GetPlayerMoney(playerid) <50000) return SendClientMessage(playerid, COLOR_GRAD, "You don't have enough money to buy this item!");
                SendClientMessage(playerid, COLOR_GRAD, "You bought an  for 50k!");
                GivePlayerMoney(playerid, -50000);
                GivePlayerWeapon(playerid,30 ,9999999);
            }
                case 5:
            {
                if(GetPlayerMoney(playerid) <60000) return SendClientMessage(playerid, COLOR_GRAD, "You don't have enough money to buy this item!");
                SendClientMessage(playerid, COLOR_GRAD, "You bought an  for 60k!");
                GivePlayerMoney(playerid, -60000);
                GivePlayerWeapon(playerid, 31, 9999999);
            }
                case 6:
            {
                if(GetPlayerMoney(playerid) <150000) return SendClientMessage(playerid, COLOR_GRAD, "You don't have enough money to buy this item!");
                SendClientMessage(playerid, COLOR_GRAD, "You bought a sniper for 150k!");
                GivePlayerMoney(playerid, -150000);
                GivePlayerWeapon(playerid, 34, 9999999);
            }
                case 7:
            {
                if(GetPlayerMoney(playerid) <10000) return SendClientMessage(playerid, COLOR_GRAD, "You don't have enough money to buy this item!");

                new Float:armour;
                GetPlayerArmour(playerid, armour);
                if(armour == 100) return SendClientMessage(playerid, COLOR_GRAD,"You already have a full vest!");
                SendClientMessage(playerid, COLOR_GRAD, "You bought a half vest for 10k!");
                GivePlayerMoney(playerid, -10000);
                SetPlayerArmour(playerid, 50);
            }
                case 8:
            {
                if(GetPlayerMoney(playerid) <20000) return SendClientMessage(playerid, COLOR_GRAD, "You don't have enough money to buy this item!");

                new Float:armour;
                GetPlayerArmour(playerid, armour);
                if(armour == 100) return SendClientMessage(playerid, COLOR_GRAD, "You already have a full vest!");
                SendClientMessage(playerid, COLOR_GRAD, "You bought a full vest for 20k!");
                GivePlayerMoney(playerid, -20000);
                SetPlayerArmour(playerid, 100);
            }

            }
            return 1;
    }
}
Into my OnDialogResponse>
pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
   
    new query[300];
    if(dialogid == DIALOG_REGISTER)
    {
        if(!response) return Kick(playerid);
        if(strlen(inputtext) < 6 || strlen(inputtext) > 129)
        {
            new string[128];
            SendClientMessage(playerid, COLOR_RED, "[ERROR]: Your password must be 6 to 129 characters long!");
            format(string, sizeof(string), "This server requires you to register an account before playing\n\nUsername: %s\n\nEnter your desired password below then click ok.",PlayerName(playerid));
            ShowPlayerDialog(playerid,DIALOG_REGISTER,DIALOG_STYLE_INPUT,"{EDDC57}Registration required",string,"Register","Cancel");
            return 1;
        } else {
            mysql_format(MysqlCon, query, sizeof(query), "INSERT INTO `players` (`user`, `pass`, `IP`) VALUES ('%e', '%s', '%s')", PlayerName(playerid), PasswordHash(inputtext), PlayerIP(playerid));
            mysql_tquery(MysqlCon, query, "OnPlayerRegister", "i", playerid);
        }
    }
    if(dialogid == DIALOG_LOGIN)
    {
        if(!response) return Kick(playerid);
        if(!strcmp(PasswordHash(inputtext), pInfo[playerid][pPass], false))
        {
            mysql_format(MysqlCon, query, sizeof(query), "SELECT * FROM `players` WHERE `user` = '%e' LIMIT 1", PlayerName(playerid));
            mysql_tquery(MysqlCon, query, "OnPlayerLogin", "i", playerid);
        } else {
            LoginAttempt[playerid]++; new string[128];
            if(LoginAttempt[playerid] == 1)
            {
                format(string, sizeof(string), "Before playing you must login\n\nUsername: %s\n\nEnter your password below and click login",PlayerName(playerid));
                ShowPlayerDialog(playerid,DIALOG_LOGIN,DIALOG_STYLE_PASSWORD,"{EDDC57}Login required",string,"Login","Cancel");
                SendClientMessage(playerid, -1,"{B30000}[ERROR]: {FFFFFF}You have entered an incorrect password. [1/3]");
            } else if(LoginAttempt[playerid] == 2)
            {
                format(string, sizeof(string), "Before playing you must login\n\nUsername: %s\n\nEnter your password below and click login",PlayerName(playerid));
                ShowPlayerDialog(playerid,DIALOG_LOGIN,DIALOG_STYLE_PASSWORD,"{EDDC57}Login required",string,"Login","Cancel");
                SendClientMessage(playerid, -1,"{B30000}[ERROR] {FFFFFF}You have entered an incorrect password. [2/3]");
            } else if(LoginAttempt[playerid] == 3)
            {
                SendClientMessage(playerid, -1,"{B30000}[ERROR] {FFFFFF}You have entered an incorrect password. [3/3]");
                format(string,sizeof(string),"{208DD6}[SERVER] {FFFFFF}%s[%d] has been kicked from the server. (Max password attempts)",PlayerName(playerid),playerid);
                SendClientMessageToAll(COLOR_WHITE,string);
                Kick(playerid);
            }
        }
    }
    return 1;
}
Reply
#2

try this
pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
   
    new query[300];
    if(dialogid == DIALOG_REGISTER)
    {
        if(!response) return Kick(playerid);
        if(strlen(inputtext) < 6 || strlen(inputtext) > 129)
        {
            new string[128];
            SendClientMessage(playerid, COLOR_RED, "[ERROR]: Your password must be 6 to 129 characters long!");
            format(string, sizeof(string), "This server requires you to register an account before playing\n\nUsername: %s\n\nEnter your desired password below then click ok.",PlayerName(playerid));
            ShowPlayerDialog(playerid,DIALOG_REGISTER,DIALOG_STYLE_INPUT,"{EDDC57}Registration required",string,"Register","Cancel");
            return 1;
        } else {
            mysql_format(MysqlCon, query, sizeof(query), "INSERT INTO `players` (`user`, `pass`, `IP`) VALUES ('%e', '%s', '%s')", PlayerName(playerid), PasswordHash(inputtext), PlayerIP(playerid));
            mysql_tquery(MysqlCon, query, "OnPlayerRegister", "i", playerid);
        }
    }
    if(dialogid == DIALOG_LOGIN)
    {
        if(!response) return Kick(playerid);
        if(!strcmp(PasswordHash(inputtext), pInfo[playerid][pPass], false))
        {
            mysql_format(MysqlCon, query, sizeof(query), "SELECT * FROM `players` WHERE `user` = '%e' LIMIT 1", PlayerName(playerid));
            mysql_tquery(MysqlCon, query, "OnPlayerLogin", "i", playerid);
        } else {
            LoginAttempt[playerid]++; new string[128];
            if(LoginAttempt[playerid] == 1)
            {
                format(string, sizeof(string), "Before playing you must login\n\nUsername: %s\n\nEnter your password below and click login",PlayerName(playerid));
                ShowPlayerDialog(playerid,DIALOG_LOGIN,DIALOG_STYLE_PASSWORD,"{EDDC57}Login required",string,"Login","Cancel");
                SendClientMessage(playerid, -1,"{B30000}[ERROR]: {FFFFFF}You have entered an incorrect password. [1/3]");
            } else if(LoginAttempt[playerid] == 2)
            {
                format(string, sizeof(string), "Before playing you must login\n\nUsername: %s\n\nEnter your password below and click login",PlayerName(playerid));
                ShowPlayerDialog(playerid,DIALOG_LOGIN,DIALOG_STYLE_PASSWORD,"{EDDC57}Login required",string,"Login","Cancel");
                SendClientMessage(playerid, -1,"{B30000}[ERROR] {FFFFFF}You have entered an incorrect password. [2/3]");
            } else if(LoginAttempt[playerid] == 3)
            {
                SendClientMessage(playerid, -1,"{B30000}[ERROR] {FFFFFF}You have entered an incorrect password. [3/3]");
                format(string,sizeof(string),"{208DD6}[SERVER] {FFFFFF}%s[%d] has been kicked from the server. (Max password attempts)",PlayerName(playerid),playerid);
                SendClientMessageToAll(COLOR_WHITE,string);
                Kick(playerid);
            }
        }
    }
if(dialogid == DIALOGWEAPONS)
    {
        if(response)
        {
            switch(listitem)
            {
                case 0:
            {
                if(GetPlayerMoney(playerid) <1500) return SendClientMessage(playerid, COLOR_GRAD, "You don't have enough money to buy this item!");
                SendClientMessage(playerid, COLOR_GRAD, "You bought a deagle for 15k!");
                GivePlayerMoney(playerid, -1500);
                GivePlayerWeapon(playerid,24, 9999999);
            }
                case 1:
            {
                if(GetPlayerMoney(playerid) <2500) return SendClientMessage(playerid, COLOR_GRAD, "You don't have enough money to buy this item!");
                SendClientMessage(playerid, COLOR_GRAD, "You bought a shotgun for 2.5k!");
                GivePlayerMoney(playerid, -2500);
                GivePlayerWeapon(playerid, 25, 9999999);
            }
                case 2:
            {
                if(GetPlayerMoney(playerid) <5000) return SendClientMessage(playerid, COLOR_GRAD, "You don't have enough money to buy this item!");
                SendClientMessage(playerid, COLOR_GRAD, "You bought an MP5 for 5k!");
                GivePlayerMoney(playerid, -5000);
                GivePlayerWeapon(playerid, 29 ,9999999);
            }
                case 3:
            {
                if(GetPlayerMoney(playerid) <170000) return SendClientMessage(playerid, COLOR_GRAD, "You don't have enough money to buy this item!");
                SendClientMessage(playerid, COLOR_GRAD, "You bought a spas12 for 170k!");
                GivePlayerMoney(playerid, -170000);
                GivePlayerWeapon(playerid, 27, 9999999);
            }
                case 4:
            {
                if(GetPlayerMoney(playerid) <50000) return SendClientMessage(playerid, COLOR_GRAD, "You don't have enough money to buy this item!");
                SendClientMessage(playerid, COLOR_GRAD, "You bought an  for 50k!");
                GivePlayerMoney(playerid, -50000);
                GivePlayerWeapon(playerid,30 ,9999999);
            }
                case 5:
            {
                if(GetPlayerMoney(playerid) <60000) return SendClientMessage(playerid, COLOR_GRAD, "You don't have enough money to buy this item!");
                SendClientMessage(playerid, COLOR_GRAD, "You bought an  for 60k!");
                GivePlayerMoney(playerid, -60000);
                GivePlayerWeapon(playerid, 31, 9999999);
            }
                case 6:
            {
                if(GetPlayerMoney(playerid) <150000) return SendClientMessage(playerid, COLOR_GRAD, "You don't have enough money to buy this item!");
                SendClientMessage(playerid, COLOR_GRAD, "You bought a sniper for 150k!");
                GivePlayerMoney(playerid, -150000);
                GivePlayerWeapon(playerid, 34, 9999999);
            }
                case 7:
            {
                if(GetPlayerMoney(playerid) <10000) return SendClientMessage(playerid, COLOR_GRAD, "You don't have enough money to buy this item!");

                new Float:armour;
                GetPlayerArmour(playerid, armour);
                if(armour == 100) return SendClientMessage(playerid, COLOR_GRAD,"You already have a full vest!");
                SendClientMessage(playerid, COLOR_GRAD, "You bought a half vest for 10k!");
                GivePlayerMoney(playerid, -10000);
                SetPlayerArmour(playerid, 50);
            }
                case 8:
            {
                if(GetPlayerMoney(playerid) <20000) return SendClientMessage(playerid, COLOR_GRAD, "You don't have enough money to buy this item!");

                new Float:armour;
                GetPlayerArmour(playerid, armour);
                if(armour == 100) return SendClientMessage(playerid, COLOR_GRAD, "You already have a full vest!");
                SendClientMessage(playerid, COLOR_GRAD, "You bought a full vest for 20k!");
                GivePlayerMoney(playerid, -20000);
                SetPlayerArmour(playerid, 100);
            }

            }
            return 1;
    }
}
Reply
#3

Not working,, Gives me these errors
Код:
Current directory: C:\Users\Bradley\Desktop\SA-MP\gamemodes
cnr.pwn(1404) : error 017: undefined symbol "resetVar"
cnr.pwn(1405) : error 017: undefined symbol "CheckBan"
cnr.pwn(1407) : error 017: undefined symbol "PlayerName"
cnr.pwn(1416) : error 004: function "OnPlayerSave" is not implemented
cnr.pwn(2401) : error 079: inconsistent return types (array & non-array)
cnr.pwn(2406) : error 017: undefined symbol "PlayerName"
cnr.pwn(2408) : error 079: inconsistent return types (array & non-array)
cnr.pwn(2410) : error 017: undefined symbol "PlayerName"
cnr.pwn(2416) : error 079: inconsistent return types (array & non-array)
cnr.pwn(2417) : error 017: undefined symbol "PasswordHash"
cnr.pwn(2419) : error 017: undefined symbol "PlayerName"
cnr.pwn(2425) : error 017: undefined symbol "PlayerName"
cnr.pwn(2430) : error 017: undefined symbol "PlayerName"
cnr.pwn(2436) : error 017: undefined symbol "PlayerName"
cnr.pwn(2442) : warning 217: loose indentation
cnr.pwn(2450) : error 079: inconsistent return types (array & non-array)
cnr.pwn(2457) : error 079: inconsistent return types (array & non-array)
cnr.pwn(2464) : error 079: inconsistent return types (array & non-array)
cnr.pwn(2471) : error 079: inconsistent return types (array & non-array)
cnr.pwn(2478) : error 079: inconsistent return types (array & non-array)
cnr.pwn(2485) : error 079: inconsistent return types (array & non-array)
cnr.pwn(2492) : error 079: inconsistent return types (array & non-array)
cnr.pwn(2499) : error 079: inconsistent return types (array & non-array)
cnr.pwn(2503) : error 079: inconsistent return types (array & non-array)
cnr.pwn(2510) : error 079: inconsistent return types (array & non-array)
cnr.pwn(2514) : error 079: inconsistent return types (array & non-array)
cnr.pwn(2521) : error 079: inconsistent return types (array & non-array)

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


26 Errors.
================ READY ================
Reply
#4

You need to define the Checkban, PlayerName and bla bla to avoid errors.
Reply
#5

They are already..., It works before I add the other thing
Reply
#6

What other thing?
And show how you defined the Playername etc
Reply
#7

**sneeze**
Reply
#8

provide all the definitions and includes once!
Reply
#9

Playername etc arent includes/defines, its a stock
Reply
#10

Try this.

pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid == DIALOGWEAPONS)
    {
        if(response)
        {
            switch(listitem)
            {
                case 0:
            {
                if(GetPlayerMoney(playerid) <1500) return SendClientMessage(playerid, COLOR_GRAD, "You don't have enough money to buy this item!");
                SendClientMessage(playerid, COLOR_GRAD, "You bought a deagle for 15k!");
                GivePlayerMoney(playerid, -1500);
                GivePlayerWeapon(playerid,24, 9999999);
            }
                case 1:
            {
                if(GetPlayerMoney(playerid) <2500) return SendClientMessage(playerid, COLOR_GRAD, "You don't have enough money to buy this item!");
                SendClientMessage(playerid, COLOR_GRAD, "You bought a shotgun for 2.5k!");
                GivePlayerMoney(playerid, -2500);
                GivePlayerWeapon(playerid, 25, 9999999);
            }
                case 2:
            {
                if(GetPlayerMoney(playerid) <5000) return SendClientMessage(playerid, COLOR_GRAD, "You don't have enough money to buy this item!");
                SendClientMessage(playerid, COLOR_GRAD, "You bought an MP5 for 5k!");
                GivePlayerMoney(playerid, -5000);
                GivePlayerWeapon(playerid, 29 ,9999999);
            }
                case 3:
            {
                if(GetPlayerMoney(playerid) <170000) return SendClientMessage(playerid, COLOR_GRAD, "You don't have enough money to buy this item!");
                SendClientMessage(playerid, COLOR_GRAD, "You bought a spas12 for 170k!");
                GivePlayerMoney(playerid, -170000);
                GivePlayerWeapon(playerid, 27, 9999999);
            }
                case 4:
            {
                if(GetPlayerMoney(playerid) <50000) return SendClientMessage(playerid, COLOR_GRAD, "You don't have enough money to buy this item!");
                SendClientMessage(playerid, COLOR_GRAD, "You bought an  for 50k!");
                GivePlayerMoney(playerid, -50000);
                GivePlayerWeapon(playerid,30 ,9999999);
            }
                case 5:
            {
                if(GetPlayerMoney(playerid) <60000) return SendClientMessage(playerid, COLOR_GRAD, "You don't have enough money to buy this item!");
                SendClientMessage(playerid, COLOR_GRAD, "You bought an  for 60k!");
                GivePlayerMoney(playerid, -60000);
                GivePlayerWeapon(playerid, 31, 9999999);
            }
                case 6:
            {
                if(GetPlayerMoney(playerid) <150000) return SendClientMessage(playerid, COLOR_GRAD, "You don't have enough money to buy this item!");
                SendClientMessage(playerid, COLOR_GRAD, "You bought a sniper for 150k!");
                GivePlayerMoney(playerid, -150000);
                GivePlayerWeapon(playerid, 34, 9999999);
            }
                case 7:
            {
                if(GetPlayerMoney(playerid) <10000) return SendClientMessage(playerid, COLOR_GRAD, "You don't have enough money to buy this item!");

                new Float:armour;
                GetPlayerArmour(playerid, armour);
                if(armour == 100) return SendClientMessage(playerid, COLOR_GRAD,"You already have a full vest!");
                SendClientMessage(playerid, COLOR_GRAD, "You bought a half vest for 10k!");
                GivePlayerMoney(playerid, -10000);
                SetPlayerArmour(playerid, 50);
            }
                case 8:
            {
                if(GetPlayerMoney(playerid) <20000) return SendClientMessage(playerid, COLOR_GRAD, "You don't have enough money to buy this item!");

                new Float:armour;
                GetPlayerArmour(playerid, armour);
                if(armour == 100) return SendClientMessage(playerid, COLOR_GRAD, "You already have a full vest!");
                SendClientMessage(playerid, COLOR_GRAD, "You bought a full vest for 20k!");
                GivePlayerMoney(playerid, -20000);
                SetPlayerArmour(playerid, 100);
            }

            }
                new query[300];
if(dialogid == DIALOG_REGISTER)
    {
        if(!response) return Kick(playerid);
        if(strlen(inputtext) < 6 || strlen(inputtext) > 129)
        {
            new string[128];
            SendClientMessage(playerid, COLOR_RED, "[ERROR]: Your password must be 6 to 129 characters long!");
            format(string, sizeof(string), "This server requires you to register an account before playing\n\nUsername: %s\n\nEnter your desired password below then click ok.",PlayerName(playerid));
            ShowPlayerDialog(playerid,DIALOG_REGISTER,DIALOG_STYLE_INPUT,"{EDDC57}Registration required",string,"Register","Cancel");
            return 1;
        } else {
            mysql_format(MysqlCon, query, sizeof(query), "INSERT INTO `players` (`user`, `pass`, `IP`) VALUES ('%e', '%s', '%s')", PlayerName(playerid), PasswordHash(inputtext), PlayerIP(playerid));
            mysql_tquery(MysqlCon, query, "OnPlayerRegister", "i", playerid);
        }
    }
if(dialogid == DIALOG_LOGIN)
    {
        if(!response) return Kick(playerid);
        if(!strcmp(PasswordHash(inputtext), pInfo[playerid][pPass], false))
        {
            mysql_format(MysqlCon, query, sizeof(query), "SELECT * FROM `players` WHERE `user` = '%e' LIMIT 1", PlayerName(playerid));
            mysql_tquery(MysqlCon, query, "OnPlayerLogin", "i", playerid);
        } else {
            LoginAttempt[playerid]++; new string[128];
            if(LoginAttempt[playerid] == 1)
            {
                format(string, sizeof(string), "Before playing you must login\n\nUsername: %s\n\nEnter your password below and click login",PlayerName(playerid));
                ShowPlayerDialog(playerid,DIALOG_LOGIN,DIALOG_STYLE_PASSWORD,"{EDDC57}Login required",string,"Login","Cancel");
                SendClientMessage(playerid, -1,"{B30000}[ERROR]: {FFFFFF}You have entered an incorrect password. [1/3]");
            } else if(LoginAttempt[playerid] == 2)
            {
                format(string, sizeof(string), "Before playing you must login\n\nUsername: %s\n\nEnter your password below and click login",PlayerName(playerid));
                ShowPlayerDialog(playerid,DIALOG_LOGIN,DIALOG_STYLE_PASSWORD,"{EDDC57}Login required",string,"Login","Cancel");
                SendClientMessage(playerid, -1,"{B30000}[ERROR] {FFFFFF}You have entered an incorrect password. [2/3]");
            } else if(LoginAttempt[playerid] == 3)
            {
                SendClientMessage(playerid, -1,"{B30000}[ERROR] {FFFFFF}You have entered an incorrect password. [3/3]");
                format(string,sizeof(string),"{208DD6}[SERVER] {FFFFFF}%s[%d] has been kicked from the server. (Max password attempts)",PlayerName(playerid),playerid);
                SendClientMessageToAll(COLOR_WHITE,string);
                Kick(playerid);
            }
        }
    }

    return 1;
}
I have not compiled it, since I don't know the exact variables,includes,stocks,etc.

Hope it works.

also, provide us your stocks.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)