SA-MP Forums Archive
ad help - 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: ad help (/showthread.php?tid=417607)



ad help - Ananisiki - 21.02.2013

^^^^^^^^


Re: ad help - Babul - 21.02.2013

SetPlayerChatBubble will help you for the text above a player.
concerning the /ad usage: make a variable, and if it got "written", lets say, a 1, into it, deny the command execution. so first, include a check - if it fails (not used), then make sure that the next check will trigger the return. simple stuff hehe
pawn Код:
CMD:ad(playerid, params[])
{
if(GetPVarInt(playerid,"PillsTaken")>0)
{
return 1;//player has used the command already
}
SetPVarInt(playerid,"PillsTaken",1);//this line becomes obsolete, as soon you want to limit each player to more than 1 /ad. then you will like this:
//SetPVarInt(playerid,"PillsTaken",GetPVarInt(playerid,"PillTaken")+1);
    new Float:health;GetPlayerHealth(playerid,health);
    if(isDead[playerid] == 1) return SendClientMessage(playerid, COLOR_RED, "You Cannot Use This Command When Dead.");
    if(health >= 100) return SendClientMessage(playerid, COLOR_RED, "Your Health Is Already Full, You Cannot Take /ad.");
    if(iCanUse[playerid]-gettime() > 0) return SendClientMessage(playerid, COLOR_RED, "Please Wait Before Taking Another Adrenaline Pill.");
    SendClientMessage(playerid, COLOR_LIGHTBLUE, "You Have Taken An Adrenaline Pill.");
    SetPlayerHealth(playerid, 100.0);
    {

        iCanUse[playerid] = gettime() + 5; // 10 seconds
    }
    return 1;
}
the non-indented lines are the fresh ones ^^


Re: ad help - Ananisiki - 22.02.2013

^^^^^^^^


Re: ad help - Ananisiki - 22.02.2013

^^^^^^^^


Re: ad help - Ananisiki - 22.02.2013

^^^^^^^^


Re: ad help - Babul - 22.02.2013

theres no code for "reset ad pills taken" when a player dies. simply add this into the spawn callback:
pawn Код:
public  OnPlayerSpawn(playerid){
    SetPVarInt(playerid,"PillsTaken",1);//simply add that line into the callback
before the return 1; in the (successful) ad pill check, copy your "you took ad already" line:
pawn Код:
SendClientMessage(playerid, COLOR_LIGHTBLUE, "You Have Taken An Adrenaline Pill.");
return 1;
btw: theres an edit button (looks like a pencil) for your posts. raising up your postcount wont increase your sexual abilities.