Re: SA-MP Gamemodes with PHP -
amirm3hdi - 18.11.2016
I hate the fact that the Github page is not updated and not active at all
Re: SA-MP Gamemodes with PHP -
TwinkiDaBoss - 18.11.2016
Quote:
Originally Posted by amirm3hdi
I hate the fact that the Github page is not updated and not active at all 
|
What version are you running? Im on 5.5.12
EDIT: tried with PHP/5.6.25 same shit. Ima try with 7 and see what happens.
EDIT V2: Same shit happens with the latest PHP version.
If you can please send me your server folder, I think I havent done something correctly or might be I downloaded some older version
Re: SA-MP Gamemodes with PHP -
BlackBank - 18.11.2016
Quote:
Originally Posted by TwinkiDaBoss
What version are you running? Im on 5.5.12
EDIT: tried with PHP/5.6.25 same shit. Ima try with 7 and see what happens.
|
If you are still talking about "mysqli function is undefined", you need to enable the mysqli extension in php.ini file.
Re: SA-MP Gamemodes with PHP -
TwinkiDaBoss - 19.11.2016
Quote:
Originally Posted by BlackBank3
If you are still talking about "mysqli function is undefined", you need to enable the mysqli extension in php.ini file.
|
Its enabled. Im running Win 10 if that makes any difference. Latest WAMP version tested with both 5.6.25 and the 7.0.10. My WAMP is running perfectly without any problems
http://imgur.com/a/wDQoj
EDIT: Altho my php works perfectly in WAMP. For example I tried empty php project with simple mysqli_connect and it works, but in SA:MP it doesnt.
Also I might be downloading the wrong one? Im downloading the
https://github.com/Lapayo/SAMPHP
Re: SA-MP Gamemodes with PHP -
BlackBank - 19.11.2016
Quote:
Originally Posted by TwinkiDaBoss
Its enabled. Im running Win 10 if that makes any difference. Latest WAMP version tested with both 5.6.25 and the 7.0.10. My WAMP is running perfectly without any problems
http://imgur.com/a/wDQoj
EDIT: Altho my php works perfectly in WAMP. For example I tried empty php project with simple mysqli_connect and it works, but in SA:MP it doesnt.
Also I might be downloading the wrong one? Im downloading the https://github.com/Lapayo/SAMPHP
|
You should use this one on Windows, as i see PHP is embedded to it on the Windows version?:
http://www.sney.net/files/samphp-release-windows.zip
Re: SA-MP Gamemodes with PHP -
TwinkiDaBoss - 19.11.2016
Yep I have that one, altho one weird thing hmm. I did
PHP код:
echo 'Current PHP version: ' . phpversion();
and the output was
Quote:
Current PHP version: 5.4.15
|
Now Im using 5.6.25 on my WAMPP, should I change that or?
Re: SA-MP Gamemodes with PHP -
BlackBank - 19.11.2016
Quote:
Originally Posted by TwinkiDaBoss
Yep I have that one, altho one weird thing hmm. I did
PHP код:
echo 'Current PHP version: ' . phpversion();
and the output was
Now Im using 5.6.25 on my WAMPP, should I change that or?
|
How you mean change? I doubt this plugin use your WAMP PHP version, as WAMP install it at a different location for internal (WAMP only) use.
Re: SA-MP Gamemodes with PHP -
TwinkiDaBoss - 19.11.2016
Quote:
Originally Posted by BlackBank3
How you mean change? I doubt this plugin use your WAMP PHP version, as WAMP install it at a different location for internal (WAMP only) use.
|
Not sure what to do anymore bro. I went over every single step there is, went thru all possible things that could mess it up, nothing... This is how I installed it
1. Downloaded samp from the sa-mp.com/downloads
2. Downloaded the stuff from the GitHub
3. Pasted in the PHP & Gamemodes folder into my SA:MP folder (also pasted in the stuff in the SAMP folder such as php5.dll and sampgdk3.dll)
4. Added 2 new lines inside the server.cfg
- plugins samphp
- samphpmode mygamemode
5. Edited the gamemode0 and set it as
6. Created my gamemode folders inside the server PHP folder. (SAMP/php/mygamemode)
7. Created gamemode.php and places it into my SAMP/php/mygamemode folder
8. Added mysqli_connect inside my gamemode.php
9. Started the server.
I even went as far as reinstalling my entire WAMP, getting the newest version, getting newer PHP versions.
If you want send me a private message, Ill give you my skype & teamviewer info so you can see what & where
Re: SA-MP Gamemodes with PHP -
amirm3hdi - 19.11.2016
Guys, I'm making a login/register system, so far it's going well,
About PHP version, I have Lampp/Xampp and also PHP 7 installed on Ubuntu latest.
It's really easier with PHP for logging in and signing up <3 less code :P
UPDATE:
I did the login/register system, working perfectly.
UPDATE:
Working around command text with params, hope it goes well.
Also I gave a question about spawning a vehicle:
PHP код:
CommandText::register(["/scar"], function ($player, $p, $params) {
$pos = $player->getPos();
$pos->a = $player->getFacingAngle();
$model = $params ? intval($model) : rand(400, 611);
if ($player->adminCar) {
$player->adminCar->destroy();
}
$player->adminCar = Vehicle::create($model, $pos->x, $pos->y, $pos->z, $pos->a, rand(128, 243), rand(128, 243));
$player->putInVehicle($player->adminCar);
});
How to check if vehicle is created?
I checked the return value of CreateVehicle, if is INVALID_VEHICLE_MODEL then vehicle didn't get created.
So how can I check if created in php?
Re: SA-MP Gamemodes with PHP -
BlackBank - 19.11.2016
Quote:
Originally Posted by amirm3hdi
Guys, I'm making a login/register system, so far it's going well,
About PHP version, I have Lampp/Xampp and also PHP 7 installed on Ubuntu latest.
It's really easier with PHP for logging in and signing up <3 less code :P
UPDATE:
I did the login/register system, working perfectly.
UPDATE:
Working around command text with params, hope it goes well.
Also I gave a question about spawning a vehicle:
PHP код:
CommandText::register(["/scar"], function ($player, $p, $params) {
$pos = $player->getPos();
$pos->a = $player->getFacingAngle();
$model = $params ? intval($model) : rand(400, 611);
if ($player->adminCar) {
$player->adminCar->destroy();
}
$player->adminCar = Vehicle::create($model, $pos->x, $pos->y, $pos->z, $pos->a, rand(128, 243), rand(128, 243));
$player->putInVehicle($player->adminCar);
});
How to check if vehicle is created?
I checked the return value of CreateVehicle, if is INVALID_VEHICLE_MODEL then vehicle didn't get created.
So how can I check if created in php?
|
PHP код:
if($player->adminCar !== null) {
// Vehicle created.
} else {
// Vehicle not created.
}
Re: SA-MP Gamemodes with PHP -
TwinkiDaBoss - 19.11.2016
Damn I want some piece of that action

