How to make 1shot for sniper if you buy it - 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 to make 1shot for sniper if you buy it (
/showthread.php?tid=492730)
How to make 1shot for sniper if you buy it -
Lloyde - 05.02.2014
How to take a one shot for sniper but i want to make a scope for buying and if you buy scope your sniper will take a one shot.
But this scope one shot is for only player that buy a scope and this is a script
pawn Код:
public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid)
{
if(issuerid != INVALID_PLAYER_ID && weaponid == 34)
{
// One shot to kill with sniper rifle
if(PlayerInfo[issuerid][pScope] >= 1)
{
SetPlayerHealth(playerid, 0.0);
}
else
{
SetPlayerHealth(playerid, 0, 30);
}
}
return 1;
}
Re: How to make 1shot for sniper if you buy it -
CuervO - 05.02.2014
pawn Код:
CMD:buy(playerid, params[])
{
if(PlayerInfo[issuerid][pScope] >= 1)
return SendClientMessage(playerid, 0xFF0000FF,"You've already got a scope.");
if(GetPlayerMoney(playerid) < 50000) //change this.
return SendClientMessage(playerid, 0xFF0000FF,"A scope is worth 50000$! You can't pay it!");
PlayerInfo[issuerid][pScope] = 1;
GivePlayerMoney(playerid, -50000); //and this
SendClientMessage(playerid,0x00AA00FF, "You have bought a scope for 50000$!");
return 1;
}
Assuming you've got zcmd it'll work, otherwise convert it. You need to make a command that let's the player buy the scope.
Buying is just the fancy name for setting the variable (pScope) to 1 and then removing the money needed.
Re: How to make 1shot for sniper if you buy it -
Don_Cage - 05.02.2014
Quote:
Originally Posted by Lloyde
How to take a one shot for sniper but i want to make a scope for buying and if you buy scope your sniper will take a one shot.
But this scope one shot is for only player that buy a scope and this is a script
pawn Код:
public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid) { if(issuerid != INVALID_PLAYER_ID && weaponid == 34) { // One shot to kill with sniper rifle if(PlayerInfo[issuerid][pScope] >= 1) { SetPlayerHealth(playerid, 0.0); } else { SetPlayerHealth(playerid, 0, 30); }
} return 1; }
|
Also on your second SetPlayerHealth you have a parameter to much.
My guess is that you want to set his health to 30, so remove the '0,' from there