error 010: invalid function or declaration
#1

Code
PHP код:
F:\SAMP\samp037_svr_R2-1-1_win32\gamemodes\bare.pwn(149) : error 010invalid function or declaration
F
:\SAMP\samp037_svr_R2-1-1_win32\gamemodes\bare.pwn(151) : error 010invalid function or declaration
F
:\SAMP\samp037_svr_R2-1-1_win32\gamemodes\bare.pwn(156) : error 010invalid function or declaration
F
:\SAMP\samp037_svr_R2-1-1_win32\gamemodes\bare.pwn(158) : error 010invalid function or declaration
F
:\SAMP\samp037_svr_R2-1-1_win32\gamemodes\bare.pwn(165) : error 010invalid function or declaration
Pawn compiler 3.2.3664              Copyright 
(c1997-2006ITB CompuPhase
5 Errors

Code
PHP код:
public OnPlayerUpdate(playerid)
{
    if(
twotime[playerid]!=0)
    {
        if(
gettime()-twotime[playerid]>=10000)
        {
            
twotime[playerid]=0;
            
SetPlayerPos(playerid,-318.32691519.231375.2519);
        }
        else
        {
            if(
IsPlayerInRangeOfPoint(playerid,150,1205.0674, -8.39711000.6484)==0)
            {
                
SetPlayerPos(playerid,1205.0674, -8.39711000.6484);
                
SetPlayerInterior(playerid,2);
            }
        }
    }
    return 
1;

PHP код:
#include <a_samp>
#include <core>
#include <float>
//皮卡
new pickupone;
new 
pickuptwo;
new 
pickupthree;
new 
pickupfour;
//玩家变量
new onetime[MAX_PLAYERS];
new 
twotime[MAX_PLAYERS];
#pragma tabsize 0
main()
{
    print(
"\n----------------------------------");
    print(
"  Bare Script\n");
    print(
"----------------------------------\n");
}
public 
OnPlayerConnect(playerid)
{
    
GameTextForPlayer(playerid,"~w~SA-MP: ~r~Bare Script",5000,5);
    
onetime[playerid]=0;
    
twotime[playerid]=0;
    return 
1;
}
public 
OnPlayerCommandText(playeridcmdtext[])
{
    new 
idx;
    new 
cmd[256];
    
cmd strtok(cmdtextidx);
    if(
strcmp(cmd"/yadayada"true) == 0) {
        return 
1;
    }
    return 
0;
}
public 
OnPlayerSpawn(playerid)
{
    
SetPlayerInterior(playerid,0);
    
TogglePlayerClock(playerid,0);
    return 
1;
}
public 
OnPlayerDeath(playeridkilleridreason)
{
       return 
1;
}
SetupPlayerForClassSelection(playerid)
{
     
SetPlayerInterior(playerid,14);
    
SetPlayerPos(playerid,258.4893,-41.4008,1002.0234);
    
SetPlayerFacingAngle(playerid270.0);
    
SetPlayerCameraPos(playerid,256.0815,-43.0475,1004.0234);
    
SetPlayerCameraLookAt(playerid,258.4893,-41.4008,1002.0234);
}
public 
OnPlayerRequestClass(playeridclassid)
{
    
SetupPlayerForClassSelection(playerid);
    return 
1;
}
public 
OnGameModeInit()
{
    
SetGameModeText("Bare Script");
    
ShowPlayerMarkers(1);
    
ShowNameTags(1);
    
AllowAdminTeleport(1);
    
AddPlayerClass(265,1958.3783,1343.1572,15.3746,270.1425,0,0,0,0,-1,-1);
    
pickupone CreatePickup(1318,23,-314.83531514.957975.2519);//进入KTV
    
pickuptwo CreatePickup(1318,23,-2636.71971402.8058906.2675);//离开KTV
    
pickupthree CreatePickup(1318,23,-318.06201513.940775.2519);//进入KTV2
    
pickupfour CreatePickup(1318,23,1205.0782, -12.06141000.6484);//离开KTV2
     
Create3DTextLabel("进入KTV"0x008080FF, -314.83531514.957975.25191500);
     
Create3DTextLabel("离开KTV"0x008080FF, -2636.71971402.8058906.26751500);
     
Create3DTextLabel("进入KTV2"0x008080FF, -318.06201513.940775.25191500);
     
Create3DTextLabel("离开KTV2"0x008080FF1205.0782, -12.06141000.64841500);
    return 
1;
}
public 
OnPlayerPickUpPickup(playerid,pickupid)
{
    if(
pickupid == pickupone)
    {
        
onetime[playerid]=gettime();
        
SetPlayerPos(playerid,-2636.62721406.4064906.2675);
        
SetPlayerInterior(playerid,3);
        
GameTextForPlayer(playerid,"~r~Welcome to the ktv",4000,2);
    }
    if(
pickupid == pickuptwo)
    {
        if(
onetime[playerid]!=0)
        {
            
onetime[playerid]=0;
            
SetPlayerPos(playerid,-315.17151519.659975.2519);
            
SetPlayerInterior(playerid,0);
            
GameTextForPlayer(playerid,"~r~Welcome back",4000,2);
        }
    }
    if(
pickupid == pickupthree)
    {
        
twotime[playerid]=gettime();
        
SetPlayerPos(playerid,1205.0674, -8.39711000.6484);
        
SetPlayerInterior(playerid,2);
        
GameTextForPlayer(playerid,"~r~Welcome to the ktv two",4000,2);
    }
    if(
pickupid == pickupfour)
    {
        if(
twotime[playerid]!=0)
        {
            
twotime[playerid]=0;
            
SetPlayerPos(playerid,-318.32691519.231375.2519);
            
SetPlayerInterior(playerid,0);
            
GameTextForPlayer(playerid,"~r~Welcome back",4000,2);
        }
    }
}
public 
OnPlayerUpdate(playerid)
{
    if(
onetime[playerid]!=0)
    {
        if(
gettime()-onetime[playerid]>=10000)
        {
            
onetime[playerid]=0;
            
SetPlayerPos(playerid,-315.17151519.659975.2519);
        }
        else
        {
            if(
IsPlayerInRangeOfPoint(playerid,150,-2636.62721406.4064906.2675)==0)
            {
                
SetPlayerPos(playerid,-2636.62721406.4064906.2675);
                
SetPlayerInterior(playerid,3);
            }
        }
    }
    return 
1;
}
    if(
twotime[playerid]!=0)
    {
        if(
gettime()-twotime[playerid]>=10000)
        {
            
twotime[playerid]=0;
            
SetPlayerPos(playerid,-318.32691519.231375.2519);
        }
        else
        {
            if(
IsPlayerInRangeOfPoint(playerid,150,1205.0674, -8.39711000.6484)==0)
            {
                
SetPlayerPos(playerid,1205.0674, -8.39711000.6484);
                
SetPlayerInterior(playerid,2);
            }
        }
    }
    return 
1;
}
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;

Reply
#2

Please number which lines are what.
Reply
#3

Is pickup teleport
Reply
#4

I created these Is pickups teleport, if the player died, raised him to the corresponding internal pickup
Reply
#5

Right, so where you have OnPlayerUpdate, you've got a return, finish that callabck, then seem to have added a heap more in nothingness.

PHP код:
public OnPlayerUpdate(playerid)
{
    if(
onetime[playerid]!=0)
    {
        if(
gettime()-onetime[playerid]>=10000)
        {
            
onetime[playerid]=0;
            
SetPlayerPos(playerid,-315.17151519.659975.2519);
        }
        else
        {
            if(
IsPlayerInRangeOfPoint(playerid,150,-2636.62721406.4064906.2675)==0)
            {
                
SetPlayerPos(playerid,-2636.62721406.4064906.2675);
                
SetPlayerInterior(playerid,3);
            }
        }
    }
    return 
1;
}     
//<------ Error lies here.
    
if(twotime[playerid]!=0)   //<--- This code, is in the wrong spot, and everything below it, is also having trouble due to it. That is, up until strtok is made.
    

And just to say, thanks for starting to post up code as advised

See, you're learning already... xD
Reply
#6

Quote:
Originally Posted by Sew_Sumi
Посмотреть сообщение
Right, so where you have OnPlayerUpdate, you've got a return, finish that callabck, then seem to have added a heap more in nothingness.

PHP код:
public OnPlayerUpdate(playerid)
{
    if(
onetime[playerid]!=0)
    {
        if(
gettime()-onetime[playerid]>=10000)
        {
            
onetime[playerid]=0;
            
SetPlayerPos(playerid,-315.17151519.659975.2519);
        }
        else
        {
            if(
IsPlayerInRangeOfPoint(playerid,150,-2636.62721406.4064906.2675)==0)
            {
                
SetPlayerPos(playerid,-2636.62721406.4064906.2675);
                
SetPlayerInterior(playerid,3);
            }
        }
    }
    return 
1;
}     
//<------ Error lies here.
    
if(twotime[playerid]!=0)   //<--- This code, is in the wrong spot, and everything below it, is also having trouble due to it. That is, up until strtok is made.
    

And just to say, thanks for starting to post up code as advised

See, you're learning already... xD
So how can I do
Reply
#7

Quote:
Originally Posted by oppo1234
Посмотреть сообщение
So how can I do
PHP код:
public OnPlayerUpdate(playerid

    if(
onetime[playerid]!=0
    { 
        if(
gettime()-onetime[playerid]>=10000
        { 
            
onetime[playerid]=0
            
SetPlayerPos(playerid,-315.17151519.659975.2519); 
        } 
        else 
        { 
            if(
IsPlayerInRangeOfPoint(playerid,150,-2636.62721406.4064906.2675)==0
            { 
                
SetPlayerPos(playerid,-2636.62721406.4064906.2675); 
                
SetPlayerInterior(playerid,3); 
            } 
        } 
    } 
//<--- Notice the return and the remaining } are gone.
    
if(twotime[playerid]!=0
    { 
        if(
gettime()-twotime[playerid]>=10000
        { 
            
twotime[playerid]=0
            
SetPlayerPos(playerid,-318.32691519.231375.2519); 
        } 
        else 
        { 
            if(
IsPlayerInRangeOfPoint(playerid,150,1205.0674, -8.39711000.6484)==0
            { 
                
SetPlayerPos(playerid,1205.0674, -8.39711000.6484); 
                
SetPlayerInterior(playerid,2); 
            } 
        } 
    } 
    return 
1

All you needed to do was remove the return 1, and the last brace ( } ), and it'll be fixed.

It's good to see you are using good indentation.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)