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

Username
  

Password
  





Search Forums



(Advanced Search)

Forum Statistics
» Members: 7,495
» Latest member: luizluiz2520
» Forum threads: 2,412
» Forum posts: 12,359

Full Statistics

Online Users
There are currently 855 online users.
» 0 Member(s) | 853 Guest(s)
Bing, Google

Latest Threads
Adding new vehicles and s...
Forum: Programming
Last Post: __.A.__
11 hours ago
» Replies: 0
» Views: 36
Zona América del Sur Free...
Forum: Advertisements
Last Post: kevinberriosflores
Yesterday, 02:16 PM
» Replies: 1
» Views: 63
Busco copia de gamemode S...
Forum: Spanish/Espa?ol
Last Post: briancristaldo2021
2025-09-11, 11:14 AM
» Replies: 0
» Views: 51
[Tutorial] Registrando o ...
Forum: Portuguese/Portugu?s
Last Post: Crazy_ArKzX
2025-09-09, 08:36 PM
» Replies: 0
» Views: 191
San Andreas Police Pursui...
Forum: Advertisements
Last Post: BriBri
2025-09-08, 10:09 PM
» Replies: 1
» Views: 275
Problem with plugins load...
Forum: Support
Last Post: MrKacu13
2025-09-08, 07:15 PM
» Replies: 9
» Views: 330
Compilation error
Forum: Pawn Scripting
Last Post: MrKacu13
2025-09-07, 07:18 AM
» Replies: 6
» Views: 330
Need help, problem when i...
Forum: Programming
Last Post: nonickowned
2025-09-06, 06:21 PM
» Replies: 0
» Views: 138
Transfer server from SAMP...
Forum: Support
Last Post: MrKacu13
2025-09-06, 04:03 PM
» Replies: 1
» Views: 229
Not relevant anymore
Forum: Questions and Suggestions
Last Post: peti
2025-09-05, 02:00 PM
» Replies: 0
» Views: 187

 
  Custom Models
Posted by: 2PAC_ - 2019-06-13, 05:24 PM - Forum: Questions and Suggestions - Replies (1)

Will open.mp support custom models?


  [Showcase/Mapp] Old office
Posted by: Apex - 2019-06-13, 03:22 PM - Forum: Videos and Screenshots - Replies (1)

[Image: sa-mp-194.png]

[Image: sa-mp-195.png]

[Image: sa-mp-197.png]

[Image: sa-mp-198.png]


  Just gonna leave it here
Posted by: SynTacs - 2019-06-13, 02:42 PM - Forum: Chat - Replies (6)

Been wondering why the other side became a ghost town all of a sudden, seeing BigETTI banned and some other dudes. I researched a bit and finally got a word that Y_Less was active somewhere else and got a link here... You guys were all here... A new future and a new light for SA-MP, got somehow discouraged with the silence but because of this... I guess we fighting for a new better SA-MP :D


Question string manipulation i/o and proper orientation order
Posted by: hastlaking - 2019-06-12, 11:58 PM - Forum: Pawn Scripting - Replies (2)

Subject

string manipulation i/o and proper orientation order



Hello community! today i want to share with you a chunk of code written by me, it's main purpose and usage is to mention player's in game globally to know to whom the player is speaking to, the issue i have and concerned about is i cannot proceed further, that is why i have posted here all in relation with pawn scripting section to ask for help from more experienced codders/scripters.



The thing/'s i am concerned about:



Code:
public OnPlayerText(playerid, text[])

{

? ? ? switch(text[1])

? ? ? {

? ? ? ? ? ?case '@': // case the player has inputted symbol '@'

? ? ? ? ? ?{

? ? ? ? ? ? ? ? // sending a client message to the playerid, mainly for its usage.

? ? ? ? ? ? ? ? // `sscanf` proccssed

? ? ? ? ? ? ? ? if(sscanf(text, "us[96]", targetid, message))

? ? ? ? ? ? ? ? {

? ? ? ? ? ? ? ? ? ? ?SendClientMessage(playerid, -1, "mention player: \'@\' <id> message");

? ? ? ? ? ? ? ? ? ? ?return 0;

? ? ? ? ? ? ? ? }

? ? ? ? ? ?}

? ? ? }

? ? ? return 0;

}


  • 1. Retrieving both playerid and targetid name - Pending

  • 2. coloring - Ready

  • 3. checking each position on input (after the symbol '@' checking id from 0 to 100) - No idea how to check position

  • 4. formating and sending the message - have it




