SA-MP Forums Archive
Help command /usedrugs - 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: Help command /usedrugs (/showthread.php?tid=532752)



Help command /usedrugs - Fjclip99 - 20.08.2014

I am having some problems with a command so can someone make a script for me ?
So when player types /usedrugs he gets 50 armor and he gets animation "CRACK" for about 15 seconds and in that time player can't move.
After 15 seconds player can move again...
EDIT: this is my old system but when player first type the command he don't get the animation but when he second type the command, he gets the animation.
Код:
YCMD:usedrugs(playerid,params[],help)
{
	new option[10];
	if(sscanf(params,"s[10]",option)) return SendClientMessage(playerid,COLOR_WHITE,""blue""red"UPORABA:"white""white" /usedrugs [Option] | Options: heroin, ((weed))");
	if(strcmp(option,"heroin") == 0)
	{
		if(pInfo[playerid][Drugs] >= 51)
		{
			new Floar:armour;
			GetPlayerArmour(playerid, Float:armour);
			SetPlayerArmour(playerid, Float:armour + 50);
			pInfo[playerid][Drugs] = pInfo[playerid][Drugs] - 50;
			GetPlayerArmour(playerid, Float:armour);
			if(Float:armour >= 101) SetPlayerArmour(playerid, 100);
			ClearAnimations(playerid);
			ApplyAnimation(playerid, "CRACK", "crckdeth2", 4.1, 0, 0, 0,0, 15000, 0);
			new Float:x,Float:y,Float:z;
			GetPlayerPos(playerid, x, y, z);
   			SetPlayerWeather(playerid, -66);
			new pName[MAX_PLAYER_NAME];
			GetPlayerName(playerid,pName,sizeof(pName));
			SetTimerEx("Drugsoff", 15000, 0, "i", playerid);
			for(new i; i < MAX_PLAYERS; i++)
			if(IsPlayerInRangeOfPoint(i, 20.0, x,y,z))
			{
				new string[128];
				format(string,sizeof(string),"* %s vzema heroin.",pName);
				SendClientMessage(i,COLOR_ACTION,string);
 			}
		}
		else return SendClientMessage(playerid,COLOR_RED,"Nimate dovolj droge pri sebi.");
	}
	if(strcmp(option,"weed") == 0)
	{
		if(pInfo[playerid][Drugs] >= 11)
		{
		}
	}
	return 1;
}

forward Drugsoff(playerid);
public Drugsoff(playerid)
{
	SetCameraBehindPlayer(playerid);
 	SetPlayerWeather(playerid, 2);
 	ClearAnimations(playerid);
    return 1;
}



Re: Help command /usedrugs - Fjclip99 - 20.08.2014

BUMP


Re: Help command /usedrugs - krytans - 20.08.2014

Try this
pawn Код:
YCMD:usedrugs(playerid,params[],help)
{
    new option[10];
    if(sscanf(params,"s[10]",option)) return SendClientMessage(playerid,COLOR_WHITE,""blue""red"UPORABA:"white""white" /usedrugs [Option] | Options: heroin, ((weed))");
    if(strcmp(option,"heroin") == 0)
    {
        if(pInfo[playerid][Drugs] >= 51)
        {
            new Floar:armour;
            GetPlayerArmour(playerid, Float:armour);
            SetPlayerArmour(playerid, Float:armour + 50);
            pInfo[playerid][Drugs] = pInfo[playerid][Drugs] - 50;
            GetPlayerArmour(playerid, Float:armour);
            if(Float:armour >= 101) SetPlayerArmour(playerid, 100);
            ApplyAnimation(playerid, "CRACK", "crckdeth2", 4.1, 0, 0, 0,0, 15000, 0);
            new Float:x,Float:y,Float:z;
            GetPlayerPos(playerid, x, y, z);
            SetPlayerWeather(playerid, -66);
            new pName[MAX_PLAYER_NAME];
            GetPlayerName(playerid,pName,sizeof(pName));
            SetTimerEx("Drugsoff", 15000, 0, "i", playerid);
            for(new i; i < MAX_PLAYERS; i++)
            if(IsPlayerInRangeOfPoint(i, 20.0, x,y,z))
            {
                new string[128];
                format(string,sizeof(string),"* %s vzema heroin.",pName);
                SendClientMessage(i,COLOR_ACTION,string);
            }
        }
        else return SendClientMessage(playerid,COLOR_RED,"Nimate dovolj droge pri sebi.");
    }
    if(strcmp(option,"weed") == 0)
    {
        if(pInfo[playerid][Drugs] >= 11)
        {
        }
    }
    return 1;
}

