03.04.2016, 08:08
Script
Error
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(0, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
return 1;
}
public OnGameModeExit()
{
return 1;
}
public OnPlayerRequestClass(playerid, classid)
{
SetPlayerPos(playerid, 1958.3783, 1343.1572, 15.3746);
SetPlayerCameraPos(playerid, 1958.3783, 1343.1572, 15.3746);
SetPlayerCameraLookAt(playerid, 1958.3783, 1343.1572, 15.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(playerid, killerid, reason)
{
Giocatore[playerid][Morti]++;//Aumentiamo il valore dei dati da salvare
Giocatore[killerid][Uccisioni]++;
return 1;
}
public OnVehicleSpawn(vehicleid)
{
return 1;
}
public OnVehicleDeath(vehicleid, killerid)
{
return 1;
}
public OnPlayerText(playerid, text[])
{
return 1;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp("/settadmin", cmdtext, true, 10) == 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(cmdtext, idx);
if(!strlen(tmp)){
SendClientMessage(playerid, COLOR_RED, ".:ERRORE:. UTILIZZA: /settadmin [playerid][livello]");
return 1;
}
id = strval(tmp);
if(!IsPlayerConnected(id)){
SendClientMessage(playerid, COLOR_RED, ".:ERRORE:. Il Giocatore non и connesso");
return 1;}
tmp = strtok(cmdtext, idx);
if(!strlen(tmp)) {
SendClientMessage(playerid, COLOR_RED, ".:ERRORE:. UTILIZZA: /settadmin [playerid][livello]");
return 1;}
lvadmin = strval(tmp);
if((lvadmin != 0) && (lvadmin != 1) && (lvadmin != 2) && (lvadmin != 3)){
SendClientMessage(playerid, COLOR_YELLOW, ".:ATTENZIONE:. I livello sono 0 / 1 / 2 / 3");
return 1;}
new name2[MAX_PLAYER_NAME];
GetPlayerName(playerid,name,sizeof(name));
GetPlayerName(id, name2, sizeof(name2));
format(string, sizeof(string), ".:ESEGUITO:. %s ha settato il livello admin di %s in %d",name, name2, lvadmin);
Player[id][Livello] = lvadmin;
SendClientMessageToAll(COLOR_RED, string);
return 1;
}
else{
SendClientMessage(playerid, COLOR_RED, ".:ERROR:. Non puoi utilizzare questo comando");}
return 1;
}
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
return 1;
}
public OnPlayerExitVehicle(playerid, vehicleid)
{
return 1;
}
public OnPlayerStateChange(playerid, newstate, oldstate)
{
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(playerid, objectid)
{
return 1;
}
public OnPlayerPickUpPickup(playerid, pickupid)
{
return 1;
}
public OnVehicleMod(playerid, vehicleid, componentid)
{
return 1;
}
public OnVehiclePaintjob(playerid, vehicleid, paintjobid)
{
return 1;
}
public OnVehicleRespray(playerid, vehicleid, color1, color2)
{
return 1;
}
public OnPlayerSelectedMenuRow(playerid, row)
{
return 1;
}
public OnPlayerExitedMenu(playerid)
{
return 1;
}
public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)
{
return 1;
}
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
return 1;
}
public OnRconLoginAttempt(ip[], password[], success)
{
return 1;
}
public OnPlayerUpdate(playerid)
{
return 1;
}
public OnPlayerStreamIn(playerid, forplayerid)
{
return 1;
}
public OnPlayerStreamOut(playerid, forplayerid)
{
return 1;
}
public OnVehicleStreamIn(vehicleid, forplayerid)
{
return 1;
}
public OnVehicleStreamOut(vehicleid, forplayerid)
{
return 1;
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
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;
}
PHP код:
C:\Users\Kevin11\Desktop\server freeroam\pawno\include\sscanf2.inc(258) : warning 202: number of arguments does not match definition
C:\Users\Kevin11\Desktop\server freeroam\pawno\include\sscanf2.inc(271) : error 025: function heading differs from prototype
C:\Users\Kevin11\Desktop\server freeroam\gamemodes\freeroam.pwn(165) : error 017: undefined symbol "idx"
C:\Users\Kevin11\Desktop\server freeroam\gamemodes\freeroam.pwn(175) : error 017: undefined symbol "idx"
C:\Users\Kevin11\Desktop\server freeroam\gamemodes\freeroam.pwn(183) : error 021: symbol already defined: "name2"
C:\Users\Kevin11\Desktop\server freeroam\gamemodes\freeroam.pwn(184) : error 017: undefined symbol "name"
C:\Users\Kevin11\Desktop\server freeroam\gamemodes\freeroam.pwn(184) : error 017: undefined symbol "name"
C:\Users\Kevin11\Desktop\server freeroam\gamemodes\freeroam.pwn(184) : error 029: invalid expression, assumed zero
C:\Users\Kevin11\Desktop\server freeroam\gamemodes\freeroam.pwn(184) : fatal error 107: too many error messages on one line
Compilation aborted.Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase
8 Errors.