Help command /usedrugs
#1

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;
}
Reply
#2

BUMP
Reply
#3

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;
}
Reply
#4

What is the diffrence ?
Reply
#5

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

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

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

Код:
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
Reply
#9

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....
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)