Posts: 512
Threads: 121
Joined: Sep 2013
Hi. Is that possible to create a arrow object and when I walk on it, then it will show a dialog weapon shop? coz i'm building a tdm server.
thanks. if who ever has a good heart can you please show a demo?
Posts: 512
Threads: 121
Joined: Sep 2013
Quote:
Originally Posted by Matess
You mean
pawn Код:
CreatePickup(1318, 1, x, y, z, -1);//1318 is white arrow
then in OnPlayerPickUpPickup check this pickup and open dialog
|
thanks man. but I wonder why when I picked it up it dissolved? but im pretty sure the type of the pickup is 1= Exist always. here are the codes
Код:
pickup1 = CreatePickup(19130, 1, 694.3489,-3627.4590,16.8042, -1);
Код:
public OnPlayerPickUpPickup(playerid, pickupid)
{
if(pickupid == pickup1)
{
ShowPlayerDialog(playerid, DIALOGID, DIALOG_STYLE_LIST, "Weapon Shop", "Melee\nPistols\nShotguns\nSub-Machine Guns\nRifle\nAssault", "Select", "Close");
}
EDIT:::::
So I added return 1; and the problem is gone it didn't dissolved the object. but when I choose any of the list. Let say pistols then it shows the lists of guns of the pistols then suddenly it turns back to Weapon shop menu list. even I didn't click back button.
Код:
public OnPlayerPickUpPickup(playerid, pickupid)
{
if(pickupid == pickup1)
{
ShowPlayerDialog(playerid, DIALOGID, DIALOG_STYLE_LIST, "Weapon Shop", "Melee\nPistols\nShotguns\nSub-Machine Guns\nRifle\nAssault", "Select", "Close");
return 1;
}
Posts: 371
Threads: 5
Joined: Oct 2007
Reputation:
0
Yes you are right it shouldn't disappear, but problem could be if you have more than one and you delete some and create it again. There is weakness and pickup IDs could be pretty mixed then.
Posts: 371
Threads: 5
Joined: Oct 2007
Reputation:
0
Yeah because you are standing on it so it means that dialog is opening again and again...
You can create some boolean for it.
Posts: 512
Threads: 121
Joined: Sep 2013
Dear I think there is a problem with the other pickup "RandomPickup" is messing this weapon shop arrow pickup.. here's the whole code.
Код:
public OnPlayerPickUpPickup(playerid, pickupid)
{
if(pickupid == pickup1)
{
ShowPlayerDialog(playerid, DIALOGID, DIALOG_STYLE_LIST, "Weapon Shop", "Melee\nPistols\nShotguns\nSub-Machine Guns\nRifle\nAssault", "Select", "Close");
}
if( pickupid == RandomPickup )
{
new
Float: amount,
r_amount = RandomEx( 5, 30 ),
szStr[ 20 ]
;
if( !RandomPickup_HealthArmour{playerid}) // health pickupid
{
GetPlayerHealth(playerid, amount);
SetPlayerHealth(playerid, amount + r_amount);
format(szStr, sizeof(szStr), "Health Bonus +%d", r_amount);
}
else
{
GetPlayerArmour(playerid, amount);
SetPlayerArmour(playerid, amount + r_amount);
format(szStr, sizeof(szStr ), "Armour Bonus +%d", r_amount);
}
DestroyPickup(RandomPickup);
GameTextForPlayer( playerid, szStr, 3000, 3);
}
return 1;
}
Here the problem (without return in weapon shop dialog). When I walk to the arrow object I made, it shows the dialog then suddenly the object disappears and I get a random bonus health/armour. (It became a staticpickup lol)
Can you help me fix this. It's been 1 and a half hours doing this.