SA-MP Forums Archive
Scripting Error - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Scripting Error (/showthread.php?tid=106619)



Scripting Error - Pantontini - 04.11.2009

C:\Users\Mike\Desktop\Server\gamemodes\PTPM.pwn(29 : error 002: only a single statement (or expression) can follow each "case"
C:\Users\Mike\Desktop\Server\gamemodes\PTPM.pwn(29 : warning 215: expression has no effect

Код:
 }
    SetCameraBehindPlayer(playerid);
    return 1;
    }

C:\Users\Mike\Desktop\Server\gamemodes\PTPM.pwn(77 : warning 203: symbol is never used: "strtok"
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase

Код:
{
	new i, li;
	new aNum;
	new len;
	while(i <= strlen(strsrc)){
	  if(strsrc[i]==delimiter || i==strlen(strsrc)){
	    len = strmid(strdest[aNum], strsrc, li, i, 128);
	    strdest[aNum][len] = 0;
	    li = i+1;
	    aNum++;
		}
		i++;
	}
	return 1;
777	} // Script Ends Here
778
1 Error.


Re: Scripting Error - Benne - 04.11.2009

At the last error Try add this: "#pragma unused strtok" at the top.

Or else try this:


pawn Код:
strtok(const string[], &index)
{
    new length = strlen(string);
    while ((index < length) && (string[index] <= ' '))
    {
        index++;
    }

    new offset = index;
    new result[20];
    while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))
    {
        result[index - offset] = string[index];
        index++;
    }
    result[index - offset] = EOS;
    return result;
}



Re: Scripting Error - MadeMan - 04.11.2009

Show the whole code for the first error.


Re: Scripting Error - Pantontini - 04.11.2009

Quote:
Originally Posted by Benne
At the last error Try add this: "#pragma unused strtok" at the top.

Or else try this:


pawn Код:
strtok(const string[], &index)
{
    new length = strlen(string);
    while ((index < length) && (string[index] <= ' '))
    {
        index++;
    }

    new offset = index;
    new result[20];
    while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))
    {
        result[index - offset] = string[index];
        index++;
    }
    result[index - offset] = EOS;
    return result;
}
The first one dosen't works
The second one I dont know where to put it...


Re: Scripting Error - Pantontini - 05.11.2009

Quote:
Originally Posted by MadeMan
Show the whole code for the first error.
Код:
case Hitman:
   	{
      SetPlayerPos(playerid, -2721.3049,-317.2299,7.8438);
      SetPlayerFacingAngle(playerid, 45.857);
      SetPlayerColor(playerid, TEAMCOLOR_VPM);

    }
    SetCameraBehindPlayer (playerid);
    return 1;



Re: Scripting Error - Daren_Jacobson - 06.11.2009

close the switch before you set camera. or else put the camera setting in the brackets.


Re: Scripting Error - Pantontini - 07.11.2009

Quote:
Originally Posted by Daren_Jacobson
close the switch before you set camera. or else put the camera setting in the brackets.
I'm a noob scripter, how it would be?


Re: Scripting Error - Daren_Jacobson - 07.11.2009

pawn Код:
switch(spawntype) //should be different for your script
{
  case Hitman:
  {
    SetPlayerPos(playerid, -2721.3049,-317.2299,7.8438);
    SetPlayerFacingAngle(playerid, 45.857);
    SetPlayerColor(playerid, TEAMCOLOR_VPM);
  }
}
SetCameraBehindPlayer (playerid);
return 1;



Re: Scripting Error - Pantontini - 07.11.2009

Код:
C:\Users\Daniel\Desktop\Server\gamemodes\PTPM.pwn(293) : warning 217: loose indentation
C:\Users\Daniel\Desktop\Server\gamemodes\PTPM.pwn(294) : error 014: invalid statement; not in switch
C:\Users\Daniel\Desktop\Server\gamemodes\PTPM.pwn(294) : warning 215: expression has no effect
C:\Users\Daniel\Desktop\Server\gamemodes\PTPM.pwn(294) : error 001: expected token: ";", but found ":"
C:\Users\Daniel\Desktop\Server\gamemodes\PTPM.pwn(294) : error 029: invalid expression, assumed zero
C:\Users\Daniel\Desktop\Server\gamemodes\PTPM.pwn(294) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


5 Errors.
It looks like this


Код:
{
     case HITMAN:
  {
    SetPlayerPos(playerid, -2721.3049,-317.2299,7.8438);
    SetPlayerFacingAngle(playerid, 45.857);
    SetPlayerColor(playerid, TEAMCOLOR_VPM);
  }
}
SetCameraBehindPlayer (playerid);
return 1;



Re: Scripting Error - MadeMan - 07.11.2009

Show the whole callback (I guess it's OnPlayerSpawn).