SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 21/02/2020, 02:33 PM   #1
Razvan234512312
Little Clucker
 
Join Date: Jan 2019
Posts: 20
Reputation: 0
Post SA-MP Scripting help me pls...

C:\Users\kfune\Desktop\GM de Ash\gamemodes\gm.pwn(6) : error 001: expected token: ";", but found "-"
C:\Users\kfune\Desktop\GM de Ash\gamemodes\gm.pwn(40) : warning 213: tag mismatch
C:\Users\kfune\Desktop\GM de Ash\gamemodes\gm.pwn(43) : warning 217: loose indentation
C:\Users\kfune\Desktop\GM de Ash\gamemodes\gm.pwn(59) : error 017: undefined symbol "qQuery"
C:\Users\kfune\Desktop\GM de Ash\gamemodes\gm.pwn(59) : warning 215: expression has no effect
C:\Users\kfune\Desktop\GM de Ash\gamemodes\gm.pwn(59) : error 001: expected token: ";", but found "]"
C:\Users\kfune\Desktop\GM de Ash\gamemodes\gm.pwn(59) : error 029: invalid expression, assumed zero
C:\Users\kfune\Desktop\GM de Ash\gamemodes\gm.pwn(59) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase


5 Errors.
[Finished in 0.2s]



/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

#include <a_samp>

#include <a_mysql>


new SQL - -1, qQuery[256]

#define function%0(%1) forward %0(%1); public %0(%1)

enum pInfo {
pSQLID,
pName[MAX_PLAYER_NAME],
pPassword[32],
pEmail[32],
pGender

}
new PlayerInfo[MAX_PLAYERS][pInfo];

enum {
// Register
DIALOG_REGISTER,
DIALOG_EMAIL,
DIALOG_GENDER,

// Login
DIALOG_LOGIN
}

#define Ash "#1"

main() { print("Gamemode-ul este in curs de procesare..."); }





public OnGameModeInit()
{
SQL = mysql_connect("localhost", "root", "ash", "");

// Don't use these lines if it's a filterscript
SetGameModeText(Ash);
AddPlayerClass(0, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
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) {
qQuery[0] = EOS;
mysql_format(SQL, qQuery, sizeof(qQuery), "SELECT * FROM `users` WHERE `Name`='%s' LIMIT 1", GetName(playerid));
mysql_tquery(SQL, qQuery, "CheckAccount", "1", playerid);
return 1;

}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]) {
switch(dialogid) {

}
return 1;
}

function CheckAccount(playerid) {
switch(cache_num_rows()) {
case 0: ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_PASSWORD, "Register", "Scrie o Parola pentru a te putea inregistra:", "Select", "Cancel");
case 1: ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD, "Login", "Scrie Parola pentru a te putea loga:", "Select", "Cancel");
}
return 1;
}

stock GetName(playerid) {
new playerName[MAX_PLAYER_NAME];
GetPlayerName(playerid, playerName, MAX_PLAYER_NAME);
return playerName;
}
Razvan234512312 is offline   Reply With Quote
Old 21/02/2020, 02:36 PM   #2
Razvan234512312
Little Clucker
 
Join Date: Jan 2019
Posts: 20
Reputation: 0
Default Re: SA-MP Scripting help me pls...

I'm a beginner scriptwriter (help me pls xd)
Razvan234512312 is offline   Reply With Quote
Old 21/02/2020, 02:43 PM   #3
Kwarde
High-roller
 
Kwarde's Avatar
 
Join Date: Nov 2009
Location: The Netherlands
Posts: 2,641
Reputation: 1655
Default Re: SA-MP Scripting help me pls...

You're missing semicolons here and there (, and
new SQL - -1, qQuery[256]
: it should be 'new SQL = -1'

