Welcome, Guest |
You have to register before you can post on our site.
|
Forum Statistics |
» Members: 7,264
» Latest member: egirl
» Forum threads: 2,381
» Forum posts: 12,297
Full Statistics
|
Online Users |
There are currently 329 online users. » 0 Member(s) | 323 Guest(s) Google, Bing, Yandex, Twitter, Applebot
|
Latest Threads |
Open Mp Server resartint ...
Forum: Support
Last Post: passedthedemon
2 hours ago
» Replies: 0
» Views: 7
|
AntyCheat System [SA-MP/O...
Forum: Filterscripts
Last Post: 2PAC_
2025-07-12, 09:17 PM
» Replies: 7
» Views: 8,384
|
Iron Horizon Roleplay[v1....
Forum: Advertisements
Last Post: MikeNGRP
2025-07-11, 11:44 PM
» Replies: 0
» Views: 28
|
[MAP PACK] 5 NEW LS BUILD...
Forum: Videos and Screenshots
Last Post: Apollo4430
2025-07-11, 12:20 AM
» Replies: 1
» Views: 3,343
|
Open.mp / SAMP Query
Forum: Releases
Last Post: laex
2025-07-09, 04:07 AM
» Replies: 2
» Views: 129
|
some text appearing in my...
Forum: Support
Last Post: Sizy
2025-07-08, 07:33 AM
» Replies: 0
» Views: 38
|
Offensive-Core: TDM
Forum: Gamemodes
Last Post: NikitaFoxze
2025-07-08, 12:13 AM
» Replies: 3
» Views: 3,683
|
Second Generation Rolepla...
Forum: Advertisements
Last Post: JamesT
2025-07-06, 10:28 AM
» Replies: 0
» Views: 54
|
Servidor RPG profissões
Forum: Advertisements
Last Post: tcharlesmeurer
2025-07-05, 11:35 PM
» Replies: 0
» Views: 35
|
EVO Anti-Cheat
Forum: Libraries
Last Post: Eduardo_AC
2025-07-05, 11:05 PM
» Replies: 2
» Views: 117
|
|
|
A tool/program for finding unmatched brackets? |
Posted by: Fawkes - 2021-03-22, 06:10 PM - Forum: Pawn Scripting
- Replies (4)
|
 |
I'm trying to optimize a script i made a few years ago and seperate it into libraries, i'm re-compiling it after every couple of changes to try and make it as easy as possible to identify errors and mistakes as i go along.
At the moment it won't compile (using pawno) unless i scroll to the bottom of the script first and compile from there (no errors or warnings if i don't scroll to the bottom first, it just doesn't create a working AMX unless i scroll to the bottom before compiling), i've checked the brackets with ctrl F and i've got 3 unmatched brackets (from years ago) which i remember used to cause the same problem in the past.
Does anyone know of any online web programs or software to highlight where unmatched bracket openings/closings begin/end without having to disect the whole script piece-by-piece to narrow down the lines manually?
I've tried searching for something to do this but they just give a long list of errors/warnings unrelated to brackets because they're intended for non-pwn.
Any help or suggestions would be great.
|
|
|
sqlite and inputtext |
Posted by: robertocaribbean - 2021-03-21, 05:42 PM - Forum: Pawn Scripting
- Replies (6)
|
 |
I am trying to create an SQLite database, I only have three variables to keep it simple.
The problem is that the password is not saved unless I pass <inputtext> directly to the query.
Variables:
Code: enum USER_DATA {
? ? USER_ID,
? ? USER_NICKNAME[MAX_PLAYER_NAME],
? ? USER_PASSWORD[20]
};
new gUserData[MAX_PLAYERS][USER_DATA];
Code working:
Code: public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]) {
? ? switch (dialogid) {
? ? ? ? case DIALOG_REGISTRATION: {
? ? ? ? ? ? if (!response) return Kick(playerid);
? ? ? ? ? ? if (!(3 <= strlen(inputtext) <= 20)) {
? ? ? ? ? ? ? ? SendClientMessage(playerid, -1, "Tu contrase?a debe tener entre 3 y 20 car?cteres");
? ? ? ? ? ? ? ? ShowPlayerDialog(playerid, DIALOG_REGISTRATION, DIALOG_STYLE_PASSWORD, "Register", "Type in a password below to register an account.", "Register", "Leave" );
? ? ? ? ? ? ? ? return 1;
? ? ? ? ? ? }
? ? ? ? ? ? new query[208], DBResult: result;
? ? ? ? ? ?
? ? ? ? ? ? format(query, sizeof query, "INSERT INTO users (nickname, password) VALUES ('%q', '%s')", gUserData[playerid][USER_NICKNAME], inputtext);
? ? ? ? ? ? db_query(db_handle, query);
? ? ? ? ? ? SendClientMessage(playerid, 0x00FF00FF, "[SERVER]: You have just registered to our server! You have been automatically logged in!");
? ? ? ? ? ? result = db_query(db_handle, "SELECT last_insert_rowid()");
? ? ? ? ? ? gUserData[playerid][USER_ID] = db_get_field_int(result);
? ? ? ? ? ? db_free_result(result);
? ? ? ? }
? ? }
? ? return 1;
}
Code isn't working:
Code: gUserData[playerid][USER_PASSWORD] = inputtext[strlen(inputtext)];? ? ? ? ? ?
? ? ? ? ? ? format(query, sizeof query, "INSERT INTO users (nickname, password) VALUES ('%q', '%s')", gUserData[playerid][USER_NICKNAME], gUserData[playerid][USER_PASSWORD]);
The password field on the database is empty, and other values are ok. No error has given from the compiler.
|
|
|
How to save the position of a car? |
Posted by: Boxi - 2021-03-21, 11:45 AM - Forum: Pawn Scripting
- Replies (1)
|
 |
