---------- -
K3nX - 11.04.2013
----------
Re: Weapon Dialog - PAYING -
Isolated - 11.04.2013
I'm sure if you search enough then you will find a filterscript doing exactly what you want.
Re: Weapon Dialog - PAYING -
[XST]O_x - 11.04.2013
pawn Код:
#include <a_samp>
#define TEAM_COP 0
#define TEAM_SWAT 1
#define TEAM_ARMY 2
enum
{
DIALOG_WEAPONS
}
new listitemSwitch[6][2][0] = {
{"M4A1", 31},
{"Sawnoff", 26},
{"Tec-9", 32},
{"MP5", 29},
{"Uzi", 28},
{"Sniper Rifle", 34}
};
public OnGameModeInit()
{
new i;
for(i = 0; i < MAX_PLAYERS; i++) {
SetPlayerCheckpoint(i, 2722.6714,-2385.0588,17.3403, 5.0); }
return 1;
}
public OnPlayerEnterCheckpoint(playerid)
{
new stringW[256];
switch (GetPlayerTeam(playerid))
{
case TEAM_COP, TEAM_ARMY, TEAM_SWAT: {
for(new i = 0; i < sizeof(listitemSwitch); i++) {
format(stringW, sizeof(stringW), "%s\n", listitemSwitch[i][0]);
}
ShowPlayerDialog(playerid, DIALOG_WEAPONS, DIALOG_STYLE_LIST, "Weapons", stringW, "Get weapon", "Cancel");
}
}
return 1;
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid == DIALOG_WEAPONS)
{
if(response)
{
GivePlayerWeapon(playerid, strval(listitemSwitch[listitem][1]), 1000);
}
return 1;
}
return 0;
}
---------- -
K3nX - 11.04.2013
----------
Re: Weapon Dialog - PAYING -
[XST]O_x - 11.04.2013
Quote:
Originally Posted by K3nX
If I tried to compile it said, pawno has stopped working..
|
You probably changed something.
It works fine for me.
---------- -
K3nX - 11.04.2013
----------
Re: Weapon Dialog - PAYING -
[XST]O_x - 11.04.2013
Quote:
Originally Posted by K3nX
Can you fix it up for me via teamviewer?
|
Hold on, I'm editing some parts of the code. I'll reupload it in a few minutes. It should work afterwards.
---------- -
K3nX - 11.04.2013
----------
Re: Weapon Dialog - PAYING -
[FSaF]Jarno - 11.04.2013
Not the correct section, post script requests here:
https://sampforum.blast.hk/showthread.php?tid=413556
Re: Weapon Dialog - PAYING -
[XST]O_x - 11.04.2013
Quote:
Originally Posted by K3nX
Now?
|
Okay, it's done.
The old code was so wrong. Add this to your gamemode:
pawn Код:
enum
{
DIALOG_WEAPONS
}
new listitemSwitch[6][2][] = {
{"M4A1", WEAPON_M4},
{"Sawnoff", WEAPON_SAWEDOFF },
{"Tec-9", WEAPON_TEC9},
{"MP5", WEAPON_MP5},
{"Uzi", WEAPON_UZI},
{"Sniper Rifle", WEAPON_SNIPER}
};
public OnPlayerSpawn(playerid)
{
if(gTeam[playerid] == army || gTeam[playerid] == /*and so on*/) {
SetPlayerCheckpoint(playerid, 2722.6714,-2385.0588,17.3403,3.5); }
return 1;
}
public OnPlayerEnterCheckpoint(playerid)
{
new stringW[256];
for(new i = 0; i < sizeof(listitemSwitch); i++) {
format(stringW, sizeof(stringW), "%s(%d)\n%s", listitemSwitch[5-i][0],listitemSwitch[i][1],stringW);
ShowPlayerDialog(playerid, DIALOG_WEAPONS, DIALOG_STYLE_LIST, "Weapons", stringW, "Get", "Cancel");
}
return 1;
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid == DIALOG_WEAPONS)
{
if(response)
{
//new strDebug[128];
GivePlayerWeapon(playerid, listitemSwitch[listitem][1][0], 1000);
//format(strDebug, sizeof(strDebug), "Got a %s(%d)", listitemSwitch[listitem][0], listitemSwitch[listitem][1]);
//SendClientMessage(playerid, -1, strDebug);
return 1;
}
return 1;
}
return 0;
}