I suggest you to start learning scripting basics first before trying to create things.
Check my signature (click on the link you shouldn't click on) for a link to the PAWN guide. Check out other basics for PAWN here: https://wiki.sa-mp.com/wiki/Scripting_Basics
For super-basics, try searching on the internet.

Alternatively, if you don't want to use semicoloms you can use option -;- to disable the need of semicoloms. Example:
pawn Code:
#pragma option -;-

main()
{
    print("This is a valid code")
    return 1
}
However I don't recommend it if you're a beginner. If you're a pro, even then I don't recommend it


EDIT:
I'm using ZeeX's compiler. Not sure if the default compiler has this option.
__________________
Wenn ist das Nunstück git und Slotermeyer? Ja! Beiherhund das Oder die Flipperwaldt gersput!

Discord: Kwarde#1991
Kwarde is offline   Reply With Quote
Old 21/02/2020, 03:24 PM   #4
Razvan234512312
Little Clucker
 
Join Date: Jan 2019
Posts: 20
Reputation: 0
Default Re: SA-MP Scripting help me pls...

Thx Very Much
Razvan234512312 is offline   Reply With Quote
Old 21/02/2020, 03:32 PM   #5
Razvan234512312
Little Clucker
 
Join Date: Jan 2019
Posts: 20
Reputation: 0
Default Re: SA-MP Scripting help me pls...

I have other error 1

C:\Users\kfune\Desktop\GM de Ash\gamemodes\gm.pwn(12) : error 001: expected token: ";", but found "enum"


//////////////////////////////////////

enum pInfo {
pSQLID,
pName[MAX_PLAYER_NAME],
pPassword[32],
pEmail[32],
pGender

}
Razvan234512312 is offline   Reply With Quote
Old 21/02/2020, 04:57 PM   #6
SiaReyes
Gangsta
 
Join Date: Mar 2019
Location: Coordinates X,Y,Z
Posts: 622
Reputation: 57
Default Re: SA-MP Scripting help me pls...

Code:
new SQL, qQuery[256] ;
SiaReyes is offline   Reply With Quote
Old 21/02/2020, 05:00 PM   #7
Razvan234512312
Little Clucker
 
Join Date: Jan 2019
Posts: 20
Reputation: 0
Default Re: SA-MP Scripting help me pls...

Thank you very much <3
Razvan234512312 is offline   Reply With Quote
Old 21/02/2020, 08:54 PM   #8
Razvan234512312
Little Clucker
 
Join Date: Jan 2019
Posts: 20
Reputation: 0
Default Re: SA-MP Scripting help me pls...

I have error xd

C:\Users\kfune\Desktop\GM de Ash\gamemodes\gm.pwn(41) : warning 213: tag mismatch
C:\Users\kfune\Desktop\GM de Ash\gamemodes\gm.pwn(44) : warning 217: loose indentation
C:\Users\kfune\Desktop\GM de Ash\gamemodes\gm.pwn(61) : warning 213: tag mismatch
C:\Users\kfune\Desktop\GM de Ash\gamemodes\gm.pwn(62) : warning 217: loose indentation
C:\Users\kfune\Desktop\GM de Ash\gamemodes\gm.pwn(62) : warning 213: tag mismatch
C:\Users\kfune\Desktop\GM de Ash\gamemodes\gm.pwn(72) : error 029: invalid expression, assumed zero
C:\Users\kfune\Desktop\GM de Ash\gamemodes\gm.pwn(72) : warning 215: expression has no effect
C:\Users\kfune\Desktop\GM de Ash\gamemodes\gm.pwn(72) : error 001: expected token: ";", but found ")"
C:\Users\kfune\Desktop\GM de Ash\gamemodes\gm.pwn(72) : error 029: invalid expression, assumed zero
C:\Users\kfune\Desktop\GM de Ash\gamemodes\gm.pwn(72) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase


4 Errors.
[Finished in 0.2s]






////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
#include <a_samp>

#include <a_mysql>


new SQL = -1, qQuery[256] ;



#define function%0(%1) forward %0(%1); public %0(%1)

enum pInfo {
pSQLID,
pName[MAX_PLAYER_NAME],
pPassword[32],
pEmail[32],
pGender
}
new PlayerInfo[MAX_PLAYERS][pInfo];

enum {
// Register
DIALOG_REGISTER,
DIALOG_EMAIL,
DIALOG_GENDER,

// Login
DIALOG_LOGIN
}

#define Ash "#1"

main() { print("Gamemode-ul este in curs de procesare..."); }





public OnGameModeInit()
{
SQL = mysql_connect("localhost", "root", "ash", "");

// Don't use these lines if it's a filterscript
SetGameModeText(Ash);
AddPlayerClass(0, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
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) {
qQuery[0] = EOS;
mysql_format(SQL, qQuery, sizeof(qQuery), "SELECT * FROM `users` WHERE `Name`='%s' LIMIT 1", GetName(playerid));
mysql_tquery(SQL, qQuery, "CheckAccount", "1", playerid);
return 1;

}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]) {
switch(dialogid) {
case DIALOG_REGISTER: {
if(!response)
return Kick(playerid);

if(strlen(inputtext)) < 6 || strlen(inputtext) > 32)
return ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_PASSWORD, "Register", "Scrie o parola pentru a te putea inregistra (minim 6 caracter / maxim 32):", "Select", "Cancel");

qQuery[0] = EOS;
mysql_format(SQL, qQuery, sizeof(qQuery), "INSERT INTO `users` (`Name`, `Password`) VALUES ('%s', '%s')", GetName(playerid), inputtext);
mysql_tquery(SQL, qQuery, "insertAccount", "i" playerid);
}
}
return 1;
}
function inserAccount(playerid) {
PlayerInfo[playerid][pSQLID] = cache_insert_id();
printf("%s s-a inregistrat #%d.", GetName(playerid), PlayerInfo[playerid][pSQLID]);
return 1;
}

