help with this error (admin)
#1

ERRORS:
PHP код:
C:\Users\Kevin11\Desktop\server freeroam\gamemodes\freeroam.pwn(165) : error 017undefined symbol "strtok"
C:\Users\Kevin11\Desktop\server freeroam\gamemodes\freeroam.pwn(165) : error 033: array must be indexed (variable "tmp")
C:\Users\Kevin11\Desktop\server freeroam\gamemodes\freeroam.pwn(175) : error 017undefined symbol "strtok"
C:\Users\Kevin11\Desktop\server freeroam\gamemodes\freeroam.pwn(175) : error 033: array must be indexed (variable "tmp")
C:\Users\Kevin11\Desktop\server freeroam\gamemodes\freeroam.pwn(184) : error 017undefined symbol "name"
C:\Users\Kevin11\Desktop\server freeroam\gamemodes\freeroam.pwn(184) : error 017undefined symbol "name"
C:\Users\Kevin11\Desktop\server freeroam\gamemodes\freeroam.pwn(184) : error 029invalid expressionassumed zero
C
:\Users\Kevin11\Desktop\server freeroam\gamemodes\freeroam.pwn(184) : fatal error 107too many error messages on one line
Compilation aborted
.Pawn compiler 3.2.3664              Copyright (c1997-2006ITB CompuPhase
8 Errors

Script:
PHP код:
tmp strtok(cmdtextidx);
        
        if(!
strlen(tmp)){
        
SendClientMessage(playeridCOLOR_RED".:ERRORE:. UTILIZZA: /settadmin [playerid][livello]");
        return 
1;
        }
        
id strval(tmp);
        if(!
IsPlayerConnected(id)){
        
SendClientMessage(playeridCOLOR_RED".:ERRORE:. Il Giocatore non и connesso");
        return 
1;}
        
tmp strtok(cmdtextidx);
        if(!
strlen(tmp)) {
        
SendClientMessage(playeridCOLOR_RED".:ERRORE:. UTILIZZA: /settadmin [playerid][livello]");
        return 
1;}
        
lvadmin strval(tmp);
        if((
lvadmin != 0) && (lvadmin != 1) && (lvadmin != 2) && (lvadmin != 3)){
        
SendClientMessage(playeridCOLOR_YELLOW".:ATTENZIONE:. I livello sono 0 / 1 / 2 / 3");
        return 
1;}
        new 
name2[MAX_PLAYER_NAME];
        
GetPlayerName(playerid,name,sizeof(name)); 
Reply
#2

Do you have this in your script?
if no add it:

PHP код:
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
#3

Код:
        new name2[MAX_PLAYER_NAME]; 
        GetPlayerName(playerid,name2,sizeof(name2));
Devi definire 'tmp' anche.

Ciaoo.
Reply
#4

Guys fix for me I can not fix
Script
PHP код:
//INCLUDE
#include <a_samp>
#include <dini>
//new
new nome[25];
new 
stringa[250];
enum Giocatore1{Livello,Uccisioni,Morti,Loggato};
new 
Giocatore[MAX_PLAYERS][Giocatore1];

//define
#define DIALOGREG 1060
#define DIALOGLOGIN 1061
#define COLOR_GREY 0xAFAFAFAA
#define COLOR_GREEN 0x33AA33AA
#define COLOR_RED 0xAA3333AA
#define COLOR_YELLOW 0xFFFF00AA
#define COLOR_WHITE 0xFFFFFFAA
#define COLOR_BLUE 0x0000BBAA
#define COLOR_LIGHTBLUE 0x33CCFFAA
#define COLOR_ORANGE 0xFF9900AA
#define COLOR_RED 0xAA3333AA
#define COLOR_LIME 0x10F441AA
#define COLOR_MAGENTA 0xFF00FFFF
#define COLOR_NAVY 0x000080AA
#define COLOR_AQUA 0xF0F8FFAA
#define COLOR_CRIMSON 0xDC143CAA
#define COLOR_FLBLUE 0x6495EDAA
#define COLOR_BISQUE 0xFFE4C4AA
#define COLOR_BLACK 0x000000AA
#define COLOR_CHARTREUSE 0x7FFF00AA
#define COLOR_BROWN 0XA52A2AAA
#define COLOR_CORAL 0xFF7F50AA
#define COLOR_GOLD 0xB8860BAA
#define COLOR_GREENYELLOW 0xADFF2FAA
#define COLOR_INDIGO 0x4B00B0AA
#define COLOR_IVORY 0xFFFF82AA
#define COLOR_LAWNGREEN 0x7CFC00AA
#define COLOR_SEAGREEN 0x20B2AAAA
#define COLOR_LIMEGREEN 0x32CD32AA //<--- Dark lime
#define COLOR_MIDNIGHTBLUE 0X191970AA
#define COLOR_MAROON 0x800000AA
#define COLOR_OLIVE 0x808000AA
#define COLOR_ORANGERED 0xFF4500AA
#define COLOR_PINK 0xFFC0CBAA // - Light light pink
#define COLOR_SPRINGGREEN 0x00FF7FAA
#define COLOR_TOMATO 0xFF6347AA // - Tomato >:/ sounds wrong lol... well... :P
#define COLOR_YELLOWGREEN 0x9ACD32AA //- like military green
#define COLOR_MEDIUMAQUA 0x83BFBFAA
#define COLOR_MEDIUMMAGENTA 0x8B008BAA // dark magenta ^^
//enum
enum gAdmin
{
  
Livello,
}

new 
Player[MAX_PLAYERS][gAdmin];
#if defined FilterScript
public OnFilterScriptInit()
{
    print(
"\n--------------------------------------");
    print(
" edwardstone");
    print(
"--------------------------------------\n");
    return 
1;
}

public 
OnFilterScriptExit()
{
    return 
1;
}

#else

main()
{
    print(
"\n----------------------------------");
    print(
" edwardstone");
    print(
"----------------------------------\n");
}

#endif

public OnGameModeInit()
{
    
// Don't use these lines if it's a filterscript
    
SetGameModeText("edwardstone");
    
AddPlayerClass(01958.37831343.157215.3746269.1425000000);
    return 
1;
}

public 
OnGameModeExit()
{
    return 
1;
}

public 
OnPlayerRequestClass(playeridclassid)
{
    
SetPlayerPos(playerid1958.37831343.157215.3746);
    
SetPlayerCameraPos(playerid1958.37831343.157215.3746);
    
SetPlayerCameraLookAt(playerid1958.37831343.157215.3746);
    return 
1;
}

public 
OnPlayerConnect(playerid)
{
    
Player[playerid][Livello] = 0;
    
GetPlayerName(playerid,nome,sizeof(nome));
    
format(stringa,sizeof(stringa),"Utenti/%s",nome);
    if(!
dini_Exists(stringa)) //Controlla se il file non esiste
    
ShowPlayerDialog(playerid,DIALOGREG,DIALOG_STYLE_INPUT,"Registrazione","Benvenuto nel server.Immetti la password per registrarti","Registrati","");
    else 
//Se il file esiste
    
ShowPlayerDialog(playerid,DIALOGLOGIN,DIALOG_STYLE_INPUT,"Login","Bentornato nel server.Immetti la tua password per loggarti","Login","");
    return 
1;
}

public 
OnPlayerDisconnect(playerid)
{
    if(!
Giocatore[playerid][Loggato]) return 1//Se il giocatore non и loggato non salva i dati
    
GetPlayerName(playerid,nome,sizeof(nome));
    
format(stringa,sizeof(stringa),"Utenti/%s",nome);
    
dini_IntSet(stringa,"Livello",Giocatore[playerid][Livello]);//Salva tutti i valori che ci interessano
    
dini_IntSet(stringa,"Morti",Giocatore[playerid][Morti]);
    
dini_IntSet(stringa,"Uccisioni",Giocatore[playerid][Uccisioni]);
    
Giocatore[playerid][Loggato]=0;//Cancelliamo lo status loggato per il player
    
return 1;
}

public 
OnPlayerSpawn(playerid)
{
    return 
1;
}

public 
OnPlayerDeath(playeridkilleridreason)
{
    
Giocatore[playerid][Morti]++;//Aumentiamo il valore dei dati da salvare
    
Giocatore[killerid][Uccisioni]++;
    return 
1;
}

public 
OnVehicleSpawn(vehicleid)
{
    return 
1;
}

public 
OnVehicleDeath(vehicleidkillerid)
{
    return 
1;
}

public 
OnPlayerText(playeridtext[])
{
    return 
1;
}

public 
OnPlayerCommandText(playeridcmdtext[])
{
    if (
strcmp("/settadmin"cmdtexttrue10) == 0)
    {
        if((
IsPlayerAdmin(playerid) == 1) || (Player[playerid][Livello] == 3))
        {
        new 
name2[MAX_PLAYER_NAME];
        
GetPlayerName(playerid,name2,sizeof(name2));
        new 
tmp[256];
        new     
id;
        new 
lvadmin;
        
tmp strtok(cmdtextidx);
        
        if(!
strlen(tmp)){
        
SendClientMessage(playeridCOLOR_RED".:ERRORE:. UTILIZZA: /settadmin [playerid][livello]");
        return 
1;
        }
        
id strval(tmp);
        if(!
IsPlayerConnected(id)){
        
SendClientMessage(playeridCOLOR_RED".:ERRORE:. Il Giocatore non и connesso");
        return 
1;}
        
tmp strtok(cmdtextidx);
        if(!
strlen(tmp)) {
        
SendClientMessage(playeridCOLOR_RED".:ERRORE:. UTILIZZA: /settadmin [playerid][livello]");
        return 
1;}
        
lvadmin strval(tmp);
        if((
lvadmin != 0) && (lvadmin != 1) && (lvadmin != 2) && (lvadmin != 3)){
        
SendClientMessage(playeridCOLOR_YELLOW".:ATTENZIONE:. I livello sono 0 / 1 / 2 / 3");
        return 
1;}
        new 
name2[MAX_PLAYER_NAME];
        
GetPlayerName(playerid,name,sizeof(name));
        
GetPlayerName(idname2sizeof(name2));
        
format(stringsizeof(string), ".:ESEGUITO:. %s ha settato il livello admin di %s in %d",namename2lvadmin);
        
Player[id][Livello] = lvadmin;
        
SendClientMessageToAll(COLOR_REDstring);
        return 
1;
        }
        else{
        
SendClientMessage(playeridCOLOR_RED".:ERROR:. Non puoi utilizzare questo comando");}
        return 
1;
        }
        
public 
OnPlayerEnterVehicle(playeridvehicleidispassenger)
{
    return 
1;
}

public 
OnPlayerExitVehicle(playeridvehicleid)
{
    return 
1;
}

public 
OnPlayerStateChange(playeridnewstateoldstate)
{
    return 
1;
}

public 
OnPlayerEnterCheckpoint(playerid)
{
    return 
1;
}

public 
OnPlayerLeaveCheckpoint(playerid)
{
    return 
1;
}

public 
OnPlayerEnterRaceCheckpoint(playerid)
{
    return 
1;
}

public 
OnPlayerLeaveRaceCheckpoint(playerid)
{
    return 
1;
}

public 
OnRconCommand(cmd[])
{
    return 
1;
}

public 
OnPlayerRequestSpawn(playerid)
{
    return 
1;
}

public 
OnObjectMoved(objectid)
{
    return 
1;
}

public 
OnPlayerObjectMoved(playeridobjectid)
{
    return 
1;
}

public 
OnPlayerPickUpPickup(playeridpickupid)
{
    return 
1;
}

public 
OnVehicleMod(playeridvehicleidcomponentid)
{
    return 
1;
}

public 
OnVehiclePaintjob(playeridvehicleidpaintjobid)
{
    return 
1;
}

public 
OnVehicleRespray(playeridvehicleidcolor1color2)
{
    return 
1;
}

public 
OnPlayerSelectedMenuRow(playeridrow)
{
    return 
1;
}

public 
OnPlayerExitedMenu(playerid)
{
    return 
1;
}

public 
OnPlayerInteriorChange(playeridnewinterioridoldinteriorid)
{
    return 
1;
}

public 
OnPlayerKeyStateChange(playeridnewkeysoldkeys)
{
    return 
1;
}

public 
OnRconLoginAttempt(ip[], password[], success)
{
    return 
1;
}

public 
OnPlayerUpdate(playerid)
{
    return 
1;
}

public 
OnPlayerStreamIn(playeridforplayerid)
{
    return 
1;
}

public 
OnPlayerStreamOut(playeridforplayerid)
{
    return 
1;
}

public 
OnVehicleStreamIn(vehicleidforplayerid)
{
    return 
1;
}

public 
OnVehicleStreamOut(vehicleidforplayerid)
{
    return 
1;
}

public 
OnDialogResponse(playeriddialogidresponselistiteminputtext[])
{
    if(
dialogid==DIALOGREG) {
       if(!
response)return Kick(playerid); //kicka il player se salta la registrazione
       
if(!strlen(inputtext))return
       
ShowPlayerDialog(playerid,DIALOGREG,DIALOG_STYLE_INPUT,"Registrazione","INSERISCI UNA PASSWORD\nImmetti una password per registrarti","Registrati","");
       
GetPlayerName(playerid,nome,sizeof(nome));
       
format(stringa,sizeof(stringa),"Utenti/%s",nome);
       
dini_Create(stringa); //Crea il file per l'account utente
       
dini_IntSet(stringa,"Livello",0);
       
dini_IntSet(stringa,"Uccisioni",0);
       
dini_IntSet(stringa,"Morti",0);
       
dini_Set(stringa,"Password",inputtext);
       
ShowPlayerDialog(playerid,DIALOGLOGIN,DIALOG_STYLE_INPUT,"Login","Ora sei registrato.Immetti la password per loggarti","Login","");
    }
    if(
dialogid==DIALOGLOGIN){
       if(!
response )return Kick(playerid); //kicka il player che nn logga
       
GetPlayerName(playerid,nome,sizeof(nome));
       
format(stringa,sizeof(stringa),"Utenti/%s",nome);
       new 
Pass[250];
       
format(Pass,sizeof Pass,"%s",dini_Get(stringa,"Password"));
       if(
strcmp(Pass,inputtext,true)||!strlen(inputtext)) { //controlla se la password и corretta
           
ShowPlayerDialog(playerid,DIALOGLOGIN,DIALOG_STYLE_INPUT,"Login","PASSWORD ERRATA\nImmetti la password per loggarti","Login","");
           return 
1;
       }
       
Giocatore[playerid][Livello]=dini_Int(stringa,"Livello");//Qui carica i dati del giocatore
       
Giocatore[playerid][Morti]=dini_Int(stringa,"Morti");
       
Giocatore[playerid][Uccisioni]=dini_Int(stringa,"Uccisioni");
       
Giocatore[playerid][Loggato]=1//Ci servirа quando si disconnetterа
    
}
    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;


Error:
PHP код:
C:\Users\Kevin11\Desktop\server freeroam\gamemodes\freeroam.pwn(165) : error 017undefined symbol "strtok"
C:\Users\Kevin11\Desktop\server freeroam\gamemodes\freeroam.pwn(165) : error 033: array must be indexed (variable "tmp")
C:\Users\Kevin11\Desktop\server freeroam\gamemodes\freeroam.pwn(169) : error 079inconsistent return types (array & non-array)
C:\Users\Kevin11\Desktop\server freeroam\gamemodes\freeroam.pwn(174) : error 079inconsistent return types (array & non-array)
C:\Users\Kevin11\Desktop\server freeroam\gamemodes\freeroam.pwn(175) : error 017undefined symbol "strtok"
C:\Users\Kevin11\Desktop\server freeroam\gamemodes\freeroam.pwn(175) : error 033: array must be indexed (variable "tmp")
C:\Users\Kevin11\Desktop\server freeroam\gamemodes\freeroam.pwn(178) : error 079inconsistent return types (array & non-array)
C:\Users\Kevin11\Desktop\server freeroam\gamemodes\freeroam.pwn(182) : error 079inconsistent return types (array & non-array)
C:\Users\Kevin11\Desktop\server freeroam\gamemodes\freeroam.pwn(183) : error 021symbol already defined"name2"
C:\Users\Kevin11\Desktop\server freeroam\gamemodes\freeroam.pwn(184) : error 017undefined symbol "name"
C:\Users\Kevin11\Desktop\server freeroam\gamemodes\freeroam.pwn(184) : error 017undefined symbol "name"
C:\Users\Kevin11\Desktop\server freeroam\gamemodes\freeroam.pwn(184) : error 029invalid expressionassumed zero
C
:\Users\Kevin11\Desktop\server freeroam\gamemodes\freeroam.pwn(184) : fatal error 107too many error messages on one line

Compilation aborted
.Pawn compiler 3.2.3664              Copyright (c1997-2006ITB CompuPhase


13 Errors

Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)