SA-MP Forums Archive
How can I create a weapon list? - 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: How can I create a weapon list? (/showthread.php?tid=282444)



How can I create a weapon list? - rangerxxll - 11.09.2011

Like, for example.

pawn Код:
COMMAND:weapons(playerid, cmdtext)
{
 //I think it's ShowPlayerDialog but I'm not sure, what do I add here?
 return 1;
}
Thanks for your help in advance.
And by weapon list, I mean you do the command /weapons and a list of weapons pop up. Then you can choose one.


Re: How can I create a weapon list? - Sasino97 - 11.09.2011

Quote:
Originally Posted by rangerxxll
Посмотреть сообщение
Like, for example.

pawn Код:
COMMAND:weapons(playerid, cmdtext)
{
 //I think it's ShowPlayerDialog but I'm not sure, what do I add here?
 return 1;
}
Thanks for your help in advance.
And by weapon list, I mean you do the command /weapons and a list of weapons pop up. Then you can choose one.
pawn Код:
COMMAND:weapons(playerid, cmdtext)
{
    ShowPlayerDialog(playerid, 32, DIALOG_STYLE_LIST, "Pick a weapon:", "Weapon1\nWeapon2\nWeapon3", "Pick", "Close");
    return 1;
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    if(dialogid == 32)
    {
        if(!response) return 1; // if he clicked the other button, stop the code
        switch(listitem) // Switch trough all list items
        {
            case 0:
            {
                // Give Weapon1
            }
            case 1:
            {
                // Give Weapon2
            }
            case 2:
            {
                // Give Weapon3
            }
        }
    }
    return 1;
}

EDIT: LoL, Las Venturas CNR posteb while I was writing


Re: How can I create a weapon list? - rangerxxll - 11.09.2011

I get.
Quote:

C:\Documents and Settings\Lucas\Desktop\MyTestServerV1.0\gamemodes\ testserver.pwn(86) : error 055: start of function body without function header
C:\Documents and Settings\Lucas\Desktop\MyTestServerV1.0\gamemodes\ testserver.pwn(89) : error 010: invalid function or declaration
C:\Documents and Settings\Lucas\Desktop\MyTestServerV1.0\gamemodes\ testserver.pwn(91) : error 010: invalid function or declaration
C:\Documents and Settings\Lucas\Desktop\MyTestServerV1.0\gamemodes\ testserver.pwn(93) : error 010: invalid function or declaration
C:\Documents and Settings\Lucas\Desktop\MyTestServerV1.0\gamemodes\ testserver.pwn(94) : error 010: invalid function or declaration
C:\Documents and Settings\Lucas\Desktop\MyTestServerV1.0\gamemodes\ testserver.pwn(95) : error 010: invalid function or declaration
C:\Documents and Settings\Lucas\Desktop\MyTestServerV1.0\gamemodes\ testserver.pwn(97) : error 010: invalid function or declaration
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


7 Errors.




Re: How can I create a weapon list? - Sasino97 - 11.09.2011

Quote:
Originally Posted by rangerxxll
Посмотреть сообщение
I get.
Copy "public OnDialogResponse(...)" from my script, and add to Las Venturas CNR's one, before "if(dialogid == ...)"
and at the end add a '}'


Re: How can I create a weapon list? - rangerxxll - 11.09.2011

Quote:
Originally Posted by [GF]Sasino97
Посмотреть сообщение
Copy "public OnDialogResponse(...)" from my script, and add to Las Venturas CNR's one, before "if(dialogid == ...)"
and at the end add a '}'
It compiled, but for
pawn Код:
case 0:
            {
                // Give Weapon1
            }
            case 1:
            {
                // Give Weapon2
            }
            case 2:
            {
                // Give Weapon3
            }
I make //Give Weapon 3
pawn Код:
GivePlayerWeapon(playerid, 24, 100);
Right? And do that for all the weapons?


Re: How can I create a weapon list? - Sasino97 - 11.09.2011

Quote:
Originally Posted by rangerxxll
Посмотреть сообщение
It compiled, but for
pawn Код:
case 0:
            {
                // Give Weapon1
            }
            case 1:
            {
                // Give Weapon2
            }
            case 2:
            {
                // Give Weapon3
            }
I make //Give Weapon 3
pawn Код:
GivePlayerWeapon(playerid, 24, 100);
Right? And do that for all the weapons?
Yes, It was an example. You can get weapon IDs and much more by downloading this https://sampforum.blast.hk/showthread.php?tid=35399


Re: How can I create a weapon list? - rangerxxll - 11.09.2011

Quote:
Originally Posted by [GF]Sasino97
Посмотреть сообщение
Yes, It was an example. You can get weapon IDs and much more by downloading this https://sampforum.blast.hk/showthread.php?tid=35399
Thank you for your help dude, I appreciate it.