warning 213: tag mismatch
#1

I can't figure out the Problem in the snippet.
PHP код:
stock PlayerPosition(playeridFloat:XFloat:YFloat:Z)
{
  new 
Float:XP,Float:YP,Float:ZP;
  
GetPlayerPos(playerid,XP,YP,ZP);
  return (
XP X) + (YP Y) + (ZP Z); //error line

Reply
#2

I've googling and found it: https://sampforum.blast.hk/showthread.php?tid=73158

You need to declare float before function name
Код:
Float:TestF(a, b) {}
Reply
#3

Sigh much errors.
Reply
#4

So, the solution didn't work? i've tried that before reply.
* You need to write the function before call it
exmpl:
PHP код:
// warning 208: function with tag result used before definition, forcing reparse
main {
    
testfunct();
}
Float:testfunct() {
    return 
0.0;
}
// So you need to do it like the image below. 
Reply
#5

So Probably you were Right. I tried it like this and its compiled:

PHP код:
forward Float:PlayerPosition(playeridFloat:XFloat:YFloat:Z);
stock Float:PlayerPosition(playeridFloat:XFloat:YFloat:Z)
{
  new 
Float:XP,Float:YP,Float:ZP;
  
GetPlayerPos(playerid,XP,YP,ZP);
  return (
XP X) + (YP Y) + (ZP Z);

=======================
Lazy to create another thread for other Errors, so have a look

Error:
Код:
error 076: syntax error in the expression, or invalid function call
PHP код:
    new Str[300];
    
format(Strsizeof(Str), "%d/%d"ClosestDisGetPlayersOnServer); //Error in GetPlayersOnServer Possibily
    
TextDrawSetString(Textdraw15Str); 
PHP код:
stock GetPlayersOnServer()
{
    new 
count;
    for(new 
x=0xMAX_PLAYERSx++)
    {
        if(
IsPlayerConnected(x)))
          {
            
count++;
          }
    }
    return 
count;

Reply
#6

//1
format(Str, sizeof(Str), "%d/%d", ClosestDis, GetPlayersOnServer());
//2
if(IsPlayerConnected(x)))

*Red - Delete it
*Blue - Add it
Reply
#7

Код:
warning 219: local variable "count" shadows a variable at a preceding level
PHP код:
stock GetPlayersOnServer()
{
    new 
count//This line
    
for(new x=0xMAX_PLAYERSx++)
    {
        if(
IsPlayerConnected(x))
          {
            
count++;
          }
    }
    return 
count;

EDIT:nvm fixed, just replace the variable name.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)