Author Topic: (Solved) error expected `IDENTIFIER`  (Read 717 times)

MarineForce

  • Forum User
  • ****
  • Posts: 39
  • https://youtu.be/xdCct99wlng
    • View Profile
(Solved) error expected `IDENTIFIER`
« on: March 15, 2020, 04:26:35 PM »
function 1b(p)
 {
 local p = FindPlayer(p);
  if(p){
  if(stats[p.ID].kok == false)
  {
 Announce( "~Y~ BOMB PLANTING HAS BEEN FAILED", p , 0 );
 }
 if(stats[p.ID].kok == true)
  {
 Announce( "~Y~ BOMB PLANTING 1", p , 0 );
 }
 }
}

error IDENTIFER.
« Last Edit: March 17, 2020, 10:09:52 PM by ELK »
[Elv]Sikhouland

ELK

  • Community Admin
  • Forum User
  • *****
  • Posts: 146
    • View Profile
Re: berror
« Reply #1 on: March 15, 2020, 04:52:29 PM »
A function name should not be declared starting with numeral. Though, It's not a must to-do thing but the documentation says that the function names are generally started with a letter in Squirrel. You can try declaring it:
Code: [Select]
function b1b({}) It will work! Just make sure you declare " kok " as a class.

Do please set a proper topic name next time, Thanks.

MarineForce

  • Forum User
  • ****
  • Posts: 39
  • https://youtu.be/xdCct99wlng
    • View Profile
Re: berror
« Reply #2 on: March 15, 2020, 06:19:06 PM »
give me a solution for this its so sucks. many erros

function one(p)
{
local p = FindPlayer(p);
  if(p){
  if(stats[p.ID].kok == false)
  {
 Announce( "~Y~ BOMB PLANTING HAS BEEN FAILED", p , 0 );
 }
 if(stats[p.ID].kok == true)
  {
 Announce( "~Y~ BOMB PLANTING 1", p , 0 );
 }
 }
}

function two(p)
{
local p = FindPlayer(p);
  if(p){
  if(stats[p.ID].kok == false)
  {
 Announce( "~Y~ BOMB PLANTING HAS BEEN FAILED", p , 0 );
 }
 if(stats[p.ID].kok == true)
  {
 Announce( "~Y~ BOMB PLANTING 2", p , 0 );
 }
 }
}
function three(p)
{
local p = FindPlayer(p);
  if(p){
  if(stats[p.ID].kok == false)
  {
 Announce( "~Y~ BOMB PLANTING HAS BEEN FAILED", p , 0 );
 }
 if(stats[p.ID].kok == true)
  {
 Announce( "~Y~ BOMB PLANTING 31", p , 0 );
 }
 }
}
function four(p)
{
local p = FindPlayer(p);
  if(p){
  if(stats[p.ID].kok == false)
  {
 Announce( "~Y~ BOMB PLANTING HAS BEEN FAILED", p , 0 );
 }
 if(stats[p.ID].kok == true)
  {
 Announce( "~Y~ BOMB PLANTING 4", p , 0 );
 }
 }
}
function five(p)
{
local p = FindPlayer(p);
  if(p){
  if(stats[p.ID].kok == false)
  {
 Announce( "~Y~ BOMB PLANTING HAS BEEN FAILED", p , 0 );
 }
 if(stats[p.ID].kok == true)
  {
 Announce( "~Y~ BOMB PLANTING 5", p , 0 );
 }
 }
}
function six(p)
{
local p = FindPlayer(p);
  if(p){

 if(stats[p.ID].kok == true)
  {
 Announce( "~Y~ BOMB PLANTING 1", p , 0 );
 }
   if(stats[p.ID].kok == false)
  {
 Announce( "~Y~ BOMB PLANTING HAS BEEN FAILED", p , 3 );
 }
 }
}
function seven(p)
{
local p = FindPlayer(p);
  if(p){

 if(stats[p.ID].kok == true)
  {
 Announce( "~Y~ BOMB PLANTING 1", p , 0 );
 }
   if(stats[p.ID].kok == false)
  {
 Announce( "~Y~ BOMB PLANTING HAS BEEN FAILED", p , 3 );
 }
 }
}
function eight(p)
{
local p = FindPlayer(p);
  if(p){

 if(stats[p.ID].kok == true)
  {
 Announce( "~Y~ BOMB PLANTING 1", p , 3 );
 }
  if(stats[p.ID].kok == false)
  {
 Announce( "~Y~ BOMB PLANTING HAS BEEN FAILED", p , 3 );
 }
 }
}function nine(p)
{
local p = FindPlayer(p);
  if(p){
  if(stats[p.ID].kok == false)
  {
 Announce( "~Y~ BOMB PLANTING HAS BEEN FAILED", p , 0 );
 }
 if(stats[p.ID].kok == true)
  {
 Announce( "~Y~ BOMB PLANTING 1", p , 0 );
 }
 }
}
function ten(p)
{
local p = FindPlayer(p);
  if(p){
  if(stats[p.ID].kok == false)
  {
 Announce( "~Y~ BOMB PLANTING HAS BEEN FAILED", p , 0 );
 }
 if(stats[p.ID].kok == true)
  {
 Announce( "~Y~ BOMB BLASTED!", p , 2 );
 }
 }
}


function ann2(player)
{
for (local i=0; i<GetMaxPlayers(); i++)
{
local player=FindPlayer(i);
if(player)
Announce( "~y~PLANTING BOMB", player , 6 )
stats[player.ID].kok = true;
 NewTimer( "ten",10000, 1, player.ID );
 NewTimer( "nine", 9000, 1, player.ID );
 NewTimer( "eight", 8000, 1, player.ID );
 NewTimer( "seven", 7000, 1, player.ID );
 NewTimer( "six", 6000, 1, player.ID );
 NewTimer( "five", 5000, 1, player.ID );
 NewTimer( "four", 4000, 1, player.ID );
 NewTimer( "three", 3000, 1, player.ID );
 NewTimer( "two", 2000, 1, player.ID );
 NewTimer( "one", 1000, 1, player.ID );
}
}
[Elv]Sikhouland

ELK

  • Community Admin
  • Forum User
  • *****
  • Posts: 146
    • View Profile
Re: error expected `IDENTIFIER`
« Reply #3 on: March 15, 2020, 06:51:39 PM »
Putting whatever errors you are getting aside, why would you create so many functions for a countdown?
Code: [Select]
switch (countdown){
   case one:
      your code
   break;
   case 2:
      your code
   break;
}

MarineForce

  • Forum User
  • ****
  • Posts: 39
  • https://youtu.be/xdCct99wlng
    • View Profile
Re: error expected `IDENTIFIER`
« Reply #4 on: March 17, 2020, 09:47:00 PM »
when i minus the score it shows me -1

Cubans--;
if score is 0 then if i minus it shows me -1 plz give me solution
[Elv]Sikhouland

ELK

  • Community Admin
  • Forum User
  • *****
  • Posts: 146
    • View Profile
Re: error expected `IDENTIFIER`
« Reply #5 on: March 17, 2020, 10:09:26 PM »
when i minus the score it shows me -1

Cubans--;
if score is 0 then if i minus it shows me -1 plz give me solution

You simply need to add a check on score if it's "0" then do nothing, else score--
I'm locking this topic since it was replied for what it was created.