01.03.2014, 03:17
I got some errors, here there are
Script>
Please help
Код:
Current directory: C:\Users\Bradley\Desktop\Games\SAMP\SAMP Cops and Robbers\gamemodes scnr.pwn(50) : error 035: argument type mismatch (argument 1) scnr.pwn(88) : error 035: argument type mismatch (argument 1) scnr.pwn(309) : error 035: argument type mismatch (argument 1) scnr.pwn(337) : error 035: argument type mismatch (argument 1) scnr.pwn(350) : error 035: argument type mismatch (argument 1) Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase 5 Errors. ================ READY ================
pawn Код:
#include <a_samp>
#include <a_mysql>
#include <colors>
//____________MySQL Configuration______________|
#define mysql_host ""
#define mysql_user "sfcnr_1031"
#define mysql_password ""
#define mysql_database "sfcnr_1031"
new IsRegistered[MAX_PLAYERS];
new Logged[MAX_PLAYERS];
new MoneyGiven[MAX_PLAYERS];
main()
{
print("\n***********************************");
print("SA:MP Cops and Robbers by Brad");
print("----------------------------------\n");
}
public OnGameModeInit()
{
mysql_connect(mysql_host, mysql_user, mysql_database, mysql_password);
SetGameModeText("S:CNR");
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)
{
MoneyGiven[playerid] = -1; //Resets the variable that you will discover later in the tutorial.
new query[200], pname[24]; //Creates our variables.
GetPlayerName(playerid, pname, 24); //Gets the players name
format(query, sizeof(query), "SELECT IP FROM `playerdata` WHERE user = '%s' LIMIT 1", pname); //Formats the query, view above the code for a explanation
mysql_query(query); //This is our query function to query the string
mysql_store_result(); //We store the result.
new rows = mysql_num_rows(); //We get how many rows the query returned.
if(!rows)
{
//If the rows are equal to 0. This means that the query did not find
//anyone under the name we connected under in the database.
//So here we send the player the register dialog.
ShowPlayerDialog(playerid, 15000, DIALOG_STYLE_INPUT, "Register","Your user is {FF0000}not{FFFFFF} registered! Please {0000FF}register{FFFFFF} with a password below!","Register","Cancel"); //Shows our register dialog :).
}
if(rows == 1)
{
new IP[2][16];
mysql_fetch_field_row(IP[0],"IP");
GetPlayerIp(playerid, IP[1], 16);
if(strlen(IP[0]) != 0 && !strcmp(IP[0], IP[1], true))
{
MySQL_Login(playerid);
}
else if(!strlen(IP[0]) || strcmp(IP[0], IP[1], true))
{
ShowPlayerDialog(playerid, 15500, DIALOG_STYLE_INPUT, "Login","Your user is {FF0000}registered{FFFFFF}! Please {0000FF}login{FFFFFF} with your password below!","Login","Cancel");
IsRegistered[playerid] = 1;
}
}
mysql_free_result();
return 1;
}
public OnPlayerDisconnect(playerid, reason)
{
if(Logged[playerid] == 1)
{
new score = GetPlayerScore(playerid);
new money = GetPlayerMoney(playerid);
new query[200], pname[24];
GetPlayerName(playerid, pname, 24);
format(query, sizeof(query), "UPDATE playerdata SET score=%d, money=%d WHERE user='%s'", score, money, pname);
mysql_query(query);
}
return 1;
}
public OnPlayerSpawn(playerid)
{
if(MoneyGiven[playerid] != -1)
{
GivePlayerMoney(playerid, MoneyGiven[playerid]);
MoneyGiven[playerid] = -1;
}
return 1;
}
public OnPlayerDeath(playerid, killerid, reason)
{
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("/mycommand", cmdtext, true, 10) == 0)
{
// Do something here
return 1;
}
return 0;
}
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)
{
if(!Logged[playerid]) //If the player isn't logged in and (s)he tries to spawn.
{
if(!IsRegistered[playerid]) //If the player isn't registered
{
ShowPlayerDialog(playerid, 15000, DIALOG_STYLE_INPUT, "Register","Your user is {FF0000}not{FFFFFF} registered! Please {0000FF}register{FFFFFF} with a password below!\n {FF0000}ERROR:You must register before spawning!","Register","Cancel"); //Shows our register dialog :).
return 0; //Prevents the player from spawning
}
if(IsRegistered[playerid] == 1) //Our handy variable comes into use now
{
ShowPlayerDialog(playerid, 15500, DIALOG_STYLE_INPUT, "Login","Your user is {FF0000}registered{FFFFFF}! Please {0000FF}login{FFFFFF} with your password below!\n{FF0000} You must login before you spawn!","Login","Cancel"); //Shows our login dialog :).
return 0; //Prevents the player from spawning
}
}
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 == 15000) //If Dialog is our register dialog
{
if(response) //If they click the button register
{
if(!strlen(inputtext) || strlen(inputtext) > 100) //Password is not 1 to 100 characters
{
SendClientMessage(playerid, 0xFF0000, "You must insert a password between 1-100 characters!"); //Sends the client a error message
ShowPlayerDialog(playerid, 15000, DIALOG_STYLE_INPUT, "Register","Your user is {FF0000}not{FFFFFF} registered! Please {0000FF}register{FFFFFF} with a password below!\n {FF0000}ERROR:Please enter a password between 1-100 characters!","Register","Cancel"); //Shows our register dialog :).
}
else if(strlen(inputtext) > 0 && strlen(inputtext) < 100)
{
new escpass[100];
mysql_real_escape_string(inputtext, escpass);
MySQL_Register(playerid, escpass);
}
//If the password is between 1 and 100 characters then we will
//call our MySQL_register function which will register the player.
}
if(!response)
{
SendClientMessage(playerid, 0xFF0000, "You must register before logging in!"); //Sends the client a error message
ShowPlayerDialog(playerid, 15000, DIALOG_STYLE_INPUT, "Register","Your user is {FF0000}not{FFFFFF} registered! Please {0000FF}register{FFFFFF} with a password below!\n {FF0000}ERROR:Please enter a password !","Register","Cancel"); //Shows our register dialog :).
}
}
if(dialogid == 15500) //Dialog login
{
if(!response)
{
SendClientMessage(playerid, 0xFF0000, "You must login before you spawn!"); //Sends the client a error message
ShowPlayerDialog(playerid, 15500, DIALOG_STYLE_INPUT, "Login","Your user is {FF0000}registered{FFFFFF}! Please {0000FF}login{FFFFFF} with your password below!\n{FF0000} You must login before you spawn!","Login","Cancel");
}
if(response)
{
new query[200], pname[24], escapepass[100]; //
GetPlayerName(playerid, pname, 24); //Gets the players name
mysql_real_escape_string(inputtext, escapepass); //We escape the inputtext to avoid SQL injections.
format(query, sizeof(query), "SELECT `user` FROM playerdata WHERE user = '%s' AND password = SHA1('%s')", pname, escapepass);
mysql_query(query);
mysql_store_result();
new numrows = mysql_num_rows();
if(numrows == 1) MySQL_Login(playerid);
if(!numrows)
{
ShowPlayerDialog(playerid, 15500, DIALOG_STYLE_INPUT, "Login","Your user is {FF0000}registered{FFFFFF}! Please {0000FF}login{FFFFFF} with your password below!\n{FF0000} The password you typed was incorrect!","Login","Cancel");
SendClientMessage(playerid, 0xFF0000, "Incorrect password!");
}
mysql_free_result();
}
}
return 1;
}
public OnPlayerClickPlayer(playerid, clickedplayerid, source)
{
return 1;
}
stock MySQL_Register(playerid, passwordstring[])
{
new query[200], pname[24], IP[16];
GetPlayerName(playerid, pname, 24);
GetPlayerIp(playerid, IP, 16);
format(query, sizeof(query), "INSERT INTO playerdata (user, password, score, money, IP) VALUES('%s', SHA1('%s'), 0, 0, '%s')", pname, passwordstring, IP);
mysql_query(query);
SendClientMessage(playerid, -1, "You have been registered on this server!");
Logged[playerid] = 1;
return 1;
}
stock MySQL_Login(playerid)
{
new query[300], pname[24], savingstring[20];
GetPlayerName(playerid, pname, 24);
format(query, sizeof(query), "SELECT * FROM playerdata WHERE user = '%s'", pname);
mysql_query(query);
mysql_store_result();
while(mysql_fetch_row_format(query,"|"))
{
mysql_fetch_field_row(savingstring, "score"); SetPlayerScore(playerid, strval(savingstring));
mysql_fetch_field_row(savingstring, "money"); MoneyGiven[playerid] = strval(savingstring);
}
mysql_free_result();
SendClientMessage(playerid, COLOR_YELLOW, "You have logged in, Statistics Saved.");
Logged[playerid] = 1;
return 1;
}