Posts: 270
Threads: 7
Joined: Apr 2015
Quote:
Originally Posted by GWMPT
I'm not sure if the version uploaded has support to table "like" dialogs.
This plugin needs a update for sure, I'll try to do a update in the upcoming days.
It's sad that nobody else picks on this project and continue developing it, like I did when lapayo released the original version.
|
I wish I could, but I can't, I'm working on couple of other projects,
Hope it gets updated <3
Posts: 270
Threads: 7
Joined: Apr 2015
Quote:
Originally Posted by BlackBank3
This is indeed the right way of adding rows yeah, but not for style 5 i think, as GWMPT said, it's most likely not supported yet. What if you try style 2, will this work?
Also, your code looks fine, but try to use double/single quotes instead of nothing when accessing an array. Why? Because this is what happens when you don't use quotes and have like for example 'name' defined as something else: http://stackoverflow.com/a/13622685
|
Thanks for reply,
I ended up using the ShowPlayerDialog and works perfectly fine,
About the variables, yea I got that fixed when I saw the results
.
Posts: 803
Threads: 138
Joined: Jul 2014
Reputation:
0
So you can use samp natives in it normaly too? Also does it support streamer?
Posts: 270
Threads: 7
Joined: Apr 2015
Quote:
Originally Posted by GWMPT
Since the very first version, done by lapayo, the plugin had issues handling plugins callbacks and functions.
So it isn't supported for now.
|
So plugins are not supported? How about a filterscript to handle them?
Posts: 270
Threads: 7
Joined: Apr 2015
Quote:
Originally Posted by GWMPT
Filterscripts are supported, but PHP has no "direct contact"(By this, i mean, Cannot execute functions or receive callbacks) with filterscripts or plugins for now.
|
So I can only use a FS to handle plugins and stuff, but no way of contacting the gamemode itself
Posts: 270
Threads: 7
Joined: Apr 2015
Quote:
Originally Posted by TwinkiDaBoss
Hmm interesting, so we could have objects being loaded from a Filterscipt that has the plugin and such (using pawn). That actually makes it perfect
I wonder tho, how would you actually do some of the SQLi inside the SAMPPHP? I see some informations in the OP but its quite outdated and I dont see any SQLi examples.
For example, core PHP would be something like
Example code, wrote it on forums, not sure if its gonna work but I hope you get my point
PHP код:
function Connect() {
$host = "localhost";
$user = "root";
$pass = "";
$db = "myDB";
$conn = mysqli_connect($host, $user, $pass, $db);
return $conn;
}
//meanwhile somewhere else...
$conn = Connect();
$result = $conn->query("SELECT * FROM users WHERE noob='Noob'");
if($result->num_rows >= 1) {
while($row = $result->fetch_assoc()) {
echo "Bla bla bla";
}
}
|
Actually I wanna use mysql functions right now, gonna test it out see what I can do,
Imma use the normal PHP mysql/mysqli functions, so no PAWNO,
I'll share the results.
Posts: 270
Threads: 7
Joined: Apr 2015
Quote:
Originally Posted by TwinkiDaBoss
You are making me hyped. Cant wait to see the results, thanks mate! I've searched a bit thru Git and seems that it does support both mysql and mysqli so shouldnt be a problem for it to handle it.
Also gotta look into this
https://github.com/aleksandarzivanovic/samphp
He wrote that he made some stuff that allow dynamic features (dynamic objects, 3d texts etc.)
Looks like we will have to use SQL as contact in between PHP and Pawn haha.
Send the Request from Pawn to SQL, get the result from the SQL inside the PHP, magic hahaha
|
I did this:
PHP код:
Event::on("GameModeInit", function() {
$mysql = mysqli_connect("127.0.0.1", "samp", "0000", "samp");
});
Event::on("GameModeExit", function() {
mysqli_close($mysql);
});
I got
Код:
Warning: mysqli_close() expects parameter 1 to be mysqli, null given in ...
I know what's the problem, but currently have no solution for it...
I can't use variable outside of events or functions...
If we can use global vars it'll work...
Alt way: Make a connection each time doing something which is bad
No way of having global variables, if you know a way, tell me.
Posts: 270
Threads: 7
Joined: Apr 2015
Quote:
Originally Posted by TwinkiDaBoss
Hmm I see the problem, I understand what you mean. Well hmm.
What about returning it thru a function? (Are they even added in? Like public functions)
pawn Код:
function Connect() $connection = .... ; //mysql bla bla bla bla return $connection; }
Event::OnSomething() { $conn = Connect(); }
Also any way to use call_user_func maybe?
|
I already did that, using a function to get and set connection variable.. still null.
Imma try to dig more now
Posts: 270
Threads: 7
Joined: Apr 2015
I used a function to set and get a global variable.. no luck
Posts: 270
Threads: 7
Joined: Apr 2015
Quote:
Originally Posted by TwinkiDaBoss
We could use 1 NPC as our global handler? All global variables hooked to a NPC therefore we can always manipulate them
If we can use global variable on NPC's then we could eventually connect 1 NPC at the start and then use his connection to manipulate the stuff.
This is just an example to show you what I mean, the code will not work
pawn Код:
Event::on('PlayerConnect', function($player) { //of course, all $player should be replaced with NPC $found = 0; for($i = 0; i < MAX_NPC; $i++) { if($NPC->IsConnected($NPC)) { $found += 1; } } if($found == 0) $NPC->connect = mysqli_connect(....); //if he is the first NPC connected, we will use him as our offical global variable handler }
Event::on(SomethingElse, function($something) { mysqli_close($NPC->connect); }
Since if we connect the NPC when the server connects, he will be always online, so we can use his variables as the global ones. Or something like that.
Altho the problem is then using this inside callbacks that dont have any sort of Players inside of them such as GameModeInit. But yeah, what do you think?
|
I get what you mean, but as a programmer, this is wrong and we should not even discuss using variables in a wrong way, if it doesn't work, we should not use the framework/plugin anymore...
Posts: 270
Threads: 7
Joined: Apr 2015
Quote:
@amirm how did you get the mysqli to work? I tried with mysqli_connect but seems that I get undefined symbol for it
PHP код:
<?php
include "core/bootstrap.php";
$mysql = null;
Event::on("GameModeInit", function() use (&$mysql) {
$mysql = mysqli_connect("localhost", "root", "", "roleplay");
if($mysql == true) {
echo "Hello world";
}
});
?>
|
Here's how I did it:
PHP код:
$mysql;
Event::on("GameModeInit", function () use (&$mysql) {
$mysql = mysqli_connect("127.0.0.1", "samp", "0000", "samp");
});
Event::on("GameModeExit", function () use (&$mysql) {
mysqli_close($mysql);
});
I also queried it and it worked.
If you still can't use it, maybe your PHP version is outdated.