Where is the error?

Started by KrOoB_, Jul 02, 2018, 11:39 AM

Previous topic - Next topic

KrOoB_


Where is the worng ?

spam <- array(GetMaxPlayers(), 0 );

function spam(player)
{
local player=FindPlayer(player);
if(player)
{
spam[player.ID] = 1;
}
}

else if (cmd == "arava")
{
if(spam[player.ID] == 5 ) MessagePlayer("Dont Spam!",player);
else if {
spam[player.ID]++;
player.Health = 100;
NewTimer( "spam", 5000, 0, player.Name );
}



kennedyarz

#1
Quote from: KrooB on Jul 02, 2018, 11:39 AMWhere is the worng ?

spam <- array(GetMaxPlayers(), 0 );

function spam(player)
{
local player=FindPlayer(player);
if(player)
{
spam[player.ID] = 1;
}
}

else if (cmd == "arava")
{
if(spam[player.ID] == 5 ) MessagePlayer("Dont Spam!",player);
else if {
spam[player.ID]++;
player.Health = 100;
NewTimer( "spam", 5000, 0, player.Name );
}




you forgot the closing in the command

use

else if (cmd == "arava")
    {
        if(spam[player.ID] == 5 ) MessagePlayer("Dont Spam!",player);
        else
{
        spam[player.ID]++;
        player.Health = 100;
        NewTimer( "spam", 5000, 0, player.Name );
        }
}

KrOoB_

Quote from: kennedyarz on Jul 02, 2018, 12:24 PM
Quote from: KrooB on Jul 02, 2018, 11:39 AMWhere is the worng ?

spam <- array(GetMaxPlayers(), 0 );

function spam(player)
{
local player=FindPlayer(player);
if(player)
{
spam[player.ID] = 1;
}
}

else if (cmd == "arava")
{
if(spam[player.ID] == 5 ) MessagePlayer("Dont Spam!",player);
else if {
spam[player.ID]++;
player.Health = 100;
NewTimer( "spam", 5000, 0, player.Name );
}




you forgot the closing in the command

use

else if (cmd == "arava")
    {
        if(spam[player.ID] == 5 ) MessagePlayer("Dont Spam!",player);
        else if
{
        spam[player.ID]++;
        player.Health = 100;
        NewTimer( "spam", 5000, 0, player.Name );
        }
}

ERROR ->

    else if
      {

NicusorN5

There's a } missing. You will need a brain donor to fix it.

D.VICTOR

use
else if (cmd == "arava")
    {
        if(spam[player.ID] == 5 ) MessagePlayer("Dont Spam!",player);
        else
         {
        spam[player.ID]++;
        player.Health = 100;
        NewTimer( "spam", 5000, 0, player.Name );
        }
 }

KrOoB_

@D.VilCTOR its worked but I can not use the command again

D.VICTOR

I came back a short time pro vcmp I still did not remember the right functions but try this

else if (cmd == "arava")
    {
        if(spam[player.ID] == 5 ) MessagePlayer("Dont Spam!",player);
        return;
         {
        spam[player.ID]++;
        player.Health = 100;
        NewTimer( "spam", 5000, 0, player.Name );
        }
return 1;
 }

KrOoB_

Not worked bro :( but thnx for your help :)


umar4911

What you want to do? Means what should happen when player use command arava
RT Member | Asian City Scripter | CTB Contributor | VKs Contributor | European City Contributor | EAD Scripter

KrOoB_

I want to prevent the car command from being written
LIKE
- /arava
- message :your heal 100
- /arava
- message The command will be active after 5 seconds

umar4911

I cant understand what you want say
RT Member | Asian City Scripter | CTB Contributor | VKs Contributor | European City Contributor | EAD Scripter

KrOoB_

Once you have used the command, wait 5 seconds for one more command

umar4911

Quote from: KrooB on Jul 02, 2018, 07:35 PMOnce you have used the command, wait 5 seconds for one more command
add a class with a timer. When a player uses this type cmd, set the class to true and run a timer for 5 seconds which changes the value to false. Add a validation at start of the command that if that class is true, give error message otherwise continue.
RT Member | Asian City Scripter | CTB Contributor | VKs Contributor | European City Contributor | EAD Scripter

umar4911

The code is fixed
else if (cmd == "arava")
    {
        if(spam[player.ID] == 5 ) MessagePlayer("Dont Spam!",player);
        else
         {
        spam[player.ID]++;
        player.Health = 100;
        NewTimer( "spam", 5000, 0, player.Name );
        }
 }
RT Member | Asian City Scripter | CTB Contributor | VKs Contributor | European City Contributor | EAD Scripter