All pastes #903664 Raw Edit

Someone

public text v1 · immutable
·published 2008-02-14 11:10 UTC
rendered paste body
new Text:Effects[5]; // top
new usedrugs[MAX_PLAYERS];

ongamemodeinit()
{

		Effects[1] = TextDrawCreate(1.000000,0.000000,"~n~~n~~n~~n~~n~~n~~n~~n~");
		TextDrawUseBox(Effects[1],1);
		TextDrawBoxColor(Effects[1],0x00ffff66);
		TextDrawTextSize(Effects[1],647.000000,-7.000000);
		TextDrawAlignment(Effects[1],2);
		TextDrawBackgroundColor(Effects[1],0x000000ff);
		TextDrawFont(Effects[1],3);
		TextDrawLetterSize(Effects[1],-0.000000,6.199996);
		TextDrawColor(Effects[1],0xffffffff);
		TextDrawSetOutline(Effects[1],1);
		TextDrawSetProportional(Effects[1],1);
		TextDrawSetShadow(Effects[1],1);

		Effects[2] = TextDrawCreate(1.000000,1.000000,"~N~~N~~N~~N~");
		TextDrawUseBox(Effects[2],1);
		TextDrawBoxColor(Effects[2],0x00ff00cc);
		TextDrawTextSize(Effects[2],644.000000,450.000000);
		TextDrawAlignment(Effects[2],0);
		TextDrawBackgroundColor(Effects[2],0x000000ff);
		TextDrawFont(Effects[2],3);
		TextDrawLetterSize(Effects[2],-0.000000,13.300000);
		TextDrawColor(Effects[2],0xffffffff);
		TextDrawSetOutline(Effects[2],1);
		TextDrawSetProportional(Effects[2],1);
		TextDrawSetShadow(Effects[2],1);

		Effects[3] = TextDrawCreate(1.000000,1.000000,"~n~~N~~N~~N~~N~~N~");
		TextDrawUseBox(Effects[3],1);
		TextDrawBoxColor(Effects[3],0xffffffcc);
		TextDrawTextSize(Effects[3],652.000000,0.000000);
		TextDrawAlignment(Effects[3],0);
		TextDrawBackgroundColor(Effects[3],0x000000ff);
		TextDrawFont(Effects[3],3);
		TextDrawLetterSize(Effects[3],-0.000000,8.500000);
		TextDrawColor(Effects[3],0xffffffff);
		TextDrawSetOutline(Effects[3],1);
		TextDrawSetProportional(Effects[3],1);
		TextDrawSetShadow(Effects[3],1);

		Effects[4] = TextDrawCreate(1.000000,1.000000,"~N~~N~~N~~N~");
		TextDrawUseBox(Effects[4],1);
		TextDrawBoxColor(Effects[4],0xffff00cc);
		TextDrawTextSize(Effects[4],644.000000,451.000000);
		TextDrawAlignment(Effects[4],0);
		TextDrawBackgroundColor(Effects[4],0x000000ff);
		TextDrawFont(Effects[4],3);
		TextDrawLetterSize(Effects[4],-0.000000,13.300000);
		TextDrawColor(Effects[4],0xffffffff);
		TextDrawSetOutline(Effects[4],1);
		TextDrawSetProportional(Effects[4],1);
		TextDrawSetShadow(Effects[4],1);

		Effects[0] = TextDrawCreate(1.000000,1.000000,"~N~~N~~N~~N~");
		TextDrawUseBox(Effects[0],1);
		TextDrawBoxColor(Effects[0],0xff0000cc);
		TextDrawTextSize(Effects[0],644.000000,451.000000);
		TextDrawAlignment(Effects[0],0);
		TextDrawBackgroundColor(Effects[0],0x000000ff);
		TextDrawFont(Effects[0],3);
		TextDrawLetterSize(Effects[0],-0.000000,13.300000);
		TextDrawColor(Effects[0],0xffffffff);
		TextDrawSetOutline(Effects[0],1);
		TextDrawSetProportional(Effects[0],1);
		TextDrawSetShadow(Effects[0],1);
//blabla other funcs

		return 1;
}

public PlayerUseDrugs( playerid ) // step 2
{
       SendClientMessage( playerid, COLOR_YELLOW, "Drugs used, Wait till they will give some effect!" );
       SetTimerEx("DrugEffect", 20000, 0, "i", playerid);
	   return 1;
}

public DrugEffect() // step 3
{
    for(new playerid = 0; playerid < MAX_PLAYERS; playerid+)
    {
    if(usedrugs[playerid] == 1) {
    TextDrawShowForPlayer(playerid, Effects[random(5)]);
    SetPlayerHealth( playerid, 100.0 );
    SetTimerEx("DrugClose", 30000, 0, "i", playerid);
    }
    else if(usedrugs[playerid] == 0) { SendClientMessage( playerid, COLOR_YELLOW, "The player you sold drugs to is stoned now." ); }
    }
    return 1;
}

public DrugClose() // step 4
{
    for(new playerid = 0; playerid < MAX_PLAYERS; playerid+)
    {
		TextDrawHideForPlayer(playerid, Effects[0]);
		TextDrawHideForPlayer(playerid, Effects[1]);
		TextDrawHideForPlayer(playerid, Effects[2]);
		TextDrawHideForPlayer(playerid, Effects[3]);
		TextDrawHideForPlayer(playerid, Effects[4]);
	}
	return 1;
}


public IsStr( cmd[], str[] )
{
       if( strcmp( cmd, str ) == 0 )return 1;
       return 0;
}
public OnPlayerCommandText(playerid, cmdtext[]) // start step -> step 1
{
		new cmd[256];

		if( IsStr( cmd, "/usedrugs" ) == 1 ) // command ^^
       {
           if( PlayerUseDrugs( playerid ) )
           usedrugs[playerid] = 1;
           return 1;
       }
		return 1;
}