SA-MP Gamemodes with PHP

I hate the fact that the Github page is not updated and not active at all
Reply

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
Reply

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.
Reply

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
Reply

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
Reply

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?
Reply

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.
Reply

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
  • gamemode0 empty
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
Reply

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->$player->getFacingAngle();
    
$model $params intval($model) : rand(400611);
    if (
$player->adminCar) {
        
$player->adminCar->destroy();
    } 
    
$player->adminCar Vehicle::create($model$pos->x$pos->y$pos->z$pos->arand(128243), rand(128243));
    
$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?
Reply

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->$player->getFacingAngle();
    
$model $params intval($model) : rand(400611);
    if (
$player->adminCar) {
        
$player->adminCar->destroy();
    } 
    
$player->adminCar Vehicle::create($model$pos->x$pos->y$pos->z$pos->arand(128243), rand(128243));
    
$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.

Reply

Damn I want some piece of that action too bad it doesnt work for me damnit
Reply

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?
Reply

Quote:
Originally Posted by BlackBank3
Посмотреть сообщение
Which error do you exactly got?
any mysql/mysqli comes as undefined function
Reply

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.
Reply

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
Reply

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.
Reply

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
Reply

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.
Reply

I'm having trouble using
Код:
PlayerTextDraw
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 :/
Reply

Quote:
Originally Posted by t1ran
Посмотреть сообщение
Добавьте .dll от php7 и поддержку PDO
Quote:
Originally Posted by amirm3hdi
Посмотреть сообщение
I'm having trouble using
Код:
PlayerTextDraw
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!
Reply


Forum Jump:


Users browsing this thread: 4 Guest(s)