SA-MP Forums Archive
[Help] Drugs effect - 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: [Help] Drugs effect (/showthread.php?tid=80875)



[Help] Drugs effect - joeri55 - 07.06.2009

Hello guys,

I have a drugs script.
But I want that it adds 25% armor. How can I fix that without using Objects?

pawn Код:
if (strcmp("/takedrugs", cmdtext, true, 10) == 0)
    {
    if(PlayerDrugs[playerid] == 0) { GameTextForPlayer(playerid,"~r~You dont have Drugs",2000,1); return 1; }
    new Float:px, Float:py, Float:pz;
    GetPlayerPos(playerid,px,py,pz);
    CreatePickup(1241,3,px,py,pz);
    GameTextForPlayer(playerid,"~r~You Take Drugs",2000,1);
    PlayerDrugs[playerid] -=1;
    return 1;
    }
    return 0;



Re: [Help] Drugs effect - Weirdosport - 07.06.2009

Errr, SetPlayerArmour maybe?

Look next time.


Re: [Help] Drugs effect - [CK]Steel - 07.06.2009

Copy the below which I edited for you so that it will give the person 25% armour..

pawn Код:
if (strcmp("/takedrugs", cmdtext, true, 10) == 0)
    {
    if(PlayerDrugs[playerid] == 0) { GameTextForPlayer(playerid,"~r~You dont have Drugs",2000,1); return 1; }
    new Float:px, Float:py, Float:pz;
    GetPlayerPos(playerid,px,py,pz);
    CreatePickup(1241,3,px,py,pz);
     SetPlayerArmour(playerid, 25.0);
    GameTextForPlayer(playerid,"~r~You Take Drugs",2000,1);
    PlayerDrugs[playerid] -=1;
    return 1;
    }
    return 0;



Re: [Help] Drugs effect - [HiC]TheKiller - 07.06.2009

Do you want it to set:

pawn Код:
SetPlayerArmour(playerid,25.0)
OR

Add 25 armour to the current armour:

pawn Код:
if(GetPlayerArmour(playerid) > 75)
{
   SetPlayerArmour(playerid,100)
}
else
{
   SetPlayerArmour(GetPlayerArmour(playerid)+25)
}



Re: [Help] Drugs effect - Gappy - 07.06.2009

Or

pawn Код:
if (strcmp("/takedrugs", cmdtext, true, 10) == 0)
{
    if(PlayerDrugs[playerid] == 0) { GameTextForPlayer(playerid,"~r~You dont have Drugs",2000,1); return 1; }
    new Float:armour;
    GetPlayerArmour(playerid, armour);
    SetPlayerArmour(playerid, armour+25);
    GameTextForPlayer(playerid,"~r~You Take Drugs",2000,1);
    PlayerDrugs[playerid] -=1;
    return 1;
}
return 0;



Re: [Help] Drugs effect - joeri55 - 07.06.2009

Thanks all!