Deadly arrow
#1

I was thinking about making an arrow that points down, and use it as a pickup and when players come close to it, they die. How do I do it?
Reply
#2

Quote:
Originally Posted by ColdIce
Посмотреть сообщение
I was thinking about making an arrow that points down, and use it as a pickup and when players come close to it, they die. How do I do it?
You need to create a Pickup, then you need make an entry in OnPlayerPickUpPickup (if you don't know how to do it, look it up on the wiki, it's very easy), then just set the players health to 0 at OnPlayerPickUpPickup if the pickup is picked up.
I hope this is what you want
Reply
#3

Thanks, I'll look into it

off topic: My server log sometimes fills up with these:
[13:12:42] tmp = 0, tmp2(logged) = 1, level = 0

What is that?
Reply
#4

pawn Код:
new cash;
 
public OnGameModeInit()
{
    cash = CreatePickup(1274, 2, 0.0, 0.0, 9.0);
    return 1;
}
 
public OnPlayerPickUpPickup(playerid, pickupid)
{
    if(pickupid == cash) GivePlayerMoney(playerid,10000);
    return 1;
}
So I do it like this?
pawn Код:
new arrow;
 
public OnGameModeInit()
{
    arrow = CreatePickup(dontremember, coords, 9.0); //whats that 9.0? The type of pickup?
    return 1;
}
 
public OnPlayerPickUpPickup(playerid, pickupid)
{
    if(pickupid == arrow) SetPlayerHealth(playerid,0);
    return 1;
}
Reply
#5

CreatePickup(model, type, Float:X, Float:Y, Float:Z, Virtualworld)
Reply
#6

Quote:
Originally Posted by ColdIce
Посмотреть сообщение
pawn Код:
arrow = CreatePickup(dontremember, coords, 9.0); //whats that 9.0? The type of pickup?
Код:
CreatePickup(model, type, Float:X, Float:Y, Float:Z, Virtualworld)

model 		The model of the pickup.
type		The pickup spawn type.
Float:X		The X coordinate to create the pickup at.
Float:Y		The Y coordinate to create the pickup at.
Float:Z		The Z coordinate to create the pickup at.
virtualworld	The virtual world ID of the pickup. Use -1 to make the pickup show in all worlds.
https://sampwiki.blast.hk/wiki/CreatePickup
Reply
#7

hmm alright thank you! But is it correct what I showed above?

edit
Yup it works, thanks guys
Reply
#8

But how to use it as a teleport?

{
if(pickupid == something) SetPlayerPos(playerid,coords);
return 1;
}
??
Reply
#9

pawn Код:
public OnPlayerPickUpPickup(playerid, pickupid)
{
if(pickupid == arrow) SetPlayerHealth(playerid,0);
return 1;
}
{
if(pickupid == cash) GivePlayerMoney(playerid,10000);
return 1;
}
pawn Код:
C:\Users\Aрalsteinn\Desktop\Mine\gamemodes\XS.pwn(6608) : error 055: start of function body without function header
C:\Users\Aрalsteinn\Desktop\Mine\gamemodes\XS.pwn(6609) : error 010: invalid function or declaration
C:\Users\Aрalsteinn\Desktop\Mine\gamemodes\XS.pwn(6610) : error 010: invalid function or declaration
C:\Users\Aрalsteinn\Desktop\Mine\gamemodes\XS.pwn(266) : warning 204: symbol is assigned a value that is never used: "cash"
What is wrong here? The arrow thing works fine, its the second thing that gives me errors
Reply
#10

pawn Код:
public OnPlayerPickUpPickup(playerid, pickupid)
{
if(pickupid == arrow)
{
   SetPlayerHealth(playerid,0);
}
else if(pickupid == cash)
{
  GivePlayerMoney(playerid,10000);
}
return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)