Hello everyone :'D?
Would anyone know how to make a system to save the position of a car? where the player leaves his car somewhere and when he connects again the car is there, basically how is the saving of the player's position. Obviously I'm not asking for any of you to write that code, just an idea of where I should start if I wanted to do it. Greetings to all.
|
|
|
mysql_query suggest |
Posted by: Zow - 2021-03-19, 09:49 PM - Forum: Pawn Scripting
- Replies (4)
|
 |
How can I?improve this code?
PHP Code: Account_PromptLogin(playerid) {
? ? new
? ? ? ? query[81],
? ? ? ? playerHash[62],
? ? ? ? playerDate[11],
? ? ? ? playerTime[9],
? ? ? ? playerIP[16],
? ? ? ? rows;
? ? mysql_format(MySQL_GetHandle(), query, sizeof query,
? ? "\
? ? ? ? SELECT * FROM `players` WHERE `username` = '%e' LIMIT 1\
? ? ",
? ? ? ? Player_GetName(playerid)
? ? );
? ? mysql_query(MySQL_GetHandle(), query);
? ? cache_get_row_count(rows);
? ? if (!rows) {
? ? ? ? Player_Kick(playerid);
? ? ? ? return 0;
? ? }
? ? cache_get_value_name(0, "password", playerHash, sizeof(playerHash));
? ? cache_get_value_name(0, "date_reg", playerDate, sizeof(playerDate));
? ? cache_get_value_name(0, "time_reg", playerTime, sizeof(playerTime));
? ? cache_get_value_name(0, "ip", playerIP, sizeof(playerIP));
? ? Player_SetAccountHash(playerid, playerHash);
? ? Player_SetAccountDate(playerid, playerDate);
? ? Player_SetAccountTime(playerid, playerTime);
? ? Player_SetAccountIP(playerid, playerIP);
? ? Dialog_ShowCallback(playerid,
? ? ? ? using public Account_Login<iiiis>,
? ? ? ? DIALOG_STYLE_PASSWORD,
? ? ? ? SERVER_NAME,
? ? ? ? "Welcome",
? ? ? ? "Login",
? ? ? ? "Exit"
? ? );
? ? return 1;
}
forward Account_Login(playerid, dialogid, response, listitem, string:inputtext[]);
public Account_Login(playerid, dialogid, response, listitem, string:inputtext[]) {
? ? if (response) {
? ? ? ? bcrypt_verify(playerid, "OnPasswordVerify", inputtext, Player_GetAccountHash(playerid));
? ? }
? ? else {
? ? ? ? Kick(playerid);
? ? }
? ? return 1;
}
PHP Code: forward OnPasswordVerify(playerid, bool:success);
public OnPasswordVerify(playerid, bool:success) {
? ? if (success)
? ? {
? ? ? ? CallLocalFunction("OnPlayerLogin", "d", playerid);
? ? }
? ? else
? ? {
? ? ? ? Account_PromptLogin(playerid);
? ? }
}
|
|
|
Duplicate CallBack call |
Posted by: RhaegarX - 2021-03-19, 04:45 PM - Forum: Support
- Replies (9)
|
 |
In my gamemode I use mysql as a data saving system. Most of the player data I will save the moment it is changed to avoid problems in case of server crash or crash, and I also save the player data when restarting the server (/ gmx).
PHP Code: public OnPlayerDisconnect() { Player_DestroyAllVehicles(playerid); Player_SaveRanking(playerid); Player_SaveConfig(playerid); Player_SaveMoney(playerid); ? ? Player_SaveData(playerid); ? ? Player_ClearVars(playerid); Player_ClearAcessories(playerid); Player_ClearInfo(playerid); Inventory_Reset(playerid); }
PHP Code: public OnGameModeExit() { foreach(new i : Player) { Player_DestroyAllVehicles(i); Player_SaveRanking(i); Player_SaveConfig(i); Player_SaveMoney(i); Player_SaveData(i); Player_ClearVars(i); Player_ClearAcessories(i); Player_ClearInfo(i); Inventory_Reset(i); } DestroyAllDynamicMapIcons(); DestroyAllDynamic3DTextLabels(); DestroyAllDynamicPickups(); mysql_close(ConexaoSQL); return 1; }
What I noticed is that when I restart the server, OnGameModeExit is saved and OnPlayerDisconnect is saved, doubling each player's save. For example: when I restart the server (/ gmx) the player's money is saved in OnGameModeExit and OnPlayerDisconnect, being saved 2 times without need.
How do I avoid this duplication of calls? Do I need to save player data on OnGameModeExit or just OnPlayerDisconnect?
Is OnPlayerDisconnect called by default by OnGameModeExit?
|
|
|
Sound ID isn't working |
Posted by: robertocaribbean - 2021-03-18, 10:47 PM - Forum: Pawn Scripting
- Replies (4)
|
 |
Hi there,
I want to place in my script, a death sound when a player dies. I looked in the folder "data/audioevents.txt" and found the sound I was looking for:
SOUND_PED_DEATH_CRUNCH 1189.
But unfortunately, that id doesn't play any sound. I tried with other ids and they work perfectly.
Code (I'm using weapon-config):
Code: public OnPlayerDamageDone(playerid, Float:amount, issuerid, weapon, bodypart) {
? ? if (amount == 0.0) {
? ? ? ? PlayerPlaySound(playerid, 1189, 0.0, 0.0, 0.0);
? ? ? ? SendClientMessage(playerid, -1, "Death");
? ? }
? ? return 1;
}
|
|
|
|