Vice City: Multiplayer

Server Development => Scripting and Server Management => Script and Content Requests => Topic started by: KrOoB_ on Jul 02, 2018, 11:39 AM

Title: Where is the error?
Post by: KrOoB_ on Jul 02, 2018, 11:39 AM

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 );
}


Title: Re: Where is the error?
Post by: 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
{
        spam[player.ID]++;
        player.Health = 100;
        NewTimer( "spam", 5000, 0, player.Name );
        }
}
Title: Re: Where is the error?
Post by: KrOoB_ on Jul 02, 2018, 12:46 PM
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
      {
Title: Re: Where is the error?
Post by: NicusorN5 on Jul 02, 2018, 12:51 PM
There's a } missing. You will need a brain donor to fix it.
Title: Re: Where is the error?
Post by: D.VICTOR on Jul 02, 2018, 12:53 PM
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 );
        }
 }
Title: Re: Where is the error?
Post by: KrOoB_ on Jul 02, 2018, 12:59 PM
@D.VilCTOR its worked but I can not use the command again
Title: Re: Where is the error?
Post by: D.VICTOR on Jul 02, 2018, 01:10 PM
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;
 }
Title: Re: Where is the error?
Post by: KrOoB_ on Jul 02, 2018, 01:20 PM
Not worked bro :( but thnx for your help :)
Title: Re: Where is the error?
Post by: D.VICTOR on Jul 02, 2018, 01:22 PM
Okay
Title: Re: Where is the error?
Post by: umar4911 on Jul 02, 2018, 02:59 PM
What you want to do? Means what should happen when player use command arava
Title: Re: Where is the error?
Post by: KrOoB_ on Jul 02, 2018, 03:19 PM
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
Title: Re: Where is the error?
Post by: umar4911 on Jul 02, 2018, 07:31 PM
I cant understand what you want say
Title: Re: Where is the error?
Post by: KrOoB_ on Jul 02, 2018, 07:35 PM
Once you have used the command, wait 5 seconds for one more command
Title: Re: Where is the error?
Post by: umar4911 on Jul 02, 2018, 07:52 PM
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.
Title: Re: Where is the error?
Post by: umar4911 on Jul 03, 2018, 06:15 AM
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 );
        }
 }