missing some vital functions and organizing/hooking them.



Best Regard's to everyone

?Hastlaking


Information Two Factor Authentication [2FA]
Posted by: dakyskye - 2019-06-11, 03:15 PM - Forum: Tech - Replies (6)

Which 2FA mobile app do you use and why do you prefer it to others?

I actively used Google Authenticator but I ditched it today.. I'm looking for an (a better) alternative.

Any thoughts?


  Permissions
Posted by: Pinch - 2019-06-09, 07:45 AM - Forum: Questions and Suggestions - Replies (7)

Hmmm, I'm wondering is it possible to create (built-in ) permissions system to open.mp ( yeah, just like in MINECRAFT )

Like


Code:
native AddPermissionGroup("permgroup");
native AddPermissionTree("permgroup", "perm");
native AddPermissionToGroup(groupid, "permission");
native AddGroup(groupName);
native AddPlayerToGroup(playerid, groupName);



And sth like that, ask why?

We can use FS's without actually modifying code like to adapt CMD_PERM_ADMIN or pAdmin and shit like that, instead we can just:

/creategroup Admin
/setgperm Admin permission.cmd.* ( * - all perms from .cmd group, first native )
/setgtoplayer [ Player ] [ Group ]

permission.groupname.perm
permission.fsname.perm

and stuff like that, I hope you understand me :D


  Diverse Roleplay by Tony Patterson
Posted by: TonyP - 2019-06-09, 06:13 AM - Forum: Gamemodes - Replies (5)

?? Diverse?Roleplay?by?TonyP???



???Information???

This gamemode is my hard work, and take note this is NGRP edit, non-mysql based script. All credits goes to NGRP owners and to me only! The reason I'm releasing this gamemode is because, I thought that I could run this gamemode but unfortunately I dont have enough time to run it aslo I have an important exam next year, due to that I cant concentrate on updating this gamemode. But i will try my best to fix bugs, so far i didnt find any of them. Remember this script is NOT for NEWBIES!!


pawn Code:

Code:
General Updates

[/font][/size][/color]

-New awesome login textdraw, not copied from anywhere.



