SA-MP Forums Archive
Deadly arrow - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Deadly arrow (/showthread.php?tid=272174)



Deadly arrow - ColdIce - 27.07.2011

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?


Re: Deadly arrow - DeathOnaStick - 27.07.2011

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


Re: Deadly arrow - ColdIce - 27.07.2011

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?


Re: Deadly arrow - ColdIce - 27.07.2011

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;
}



AW: Deadly arrow - Nero_3D - 27.07.2011

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


Re: Deadly arrow - Rolyy - 27.07.2011

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


Re: Deadly arrow - ColdIce - 27.07.2011

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

edit
Yup it works, thanks guys


Re: Deadly arrow - ColdIce - 27.07.2011

But how to use it as a teleport?

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


Re: Deadly arrow - ColdIce - 27.07.2011

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


Re: Deadly arrow - Jay. - 27.07.2011

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