forward Drugsoff(playerid);
public Drugsoff(playerid)
{
    SetCameraBehindPlayer(playerid);
    SetPlayerWeather(playerid, 2);
    ClearAnimations(playerid);
    return 1;
}



Re: Help command /usedrugs - Fjclip99 - 20.08.2014

What is the diffrence ?


Re: Help command /usedrugs - Fjclip99 - 20.08.2014

Nope... 1st time no nimation, 2nd time animation works...


Re: Help command /usedrugs - VishvaJeet - 20.08.2014

Add
Код:
OnPlayerConnect(playerid)
{
    pInfo[playerid][Drugs] = 100;
}
See this if pInfo[playerid][Drugs] will be greater than 51 then it will be execute
Код:
if(pInfo[playerid][Drugs] >= 51)
{
Or
use this
Код:
YCMD:usedrugs(playerid,params[],help)
{
	new option[10];
	if(sscanf(params,"s[10]",option)) return SendClientMessage(playerid,COLOR_WHITE,""blue""red"UPORABA:"white""white" /usedrugs [Option] | Options: heroin, ((weed))");
	if(strcmp(option,"heroin") == 0)
	{
			new Floar:armour;
			GetPlayerArmour(playerid, Float:armour);
			SetPlayerArmour(playerid, Float:armour + 50);
			GetPlayerArmour(playerid, Float:armour);
			if(Float:armour >= 101) SetPlayerArmour(playerid, 100);
			ClearAnimations(playerid);
			ApplyAnimation(playerid, "CRACK", "crckdeth2", 4.1, 1, 1, 1, 1, 1, 1);
                        SetTimerEx("Drugsoff",15000,0,"i",playerid);
			new Float:x,Float:y,Float:z;
			GetPlayerPos(playerid, x, y, z);
   			SetPlayerWeather(playerid, -66);
			new pName[MAX_PLAYER_NAME];
			GetPlayerName(playerid,pName,sizeof(pName));
			for(new i; i < MAX_PLAYERS; i++)
			if(IsPlayerInRangeOfPoint(i, 20.0, x,y,z))
			{
				new string[128];
				format(string,sizeof(string),"* %s vzema heroin.",pName);
				SendClientMessage(i,COLOR_ACTION,string);
 			}
		}
		else return SendClientMessage(playerid,COLOR_RED,"Nimate dovolj droge pri sebi.");
	}
	if(strcmp(option,"weed") == 0)
	{

	}
	return 1;
}

forward Drugsoff(playerid);
public Drugsoff(playerid)
{
	SetCameraBehindPlayer(playerid);
 	SetPlayerWeather(playerid, 2);
        TogglePlayerControllable(playerid, 1);
 	ClearAnimations(playerid);
        return 1;
}



Re: Help command /usedrugs - Fjclip99 - 20.08.2014

Still when i first time type the command, the animation is not applyed, but second time is....


Re: Help command /usedrugs - VishvaJeet - 20.08.2014

Код:
forward Drugsoff(playerid);
Код:
YCMD:usedrugs(playerid,params[],help)
{
	new option[10];
	if(sscanf(params,"s[10]",option)) return SendClientMessage(playerid,COLOR_WHITE,""blue""red"UPORABA:"white""white" /usedrugs [Option] | Options: heroin, ((weed))");
	if(strcmp(option,"heroin") == 0)
	{
			new Floar:armour;
			GetPlayerArmour(playerid, armour);
			SetPlayerArmour(playerid, armour + 50);
			GetPlayerArmour(playerid, armour);
			if(armour >= 101) SetPlayerArmour(playerid, 100);
			ApplyAnimation(playerid, "CRACK", "crckdeth2", 4.1, 1, 1, 1, 1, 1, 1);
                        SetTimerEx("Drugsoff",15000,0,"i",playerid);
	}
	else return SendClientMessage(playerid,COLOR_RED,"Nimate dovolj droge pri sebi.");
        return 1;
}


public Drugsoff(playerid)
{
	SetCameraBehindPlayer(playerid);
 	SetPlayerWeather(playerid, 2);
        TogglePlayerControllable(playerid, 1);
 	ClearAnimations(playerid);
        return 1;
}
First try this simple


Re: Help command /usedrugs - Fjclip99 - 20.08.2014

Nope, the same :
Quote:
Originally Posted by Fjclip99
Посмотреть сообщение
Still when i first time type the command, the animation is not applyed, but second time is....