-Server [color=#222222]random[/color] messages are now on the bottom of the screen, I took this idea from PLA because it was my favourite server.



-/stats /help /ah is now in dialog, more structured and looks neat.



-Admins can now show their admin badge via /showabadge, a roleplay dialog will be shown



-Admins can type /oldbiz and /oldhouses to view old and unused biz id and house id..It shows with the owners name.



-Now [color=#2222bb]if[/color] you want to promote helpers, you can check their help counts which means...You can check how many help request have they accepted on their /stats..admins can type /check (their id)



-New business pickupmodel icon



-You can now put your favourite skins inside your house by tying /putskin(idk the commands check via /househelp



-VIPS CAN own up to 3 houses.



-VIPS can now own up to 5 cars.



-You can now put /boombox musics with custom url, just press on the custom url dialog section and put your custom skin, ******* is not supported as usual.

[color=#000000][size=small][font=verdana, geneva, lucida,]- Plenty of admin commands.




Admin commands are messed up on this forum sorry for that because i copied the whole thread from my samp thread.

pawn Code:





Code:
[color=#000000][size=small][font=verdana, geneva, lucida,]CMD:ah(playerid, params[])

{

? ? [color=#2222bb]new[/color] str[5200];

? ? [color=#2222bb]if[/color] (PlayerInfo[playerid][pAdmin] >= 1)

? ? {

? ? ? ? [color=#222222]strcat[/color](str, [color=#000066]"{B4B5B7}*** Trial Admin *** /showabadge /jail /sjail /kick /c /togadvisor /oocmute /ounmute /sfine /fine /spec /gotoid[color=#000099][b]\n[/b][/color]"[/color]);

? ? ? ? [color=#222222]strcat[/color](str, [color=#000066]"*** Trial Admin *** /revive /goto /mark[color=#000099][b]\n[/b][/color]"[/color]);

? ? ? ? [color=#222222]strcat[/color](str, [color=#000066]"*** REPORT SYSTEM *** /ar (accept report) /tr (trash report) /cr (close report)[color=#000099][b]\n[/b][/color]"[/color]);

? ? ? ? [color=#222222]strcat[/color](str, [color=#000066]"*** REPORT SYSTEM *** /sta (send to advisor) /post (post forums)[color=#000099][b]\n[/b][/color]"[/color]);

? ? ? ? [color=#222222]strcat[/color](str, [color=#000066]"*** REPORT SYSTEM *** /srm (send report msg to report)[color=#000099][b]\n[/b][/color]"[/color]);

? ? ? ? [color=#222222]strcat[/color](str, [color=#000066]"*** REPORT SYSTEM *** /srtha (send report to higher admin)[color=#000099][b]\n[/b][/color]"[/color]);

? ? }

? ? [color=#2222bb]if[/color] (PlayerInfo[playerid][pAdmin] >= 2)

? ? {

? ? ? ? [color=#222222]strcat[/color](str, [color=#000066]"*** {00FF00}JUNIOR ADMIN{BFC0C2} *** /gotoid /gethere /ar /dr /reports /post /sta /dt /rfd /nao /hhc /paused[color=#000099][b]\n[/b][/color]"[/color]);

? ? ? ? [color=#222222]strcat[/color](str, [color=#000066]"*** {00FF00}JUNIOR ADMIN{BFC0C2} *** ?/god /ban /kick /jail /bigears /freeze /unfreeze /slap /warn /cnn /gethere /gotoid /hospital /goto /requestevent[color=#000099][b]\n[/b][/color]"[/color]);

? ? ? ? [color=#222222]strcat[/color](str, [color=#000066]"*** {00FF00}JUNIOR ADMIN{BFC0C2} *** ?/gotoplayerscar /jetpack /god /check /ip /hlmute /nrn /listguns /setvw /setint /vehname /watch[color=#000099][b]\n[/b][/color]"[/color]);

? ? ? ? [color=#222222]strcat[/color](str, [color=#000066]"*** {00FF00}JUNIOR ADMIN{BFC0C2} *** ?/ar /dr /reports /post /sta /dt /rfd /nao /hhc /oocpower /amegaphone(/ameg)[color=#000099][b]\n[/b][/color]"[/color]);

? ? }

? ? [color=#2222bb]if[/color] (PlayerInfo[playerid][pAdmin] >= 3)

? ? {

? ? ? ? [color=#222222]strcat[/color](str, [color=#000066]"*** {00FF00}GENERAL ADMIN{CBCCCE} *** /aduty /noooc /nonewbie /prison /fine /pfine /takeadminweapons /sendtols /oprison /gotocar /entercar /getcar /sendtoid[color=#000099][b]\n[/b][/color]"[/color]);

? ? ? ? [color=#222222]strcat[/color](str, [color=#000066]"*** {00FF00}GENERAL ADMIN{CBCCCE} *** /mole /setskin /countdown /release /force(death/hospital) /rto(reset) /jailaccount /(o)clearflag /mark /reloadpvehicles[color=#000099][b]\n[/b][/color]"[/color]);

? ? ? ? [color=#222222]strcat[/color](str, [color=#000066]"*** {00FF00}GENERAL ADMIN{CBCCCE} *** /gotoco /n(un)mute /ad(un)mute /leaders /wepreset /ocheck /owarn /ofine /okills /respawncar(s) /revive /sfine /odebug[color=#000099][b]\n[/b][/color]"[/color]);

? ? ? ? [color=#222222]strcat[/color](str, [color=#000066]"*** {00FF00}GENERAL ADMIN{CBCCCE} *** (/forcetut - /skiptut) /fuelcar /cr /gr /ahyd /anos /aneon /rtoreset /rto[color=#000099][b]\n[/b][/color]"[/color]);

? ? }

? ? [color=#2222bb]if[/color] (PlayerInfo[playerid][pAdmin] >= 4)

? ? {

? ? ? ? [color=#222222]strcat[/color](str, [color=#000066]"*** {EE9A4D}SENIOR ADMIN{D8D8D8} *** /edit /noadvisor /setchamp /setarmorall /fixvehall /givenos /blowup /setname /startlotto[color=#000099][b]\n[/b][/color]"[/color]);

? ? ? ? [color=#222222]strcat[/color](str, [color=#000066]"*** {EE9A4D}SENIOR ADMIN{D8D8D8} *** /veh /fixveh /sethp /setarmor /givegun /givemoney /setmoney /setfightstyle[color=#000099][b]\n[/b][/color]"[/color]);

? ? ? ? [color=#222222]strcat[/color](str, [color=#000066]"*** {EE9A4D}SENIOR ADMIN{D8D8D8} *** /adivorce /destroycar /destroycars /eventhelp /contracts /rmute[color=#000099][b]\n[/b][/color]"[/color]);

? ? ? ? [color=#222222]strcat[/color](str, [color=#000066]"*** {EE9A4D}SENIOR ADMIN{D8D8D8} *** /unban /unbanip /deletehit /clearall /setinsurance /cmotd /givelicense /adestroyplant /ahelp[color=#000099][b]\n[/b][/color]"[/color]);

? ? ? ? [color=#222222]strcat[/color](str, [color=#000066]"*** {EE9A4D}SENIOR ADMIN{D8D8D8} *** /createpvehicle /destroypvehicle /creategvehicle /vipparty /vto /vtoreset /forceskin /setcapping[color=#000099][b]\n[/b][/color]"[/color]);

? ? ? ? [color=#222222]strcat[/color](str, [color=#000066]"*** {EE9A4D}SENIOR ADMIN{D8D8D8} *** /hnext /dmpnext /(goto/goin)dd /(goto/goin)house /(create/delete/goto)point /banaccount[color=#000099][b]\n[/b][/color]"[/color]);

? ? ? ? [color=#222222]strcat[/color](str, [color=#000066]"*** {EE9A4D}SENIOR ADMIN{D8D8D8} *** /hedit /dd(edit/next/name/pass) /dmpedit /dmpnear /gotomapicon /gangwarn /gangunban /maketiki ?/deletetiki /givetikis[color=#000099][b]\n[/b][/color]"[/color]);

? ? ? ? [color=#222222]strcat[/color](str, [color=#000066]"*** {EE9A4D}SENIOR ADMIN{D8D8D8} *** /gedit /gnear /gstatus /gnext[color=#000099][b]\n[/b][/color]"[/color]);

? ? }

? ? [color=#2222bb]if[/color] (PlayerInfo[playerid][pAdmin] >= 1337)

? ? {

? ? ? ? [color=#222222]strcat[/color](str, [color=#000066]"*** {FF0000}HEAD ADMIN{E3E3E3} *** /weather /weatherall /tod /dedit /pedit /giftall /makehelper /respawnallcars /ipcheck[color=#000099][b]\n[/b][/color]"[/color]);

? ? ? ? [color=#222222]strcat[/color](str, [color=#000066]"*** {FF0000}HEAD ADMIN{E3E3E3} *** /permaban /setcolor /payday /clearallreports /eventreset /amotd /vipmotd /givetoken /gifts[color=#000099][b]\n[/b][/color]"[/color]);

? ? ? ? [color=#222222]strcat[/color](str, [color=#000066]"*** {FF0000}HEAD ADMIN{E3E3E3} *** /vmute /asellhouse /switchfac /switchfam /refund /setstat /editjob /gotojob /jobnext[color=#000099][b]\n[/b][/color]"[/color]);

? ? ? ? [color=#222222]strcat[/color](str, [color=#000066]"*** {FF0000}HEAD ADMIN{E3E3E3} *** /editlocker /lockernext /gotolocker[color=#000099][b]\n[/b][/color]"[/color]);

? ? ? ? [color=#222222]strcat[/color](str, [color=#000066]"*** {FF0000}HEAD ADMIN{E3E3E3} *** /bizedit /createbiz /deletebiz /bnext /asellbiz /resetplayerbiz[color=#000099][b]\n[/b][/color]"[/color]);

? ? }

? ? [color=#2222bb]if[/color] (PlayerInfo[playerid][pAdmin] >= 1338)

? ? {

? ? ? ? [color=#222222]strcat[/color](str, [color=#000066]"*** {298EFF}LEAD HEAD ADMIN{E3E3E3} *** ?/specreset /pausespec /random /vrandom /giftreset /vipgifts /takeadvisor /makeadvisor /vsuspend /oldhouse /oldbiz[color=#000099][b]\n[/b][/color]"[/color]);

? ? ? ? [color=#222222]strcat[/color](str, [color=#000066]"*** {298EFF}LEAD HEAD ADMIN{E3E3E3} *** ?/afacban /listfacpay /switchfac /facpay /fackick /ofackick /facunban /faccsfban /faccsfunban /sprison /sjail[color=#000099][b]\n[/b][/color]"[/color]);

? ? ? ? [color=#222222]strcat[/color](str, [color=#000066]"*** {298EFF}LEAD HEAD ADMIN{E3E3E3} *** ?/gangstrike /fedithq /fcreate /fedit /fdelete /silentadmins /gangmods /factionmods /advisormods /djs /mods[color=#000099][b]\n[/b][/color]"[/color]);

? ? }

? ? [color=#2222bb]if[/color] (PlayerInfo[playerid][pAdmin] >= 99998)

? ? {

? ? ? ? [color=#222222]strcat[/color](str, [color=#000066]"*** {298EFF}Executive Admin{F0F0F0} *** /restartserver /osuspend /unsuspend /suspend /motd /amotd /vipmotd /setspawn[color=#000099][b]\n[/b][/color]"[/color]);

? ? ? ? [color=#222222]strcat[/color](str, [color=#000066]"*** {298EFF}Executive Admin{F0F0F0} *** /givetikisall /noadmin /makemoderator /removemoderator[color=#000099][b]\n[/b][/color]"[/color]);

? ? ? ? [color=#222222]strcat[/color](str, [color=#000066]"*** {298EFF}Executive Admin{F0F0F0} *** /makepr /makebanappealer /makegangmod /makefacmod /makedj /makesilentadmin[color=#000099][b]\n[/b][/color]"[/color]);

? ? }

? ? [color=#2222bb]if[/color] (PlayerInfo[playerid][pAdmin] >= 99999)

? ? {

? ? ? ? [color=#222222]strcat[/color](str, [color=#000066]"*** {FF0000}Executive Director{E3E3E3} *** ?/savefiles /deletetikis /firework /usetolls /dontusetolls /allowrobbank[color=#000099][b]\n[/b][/color]"[/color]);

? ? ? ? [color=#222222]strcat[/color](str, [color=#000066]"*** {FF0000}Executive Director{E3E3E3} *** ?/createdealership /destroydealership /createcdveh /destroycdveh /giveboombox[color=#000099][b]\n[/b][/color]"[/color]);

? ? ? ? [color=#222222]strcat[/color](str, [color=#000066]"*** {FF0000}Executive Director{E3E3E3} *** ?/makeap /makedev /makeadmin /setvip /changeuserpass[color=#000099][b]\n[/b][/color]"[/color]);

? ? }

? ? [color=#2222bb]if[/color] (PlayerInfo[playerid][pBanAppealer] == 1)

? ? {

? ? ? ? SendClientMessageEx(playerid, COLOR_GRAD5,[color=#000066]"Ban Appealer: /unbanip /unban /ipcheck /oipcheck[color=#000099][b]\n[/b][/color]"[/color]);

? ? }

? ? [color=#2222bb]if[/color] (PlayerInfo[playerid][pAdminPer] == 1)

? ? {

? ? ? ? SendClientMessageEx(playerid, COLOR_GRAD5,[color=#000066]"Admin Personnel: /makeadmin[color=#000099][b]\n[/b][/color]"[/color]);

? ? }

? ? [color=#2222bb]if[/color] (PlayerInfo[playerid][pDJ] == 1)

? ? {

? ? ? ? SendClientMessageEx(playerid, COLOR_GRAD5,[color=#000066]"DJ: /playall /stopall[color=#000099][b]\n[/b][/color]"[/color]);

? ? }

? ? [color=#2222bb]if[/color] (PlayerInfo[playerid][pSilentAdmin] == 1)

? ? {

? ? ? ? SendClientMessageEx(playerid, COLOR_GRAD5,[color=#000066]"Silent Admin: /sw(hisper) /sprison /sjail /swarn /skick /sslap[color=#000099][b]\n[/b][/color]"[/color]);

? ? }

? ? [color=#2222bb]if[/color] (PlayerInfo[playerid][pFactionModerator] == 1)

? ? {

? ? ? ? SendClientMessageEx(playerid, COLOR_GRAD5,[color=#000066]"Faction Moderator: /listfacpay /facpay /switchfac /faccsfunban /faccsfban /facban /facunban /fackick /ofackick /leaders /makeleader[color=#000099][b]\n[/b][/color]"[/color]);

? ? ? ? SendClientMessageEx(playerid, COLOR_GRAD5,[color=#000066]"Faction Moderator: /editlocker /lockernext /gotolocker[color=#000099][b]\n[/b][/color]"[/color]);

? ? }

? ? [color=#2222bb]if[/color] (PlayerInfo[playerid][pGangModerator] == 1)

? ? {

? ? ? ? SendClientMessageEx(playerid, COLOR_GRAD5,[color=#000066]"Gang Moderator: /switchfam /fedit /creategvehicle /destroygvehicle /gangwarn /gangunban /fcreate[color=#000099][b]\n[/b][/color]"[/color]);

? ? ? ? SendClientMessageEx(playerid, COLOR_GRAD5,[color=#000066]"Gang Moderator: /fdelete /gangstrike /fedithq[color=#000099][b]\n[/b][/color]"[/color]);

? ? }

? ? [color=#2222bb]if[/color] (PlayerInfo[playerid][pAdvisorModerator] == 1)

? ? {

? ? ? ? SendClientMessageEx(playerid, COLOR_GRAD5,[color=#000066]"Public Relations: /makeadvisor /takeadvisor /nonewbie /cto /ctoreset /advisors[color=#000099][b]\n[/b][/color]"[/color]);

? ? }

? ? [color=#2222bb]if[/color](PlayerInfo[playerid][pDeveloper] >= 1)

? ? {

? ? ? ? SendClientMessageEx(playerid, COLOR_GRAD5,[color=#000066]"Developer: /dev /getcoords /getvehinfo[color=#000099][b]\n[/b][/color]"[/color]);

? ? }

? ? [color=#2222bb]if[/color](PlayerInfo[playerid][pDeveloper] >= 6)

? ? {

? ? ? ?SendClientMessageEx(playerid, COLOR_GRAD5,[color=#000066]"Asst.Development Director: /makedeveloper /editpoint[color=#000099][b]\n[/b][/color]"[/color]);

? ? }

? ? [color=#2222bb]if[/color](PlayerInfo[playerid][pDeveloper] >= 7)

? ? {

? ? ? ? SendClientMessageEx(playerid, COLOR_GRAD5,[color=#000066]"Development Director: /makedeveloper /editpoint[color=#000099][b]\n[/b][/color]"[/color]);

? ? }

? ? [color=#2222bb]if[/color] (PlayerInfo[playerid][pAdmin] >= 1)

? ? {

? ? ? ? ShowPlayerDialog(playerid, DIALOG_SHOW_INFO, DIALOG_STYLE_MSGBOX, [color=#000066]"{33AA33}Administration Commands"[/color], str, [color=#000066]"Ok"[/color], [color=#000066]"Cancel"[/color]);

? ? }

? ? [color=#2222bb]return[/color] 1;

}[/font][/size][/color]





Screenshots?

As soon as possible.



?? CREDITS?? :

-?Tony Patterson (me)?[The main editor and scripter of this gamemode]

-?Natalie Patterson & Geroge Barletta?[For testing this gamemode]

- Respective?NGRP Owners & Developers?[For NGRP Script]

-?Eliteshost.com?for giving me free 100 slots server.

- Christmas and Anims filterscript by?Pedro

if it's your FC let me know by pming me.

Installation Process :

1. Open DRP.pwn file using pawno or what ever, compile it again because i dont have time to compile it.

2. Once u spawn use /rcon login (password) and type /tonyadminme [id] [99999]?

3. Go to airport and you will see some cars near the building like bob cat, type there /setspawn so the players will spawn there, the spawn place was at unity station but i hate that.



??Download links?? :



Mediafire-Click



Note-:

If you need any help feel free to ask me here..



ENJOY WITH THIS GAMEMODE GUYS!


Heart Artworks
Posted by: Renisal - 2019-06-08, 07:14 PM - Forum: Art - Replies (4)

Removed


  Concept Design for open:mp
Posted by: kidpuurp - 2019-06-07, 09:28 PM - Forum: Art - Replies (17)

Hi,?I present to you my idea of a multiplayer client. The first is something similar to the updated SA: MP, for the second I did not invent anything

Do not judge strictly, in the future, mb will finalize the second option.





[Image: uX49HSj.png]

[Image: zoXk56F.png]


  MySQL Prepared Statements
Posted by: PatrickGTR - 2019-06-07, 07:42 PM - Forum: Libraries - Replies (7)

Introduction

Hi, I'll keep it short and simple.?

This emulates prepared statement when using the MySQL plugin.

Thank you for reading this really long introduction.



Download: Click me

Important: sampctl required! check github repository for installation instructions.



Reading Data (using inline)

Code:
new stmt_readloop = MySQL_PrepareStatement(MySQLHandle, "SELECT * FROM spawns");



// Run Threaded on statement

inline OnSpawnsLoad() {

? ? new

? ? spawnID,

? ? Float:spawnX,

? ? Float:spawnY,

? ? Float:spawnZ,

? ? Float:spawnA;



? ? MySQL_BindResultInt(stmt_readloop, 0, spawnID);

? ? MySQL_BindResultFloat(stmt_readloop, 1, spawnX);

? ? MySQL_BindResultFloat(stmt_readloop, 2, spawnY);

? ? MySQL_BindResultFloat(stmt_readloop, 3, spawnZ);

? ? MySQL_BindResultFloat(stmt_readloop, 4, spawnA);



? ? while(MySQL_Statement_FetchRow(stmt_readloop)) {

? ? ? ? printf("%i, %.3f, %.3f, %.3f", spawnID, spawnX, spawnY, spawnZ, spawnA);

? ? }

? ? MySQL_StatementClose(stmt_readloop);

}

MySQL_ExecuteThreaded_Inline(stmt_readloop, using inline OnSpawnsLoad);



Writing Data

Code:
new Statement: stmt_insert = MySQL_PrepareStatement(MySQLHandle, "INSERT INTO accounts(username, password, salt, money, kills, deaths) VALUES (?,?,?,?,?,?) " );



// Arrow values in questions (first 0, second is 1, etc ...)

MySQL_Bind(stmt_insert, 0 , "patrickgtr");

MySQL_Bind(stmt_insert, 1 , "patrickgtrpassword");

MySQL_Bind(stmt_insert, 2 , "pgtrhash");

MySQL_BindInt(stmt_insert, 3, 100);

MySQL_BindInt(stmt_insert, 4, 200);

MySQL_BindInt(stmt_insert, 5, 300);



MySQL_ExecuteParallel(stmt_insert);

MySQL_StatementClose(stmt_insert);



Functions



Open/Close

Code:
MySQL_StatementClose(Statement:statement)

MySQL_PrepareStatement(MySQL:handle, const query[])

MySQL_Statement_RowsLeft(&Statement:statement)

MySQL_Statement_FetchRow(Statement:statement)



Writing

Code:
MySQL_Bind(Statement:statement, param, const str[])?

MySQL_BindInt(Statement:statement, param, value)

MySQL_BindFloat(Statement:statement, param, Float:value)



Reading

Code:
MySQL_BindResult(Statement:statement, field, const result[], len = sizeof(result))

MySQL_BindResultInt(Statement:statement, field, &result)

MySQL_BindResultFloat(Statement:statement, field, &Float:result)



Executing

Code:
MySQL_ExecuteThreaded(Statement:statement, const callback[] = "", const fmat[] = "", {Float,_}:...)

MySQL_ExecuteParallel(Statement:statement, const callback[] = "", const fmat[] = "", {Float,_}:...)

MySQL_ExecuteThreaded_Inline(Statement:statement, Func:callback<>)

MySQL_ExecuteParallel_Inline(Statement:statement, Func:callback<>)