Well, someone can fix this error and all these warnings?
Would be good, at least it has less errors as my previous script.. :rolleyes:
The script is based on the roleplay server tutorial in the tutorial section, maybe that could be a good thing to know too.
Would be good, at least it has less errors as my previous script.. :rolleyes:
Code:
C:\Users\Ivor Keizer\Documents\Tropical Island Roleplay\gamemodes\tikibayé2.pwn(37) : error 017: undefined symbol "LOG_ERROR"
C:\Users\Ivor Keizer\Documents\Tropical Island Roleplay\gamemodes\tikibayé2.pwn(39) : warning 213: tag mismatch
C:\Users\Ivor Keizer\Documents\Tropical Island Roleplay\gamemodes\tikibayé2.pwn(45) : warning 213: tag mismatch
C:\Users\Ivor Keizer\Documents\Tropical Island Roleplay\gamemodes\tikibayé2.pwn(60) : warning 213: tag mismatch
C:\Users\Ivor Keizer\Documents\Tropical Island Roleplay\gamemodes\tikibayé2.pwn(61) : warning 213: tag mismatch
C:\Users\Ivor Keizer\Documents\Tropical Island Roleplay\gamemodes\tikibayé2.pwn(68) : warning 202: number of arguments does not match definition
C:\Users\Ivor Keizer\Documents\Tropical Island Roleplay\gamemodes\tikibayé2.pwn(106) : warning 213: tag mismatch
C:\Users\Ivor Keizer\Documents\Tropical Island Roleplay\gamemodes\tikibayé2.pwn(107) : warning 213: tag mismatch
Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase
1 Error.
Code:
#include <a_samp>
#include <zcmd>
#include <a_mysql>
#include <streamer>
#include <foreach>
#include <sscanf2>
#define Server:%0(%1) forward %0(%1); public %0(%1)
#define SQL_HOST "localhost"
#define SQL_USER "root"
#define SQL_DATABASE "server"
#define SQL_PASSWORD ""
#define COLOR_WHITE 0xFFFFFF00
#define DIALOG_UNUSED 0
#define DIALOG_REGISTER 1
#define DIALOG_LOGIN 2
enum PLAYER_DATA
{
pSQLID,
pAdminLevel
}
//Global variables.
new sqlConnection;
//Player variables.
new bool:LoggedIn[MAX_PLAYERS], PlayerData[MAX_PLAYERS][PLAYER_DATA];
main(){}
public OnGameModeInit()
{
mysql_log(LOG_ERROR | LOG_WARNING, LOG_TYPE_HTML);
sqlConnection = mysql_connect(SQL_HOST, SQL_USER, SQL_DATABASE, SQL_PASSWORD);
return true;
}
public OnGameModeExit()
{
mysql_close(sqlConnection);
return true;
}
public OnPlayerConnect(playerid)
{
DefaultPlayerValues(playerid);
DoesPlayerExist(playerid);
return true;
}
Server:DoesPlayerExist(playerid)
{
new query[128];
mysql_format(sqlConnection, query, sizeof(query), "SELECT id FROM players WHERE Name = '%e' LIMIT 1", GetName(playerid));
mysql_pquery(sqlConnection, query, "SQL_DoesPlayerExist", "i", playerid);
return true;
}
Server:SQL_DoesPlayerExist(playerid)
{
new exists = -1;
if(cache_num_rows(sqlConnection) != 0) // Exists
{
ShowRegisterDialog(playerid, "");
}
else
{
}
return exists;
}
Server:ShowRegisterDialog(playerid, error[])
{
if(LoggedIn[playerid])return true;
if(!strmatch(error, "")){
SendClientMessage(playerid, COLOR_WHITE, error);
}
ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_PASSWORD, "Server Name - Register", "Please enter a password so you can register/nyour account with us.", "Register", "Quit");
return true;
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
switch(dialogid)
{
case DIALOG_REGISTER:
{
if(!response)return Kick(playerid);
if(strlen(inputtext) < 3 || strlen(inputtext) > 30){
ShowRegisterDialog(playerid, "Your password must be between 3 and 30 characters.");
}
new query[128];
mysql_format(sqlConnection, query, sizeof(query), "INSERT INTO players (Name, Password, RegIP) VALUES('e', sha1('%e'), '%e')", GetName(playerid), inputtext, GetIP(playerid));
mysql_pquery(sqlConnection, query, "SQL_OnAccountRegister", "i", playerid);
}
}
return false;
}
Server:SQL_OnAccountRegister(playerid)
{
SendClientMessage(playerid, COLOR_WHITE, "You have successfully registered to the server.");
DefaultPlayerValues(playerid);
PlayerData[playerid][pSQLID] = cache_insert_id();
return true;
}
public OnPlayerDisconnect(playerid, reason)
{
DefaultPlayerValues(playerid);
return true;
}
public OnPlayerDeath(playerid, killerid, reason)
{
return true;
}
public OnPlayerUpdate(playerid)
{
return true;
}
Server:DefaultPlayerValues(playerid)
{
PlayerData[playerid][pSQLID] = 0;
PlayerData[playerid][pAdminLevel] = 0;
return true;
}
//Stocks and other functions
GetIP(playerid)
{
new ip[20];
GetPlayerIp(playerid, ip, sizeof(ip));
return ip;
}
GetName(playerid)
{
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
return name;
}
stock strmatch(const String1[], const String2[])
{
if ((strcmp(String1, String2, true, strlen(String2)) == 0) && (strlen(String2) == strlen(String1)))
{
return true;
}
else
{
return false;
}
}