function CheckAccount(playerid) {
switch(cache_num_rows()) {
case 0: ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_PASSWORD, "Register", "Scrie o parola pentru a te putea inregistra (minim 6 caracter / maxim 32):", "Select", "Cancel");
case 1: ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD, "Login", "Scrie Parola pentru a te putea loga:", "Select", "Cancel");
}
return 1;
}

stock GetName(playerid) {
new playerName[MAX_PLAYER_NAME];
GetPlayerName(playerid, playerName, MAX_PLAYER_NAME);
return playerName;
}
Razvan234512312 is offline   Reply With Quote
Old 21/02/2020, 08:56 PM   #9
Razvan234512312
Little Clucker
 
Join Date: Jan 2019
Posts: 20
Reputation: 0
Unhappy Re: SA-MP Scripting help me pls...

Sorry for multiple posts I'm a beginner
Razvan234512312 is offline   Reply With Quote
Old 21/02/2020, 10:25 PM   #10
d3Pedro
Huge Clucker
 
Join Date: Apr 2012
Location: darkness
Posts: 320
Reputation: 94
Default Re: SA-MP Scripting help me pls...

pawn Code:
mysql_tquery(SQL, qQuery, "insertAccount", "i", playerid);
You forgot a comma at this line

and this
pawn Code:
if(strlen(inputtext)) < 6 || strlen(inputtext) > 32)
should be:
pawn Code:
if(strlen(inputtext) < 6 || strlen(inputtext) > 32)



This
pawn Code:
mysql_tquery(SQL, qQuery, "insertAccount", "i", playerid); // the callback isn't the same of what you've defined

pawn Code:
function inserAccount(playerid) {
PlayerInfo[playerid][pSQLID] = cache_insert_id();
printf("%s s-a inregistrat #%d.", GetName(playerid), PlayerInfo[playerid][pSQLID]);
return 1;
}

You may fix it.
d3Pedro is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Who/what inspired you to start scripting? How did you start? What now? What are you planning for your scripting future? DanishHaq Everything and Nothing 30 06/03/2015 03:49 PM
Need a bit of help for scripting KarlCassidy Scripting Help 5 23/03/2014 12:24 AM
Offering FREE scripting help && co-scripting sleepysnowflake Scripting Help 0 09/10/2012 07:53 PM
Need help with scripting decastro96 Help Archive 8 11/06/2011 11:09 PM
Scripting Help for New server, moved to scripting disscussion Guardian Help Archive 2 03/06/2009 06:29 AM


All times are GMT. The time now is 12:33 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.