too bad it doesnt work for me damnit
Re: SA-MP Gamemodes with PHP -
BlackBank - 19.11.2016
Quote:
Originally Posted by TwinkiDaBoss
Damn I want some piece of that action  too bad it doesnt work for me damnit
|
Which error do you exactly got?
Re: SA-MP Gamemodes with PHP -
TwinkiDaBoss - 20.11.2016
Quote:
Originally Posted by BlackBank3
Which error do you exactly got?
|
any mysql/mysqli comes as undefined function
Re: SA-MP Gamemodes with PHP -
amirm3hdi - 20.11.2016
Quote:
Originally Posted by TwinkiDaBoss
any mysql/mysqli comes as undefined function
|
I fuqing hate that, try more debugging and searching for your errors, I hope you get it working.
Re: SA-MP Gamemodes with PHP -
TwinkiDaBoss - 20.11.2016
Quote:
Originally Posted by amirm3hdi
I fuqing hate that, try more debugging and searching for your errors, I hope you get it working.
|
I went thru every possible thing I could :/
I even went as far as getting 3 new versions of PHP to test it on

I also re-downloaded WAMPP, reinstalled it.. et.c
The issue is, it happens only with samp, works normally with PHP. Like I can execute other PHP scripts normally but whenever I start serverexe kaboom
Re: SA-MP Gamemodes with PHP -
BlackBank - 20.11.2016
Quote:
Originally Posted by TwinkiDaBoss
I went thru every possible thing I could :/
I even went as far as getting 3 new versions of PHP to test it on  I also re-downloaded WAMPP, reinstalled it.. et.c
The issue is, it happens only with samp, works normally with PHP. Like I can execute other PHP scripts normally but whenever I start serverexe kaboom
|
This plugin doesn't use your WAMPP PHP version, as i told before.
Re: SA-MP Gamemodes with PHP -
TwinkiDaBoss - 20.11.2016
Quote:
Originally Posted by BlackBank3
This plugin doesn't use your WAMPP PHP version, as i told before.
|
Yeah got you on that but honestly no clue what to do anymore lol. I tried everything
Re: SA-MP Gamemodes with PHP -
amirm3hdi - 21.11.2016
Quote:
Originally Posted by TwinkiDaBoss
Yeah got you on that but honestly no clue what to do anymore lol. I tried everything
|
Well, the plugin doesn't use the wampp php,
Try changing the path variable for your php executable.
Quote:
Originally Posted by BlackBank3
This plugin doesn't use your WAMPP PHP version, as i told before.
|
I've done saving vehicles to database and loading them on init, so far, pretty good,
Variables are easy to access in PHP compared to Pawn,
Will go further see what I can accomplish.
Re: SA-MP Gamemodes with PHP -
amirm3hdi - 22.11.2016
I'm having trouble using
can create it, but can't show it or use it's variables by it's instantiated variable
Can someone provide a working example?
For now, PlayerTextDraw and Dialog class don't work at all :/
Re: SA-MP Gamemodes with PHP -
thanhlongcongtu - 05.12.2016
Quote:
Originally Posted by t1ran
Добавьте .dll от php7 и поддержку PDO
|
Quote:
Originally Posted by amirm3hdi
I'm having trouble using can create it, but can't show it or use it's variables by it's instantiated variable
Can someone provide a working example?
For now, PlayerTextDraw and Dialog class don't work at all :/
|
PHP код:
$player->textdraw['foods'] = PlayerTextDraw::create($player,550,105,"_");
$player->textdraw['foods']->useBox();
$player->textdraw['foods']->setBoxColor($var['color']['orange']);
$player->textdraw['foods']->setTextSize(550 + $foods,165);
$player->textdraw['foods']->setLetterSize(1.0,0.1);
$player->textdraw['foods']->show();
Above is an example, i created a big gamemode using this plugins, working perfect!