Welcome, Guest
You have to register before you can post on our site.

Username
  

Password
  





Search Forums



(Advanced Search)

Forum Statistics
» Members: 7,253
» Latest member: punhetovisk
» Forum threads: 2,378
» Forum posts: 12,290

Full Statistics

Online Users
There are currently 371 online users.
» 0 Member(s) | 369 Guest(s)
Bing, Yandex

Latest Threads
some text appearing in my...
Forum: Support
Last Post: Sizy
Today, 07:33 AM
» Replies: 0
» Views: 10
Offensive-Core: TDM
Forum: Gamemodes
Last Post: NikitaFoxze
Today, 12:13 AM
» Replies: 3
» Views: 3,637
Second Generation Rolepla...
Forum: Advertisements
Last Post: JamesT
2025-07-06, 10:28 AM
» Replies: 0
» Views: 32
Servidor RPG profissões
Forum: Advertisements
Last Post: tcharlesmeurer
2025-07-05, 11:35 PM
» Replies: 0
» Views: 27
EVO Anti-Cheat
Forum: Libraries
Last Post: Eduardo_AC
2025-07-05, 11:05 PM
» Replies: 2
» Views: 68
Developer for Hire – Syst...
Forum: Pawn Scripting
Last Post: ejtamovic
2025-07-04, 08:35 AM
» Replies: 0
» Views: 55
Liberty City map
Forum: Pawn Scripting
Last Post: ziyadprogamer
2025-06-28, 04:55 PM
» Replies: 2
» Views: 2,198
GameText styles in open.m...
Forum: Pawn Scripting
Last Post: Miki
2025-06-28, 01:25 PM
» Replies: 1
» Views: 69
Script[gamemodes/gamemode...
Forum: Pawn Scripting
Last Post: Miki
2025-06-27, 05:08 PM
» Replies: 1
» Views: 443
Want to edit my profile n...
Forum: Chat
Last Post: Hera.
2025-06-26, 08:41 PM
» Replies: 1
» Views: 601

 
  samp-account
Posted by: Bakr - 2020-12-14, 07:49 PM - Forum: Libraries - Replies (5)

samp-account

samp-account was created to allow extensive user-account systems to be streamlined by not worrying about implementation details. This means we can have a fully working user account system, with data loaded from a database, and stored to a database, all with one function call.

samp-account uses the SA:MP native SQLite database system for storage, Slice?s pointers library for data binding, Y_Less? YSI hooks library for callback hooking, and Y_Less' Whirlpool plugin for encryption.

Installation

Simply install to your project:

Code:
sampctl package install bwhitmire55/samp-account

Include in your code and begin using the library:

Code:
#include <account>

Functions

Code:
/*
PARAMS:?
name - The name of the database column to store the data?
type - The psuedo-type of the data (TYPE_INT, TYPE_FLOAT, TYPE_STRING)?
{Float,_}:... - The variable to store the data?
?
RETURNS:?
1 on success, otherwise 0?
*/
stock AddAccountData(const name[ACCOUNT_MAX_COLUMN_NAME], Types: type, {Float,_}:...)

Code:
/*
PARAMS:  
playerid - The playerid to update the database for
{Float,_}:... - Which data to updat  
  
RETURNS:  
1 on success, otherwise 0  
*/
stock UpdateAccountData(playerid, {Float, _}:...);

Code:
/*
PARAMS:?
playerid - The playerid attempting to be registered?
password - The password of the player (in plain text)?
?
RETURNS:?
1 on success, otherwise 0?
*/
stock RegisterPlayer(playerid, const password[])

Code:
/*
PARAMS:?
playerid - The playerid attempting to be logged in?
password - The password of the player (in plain text)?
?
RETURNS:?
1 on success, otherwise 0
*/
stock LoginPlayer(playerid, const password[])

Code:
/*
PARAMS:?
playerid - The playerid to check?
?
RETURNS:?
1 (true) if logged-in, otherwise 0 (false)
*/
bool: IsPlayerLoggedIn(playerid)

Code:
/*
PARAMS:?
playerid - The playerid to check?
?
RETURNS:?
The unique-ID of the player in the database if exists, otherwise 0?
*/
stock GetPlayerUID(playerid)

Usage

Simply create variables in which to store your players? data

Code:
new
? ? gPlayerKills[MAX_PLAYERS],
? ? gPlayerHealth[MAX_PLAYERS],
? ? gPlayerNickname[MAX_PLAYERS][MAX_PLAYER_NAME];

Add that data to the system (and database) via AddAccountData

Code:
public OnGameModeInit() {
? ? AddAccountData("kills", TYPE_INT, gPlayerKills);
? ? AddAccountData("health", TYPE_FLOAT, gPlayerHealth);
? ? AddAccountData("nickname", TYPE_STRING, gPlayerNickname);

? ? return 1;
}

Anytime a user logs into their account, their information will be loaded from the database and into the corresponding variables. Likewise for disconnecting, their data will be updated inside the database.

NOTE: The variables do no reset themselves, so you should zero-out their values upon the player exiting the server.

You are free to use the variables as normal with no effect:

Code:
public OnPlayerDeath(playerid, killerid, reason) {
? ? gPlayerDeaths[playerid];
? ? return 1;
}

Now we just need to call RegisterPlayer or LoginPlayer. This will most likely be done via command/dialog

Code:
ZCMD:register(playerid, params[]) {
? ? if(IsPlayerLoggedIn(playerid)) {
? ? ? ? return SendClientMessage(playerid, 0xFF0000FF, "Already logged-in!");
? ? }

? ? if(isnull(params)) {
? ? ? ? return SendClientMessage(playerid, 0xFFFF00FF, "Usage: /register <password>");
? ? }

? ? if(RegisterPlayer(playerid, params)) {
? ? ? ? SendClientMessage(playerid, 0x00FF00FF, "You have successfully registered an account!");
? ? } else {
? ? ? ? // RegisterPlayer will return 0 if the account already exists, or there is an issue with the database.
? ? ? ? // For this example, we'll assume the former.
? ? ? ? SendClientMessage(playerid, 0xFF0000FF, "Error! This username is already registered.");
? ? }
? ? return 1;
}

And that?s it! You now have a fully working account system, which can store any data you like, without touching a database or file. Nice!

Callbacks

This library also includes two callbacks, OnPlayerRegister and OnPlayerLogin.

Code:
public OnPlayerRegister(playerid) {
? ? SendClientMessageToAll(0x00FF00FF, "A new member has registered!");
? ? return 1;
}

public OnPlayerLogin(playerid) {
? ? SendClientMessageToAll(0x00FF00FF, "An existing member has rejoined us!");
? ? return 1;
}

Macros

All macros are as followed:

Code:
// The database file
#define ACCOUNT_DATABASE? ? ? ? "mydatabase.db"

Code:
// The database table to store the account data
#define ACCOUNT_DATABASE_TABLE? "mydatabasetable"

Code:
// The amount of 'data' you wish to store
// i.e., how many times you will use AddAccountData
#define ACCOUNT_MAX_COLUMNS? ? (100)

Code:
// The maximum length of a column name in the database
#define ACCOUNT_MAX_COLUMN_NAME (24)

All of these can be redefined to suite your script

Code:
#define ACCOUNT_DATABASE? ? ? ? "COD-DB.db"
#define ACCOUNT_DATABASE_TABLE? "users"
#include <account>

Testing

To test, simply run the package:

Code:
sampctl package run


  Interior Hospital
Posted by: Mashermosh - 2020-12-13, 10:49 PM - Forum: Maps - Replies (4)

My discord: elmarcapiel
Credits pls
Download: https://pastebin.com/ZgWifRgu

Images:
[Image: sa-mp-006.png]
[Image: sa-mp-007.png]
[Image: sa-mp-008.png]
[Image: sa-mp-009.png]
[Image: sa-mp-010.png]
[Image: sa-mp-001.png]
[Image: sa-mp-002.png]
[Image: sa-mp-003.png]
[Image: sa-mp-004.png]
[Image: sa-mp-005.png]


  SA-MP Random Name
Posted by: Tama - 2020-12-12, 01:56 AM - Forum: Libraries - Replies (1)

When i'm bored, sometimes i just starring at blank screen until i got some idea.
So, in this case i am creating a library called SA-MP Random Name

You can download it here:
Kirima2nd/samp-random-name

The usage should be like this:

PHP Code:
#include <a_samp>
#include <RandomName>

main() {
? ? new 
? ? ? ? 
str[MAX_PLAYER_NAME];

? ? 
RandomName(str);
? ? print(
str);


And it will automatically give you results like this:

Code:
Filterscripts
---------------
? Loaded 0 filterscripts.

Chad_Chrysa
Number of vehicle models: 0

Feel free to give me a?suggestions, issues, etc ??


  How to check alt-tabbing using onplayerupdate?
Posted by: c4p - 2020-12-11, 12:40 PM - Forum: Pawn Scripting - Replies (5)

I tried different methods to check if the player is in menu or tabbed, but they most likely return false activity when the player tabs out to the desktop. There were some onplayerupdate tabbing checkers on the original forums, but they are no longer available, so i am stuck. If you have a code snippet please help this man out.


  How to check if you have a vehicle in position
Posted by: Frajola - 2020-12-09, 01:37 AM - Forum: Support - Replies (3)

Hello guys, I have a problem. I'm making a garage system and I would like to know if there are any vehicles parked.





I tried that way, but the vehicle is created in the same position in the second wave, the system works perfectly until the second wave, the third time the truck is created on top of the other.



My English is bad, for a better interpretation of the problem, watch the video:?https://youtu.be/QOKytHFMVQQ

Code:
enum VacancyInfo

{

? ? Float:posX,

? ? Float:posY,

? ? Float:posZ,

? ? Float:posA

}

new TruckerVacancy[MAX_TRUCKER_VACANCY][VacancyInfo] =

{

? ? {2788.3999000,-2484.7000000,14.8000000,90.0000000},

? ? {2788.3999000,-2474.3999000,14.8000000,90.0000000},

? ? {2788.3999000,-2464.1001000,14.8000000,90.0000000},

? ? {2788.3999000,-2453.8000000,14.8000000,90.0000000},

? ? {2788.3999000,-2443.5000000,14.8000000,90.0000000},

? ? {2788.3999000,-2433.2000000,14.8000000,90.0000000},

? ? {2788.3999000,-2422.8999000,14.8000000,90.0000000}

};



#define IsVehicleInRangeOfPoint(%0,%1,%2,%3,%4)\

? ? (%1 >= GetVehicleDistanceFromPoint(%0, %2, %3, %4))



stock IsVehicleFromRangePointEx(Float:range, Float:x, Float:y, Float:z)

{

? ? foreach(new i: Vehicle)

? ? {

? ? ? ? return IsVehicleInRangeOfPoint(i, range, x, y, z);

? ? }

? ? return 0;

}



CMD:etruck(playerid, params[])

{

? ? for(new i; i < MAX_TRUCKER_VACANCY; i)

? ? {

? ? ? ? if(!IsVehicleFromRangePointEx(5.0, TruckerVacancy[i][posX],TruckerVacancy[i][posY],TruckerVacancy[i][posZ]))

? ? ? ? {

? ? ? ? ? ? CreateVehicleEx(403, TruckerVacancy[i][posX],TruckerVacancy[i][posY],TruckerVacancy[i][posZ],TruckerVacancy[i][posA], 0, 0);

? ? ? ? ? ? return 1;

? ? ? ? }

? ? }

? ? return 1;

}


  vehicle & Weapons Spawner
Posted by: pippepappe - 2020-12-08, 08:58 PM - Forum: Filterscripts - Replies (4)

Based on: https://pastebin.com/svXeeKgb

I modified this incomplete Filterscript, with more things.



Here my modified Filterscript:

https://pastebin.com/dVkJ1PN6



[Image: PjJISGx.jpeg]

[Image: y5rYo0u.jpeg]

[Image: 9CH0t4X.jpeg]



edit: Added screenshot. I didn't it before, cause i am lazy.


  Free/Premium SA-MP/CS-GO Hosting
Posted by: TonyP - 2020-12-08, 06:50 AM - Forum: Chat - Replies (8)

We are providing free and premium Game servers, SAMP is also included. Kindly?do check out our page for more info?https://www.limitlessgamers.xyz



*We posted this to help players get free SAMP?server, this is not posted with an intention to advertise*


  Free/Premium SA-MP/CS-GO Hosting
Posted by: TonyP - 2020-12-08, 06:46 AM - Forum: General Discussions - No Replies

We are providing free and premium Game servers, SAMP is also included. Kindly?do check out our page for more info https://www.limitlessgamers.xyz


  YSI or mysql error ?
Posted by: Russell99 - 2020-12-07, 09:17 PM - Forum: Support - Replies (2)

So when i run my samp-server.exe with ysi 4.0 , it says 1 model vehicle loaded. i updated to ysi 5 and comp it it says the same error in 4 and 5 :



Code:
[debug] Long callback execution detected (hang or performance issue)

[debug] AMX backtrace:

[debug] #0 00006550 in bool:HaveToRelocateOpcodes () at C:\Users\Russell\Desktop\Samp Clean Server\pawno\include\YSI_Data\y_foreach\..\..\YSI_Coding\y_va\..\..\YSI_Core\y_core\..\..\amx\opcode.inc:262

[debug] #1 00006570 in Opcode:RelocateOpcodeNow (Opcode:opcode=52) at C:\Users\Russell\Desktop\Samp Clean Server\pawno\include\YSI_Data\y_foreach\..\..\YSI_Coding\y_va\..\..\YSI_Core\y_core\..\..\amx\opcode.inc:267

[debug] #2 000084bc in InitOpcodeTable () at C:\Users\Russell\Desktop\Samp Clean Server\pawno\include\YSI_Data\y_foreach\..\..\YSI_Coding\y_va\..\..\YSI_Core\y_core\..\..\amx\opcode.inc:811

[debug] #3 00008524 in Opcode:RelocateOpcode (Opcode:opcode=134) at C:\Users\Russell\Desktop\Samp Clean Server\pawno\include\YSI_Data\y_foreach\..\..\YSI_Coding\y_va\..\..\YSI_Core\y_core\..\..\amx\opcode.inc:820

[debug] #4 000101bc in CodeScanInit (scanner[CodeScanner:164]=@02539f40) at C:\Users\Russell\Desktop\Samp Clean Server\pawno\include\YSI_Data\y_foreach\..\..\YSI_Coding\y_va\..\..\YSI_Core\y_core\..\..\amx\codescan.inc:971

[debug] #5 0001083c in AddressofResolve () at C:\Users\Russell\Desktop\Samp Clean Server\pawno\include\YSI_Data\y_foreach\..\..\YSI_Coding\y_va\..\..\YSI_Core\y_core\..\..\amx\addressof_jit.inc:89

[debug] #6 00012c7c in public AMX_OnCodeInit () at C:\Users\Russell\Desktop\Samp Clean Server\pawno\include\YSI_Data\y_foreach\..\..\YSI_Coding\y_va\..\..\YSI_Core\y_core\y_thirdpartyinclude.inc:367

[debug] #7 00002288 in public Debug_OnCodeInit () at C:\Users\Russell\Desktop\Samp Clean Server\pawno\include\YSI_Data\y_foreach\..\..\YSI_Core\y_core\y_amx_impl.inc:206

[debug] #8 00001bdc in public ScriptInit_OnCodeInit () at C:\Users\Russell\Desktop\Samp Clean Server\pawno\include\YSI_Data\y_foreach\..\..\YSI_Core\y_core\y_debug_impl.inc:659

[debug] #9 00000cd0 in ScriptInit_CallOnCodeInit (bool:jit=false) at C:\Users\Russell\Desktop\Samp Clean Server\pawno\include\YSI_Data\y_foreach\..\..\YSI_Core\y_core\y_scriptinit_impl.inc:193

[debug] #10 00000fec in public OnGameModeInit () at C:\Users\Russell\Desktop\Samp Clean Server\pawno\include\YSI_Data\y_foreach\..\..\YSI_Core\y_core\y_scriptinit_impl.inc:339

*** YSI Fatal Error: Out of code generation (CGen) space.? The current value of `CGEN_MEMORY` is `10000`, please recompile with a higher value (approximately 10006).

*** YSI Fatal Error: Out of code generation (CGen) space.? The current value of `CGEN_MEMORY` is `10000`, please recompile with a higher value (approximately 10012).

*** YSI Fatal Error: Out of code generation (CGen) space.? The current value of `CGEN_MEMORY` is `10000`, please recompile with a higher value (approximately 10018).

*** YSI Fatal Error: Out of code generation (CGen) space.? The current value of `CGEN_MEMORY` is `10000`, please recompile with a higher value (approximately 10024).


Shocked My code don't compiler
Posted by: Pavas - 2020-12-06, 07:46 PM - Forum: Support - Replies (3)

Greetings. I write here, because I have not returned to samp for a long time, and I wanted to go back, but something has surprised me, when I try to compile an fs, it does not compile (it does not throw errors, it just does not compile, neither in pawn, nor in sublime text, it only appears to me?that it is finished but the amx appears with a size of 0kb, that is, without information) I don't know what it could be, previous months nothing happened ..., I'm clearly on a new pc, but I don't think I have something see that it has 64 bits ...

If anyone could help me I would really appreciate it, thanks.





[Image: imagen-2020-12-06-134151.png]



[Image: imagen-2020-12-06-134438.png]