SA-MP Gamemodes with PHP
#21

Are you planning on allowing filterscripts as well?
Reply
#22

Quote:
Originally Posted by Memoryz
View Post
Are you planning on allowing filterscripts as well?
I think we'll have to rewrite most filter scripts given the complete difference in scripting language.

It'd be nice if we could, but I doubt support will be there
Reply
#23

Awesome..
Reply
#24

Quote:
Originally Posted by Memoryz
View Post
Are you planning on allowing filterscripts as well?
Well, not planned yet, but possible. But given the fact, that you can have unlimited events, you could simply create a new file and include this in the gamemode.php. (Do you want a shared or a isolated environment for the filterscripts?)

And some news
I finally managed to create a version for windows. You can download the binaries from the first topic
(Compiling instructions will follow later, it was very complicated )

I also created new releases for centos and debian/ubuntu, using the new code
I hope the new code is as stable as the old one

I also added a feature, that you can start a gamemode using the server.cfg.
Simply add "samphpmode grandlarc" and it will automatically load grandlarc/gamemode.php.
If there is no gamemode set it will load gamemode.php as before.

Finally I also added an empty gamemode to the binary release. (thx Rsmiley )


Maybe someone wants to help testing the windows version.
Reply
#25

Call me crazy, but how could this work?

PHP Code:
public function playAudioStream($url$x 0.0$y 0.0$z 0.0$distance 50.0$usePos false)
{
     return 
PlayAudioStreamForPlayer($this->id$x$y$z$distance$usePos);

What I mean is that there is no variable $url given to PlayAudioStreamForPlayer, how does it know what to stream xD
Reply
#26

You are right, I missed the $url parameter
Will fix it with the next release
Reply
#27

Man, you work fast!

Thanks for the Windows Release Testing it out.


Do you even have a "Buy Me a Beer" button of some sort somewhere?
Because I would.

Thanks
Reply
#28

Quote:
Originally Posted by lapayo
View Post
Well, not planned yet, but possible. But given the fact, that you can have unlimited events, you could simply create a new file and include this in the gamemode.php. (Do you want a shared or a isolated environment for the filterscripts?)

And some news
I finally managed to create a version for windows. You can download the binaries from the first topic
(Compiling instructions will follow later, it was very complicated )

I also created new releases for centos and debian/ubuntu, using the new code
I hope the new code is as stable as the old one

I also added a feature, that you can start a gamemode using the server.cfg.
Simply add "samphpmode grandlarc" and it will automatically load grandlarc/gamemode.php.
If there is no gamemode set it will load gamemode.php as before.

Finally I also added an empty gamemode to the binary release. (thx Rsmiley )


Maybe someone wants to help testing the windows version.
I love you.
But I'm kinda afraid about the performance and the overhead this piece of work would cause.
Can a SA-MP gamemode and a PHP gamemode run together?
Reply
#29

@Whiteagle I already added that link yesterday

And development probably stops for a few days, my ISP broke my connection and they aren't working on weekends
Reply
#30

Wow, this looks awesome!

Anyway I have a little feature wish/question about the possibility of a feature: is it possible to add something like RegisterFunction(); to register new natives or do we really have to recompile the whole thing to get new natives into SAMPHP?
Reply
#31

What exactly do you want? Loading an Extension made for PHP or adding a new Pawn native (e.g added through a samp extension) to PHP?
Reply
#32

The second.
Example: you have SAMPHP and a streamer loaded and (of course) you want to use the streamer so you need to add the natives to the script. And as far as I dived into SAMPHP I haven't found a place where I can register/add new natives apart from the SAMP GDK - this would lead into recompiling SAMPHP for new natives if I understand this correctly.
Reply
#33

Yes, you are right, at the moment this is not possible.
But I will definitely have a look if it would be possible to integrate.
Reply
#34

Quote:
Originally Posted by Rsmiley
Посмотреть сообщение
Well, I'm running PHP 5.3.22 and Operating system: CentOS Linux 5.9

And I assume 5.3 wouldn't work, from this?
You have to compile PHP, or find repository for CentOS, for debian you have ex. dotdeb.org

Im very interested about this, but how about performance?
And how about use other plugins written for pawn, timers etc
Reply
#35

Why don't you link the plugin SDK with PHP using some kind of abstraction layer between them? This way, you won't have any problems porting existing plugins and scripts.

EDIT: Actually, this is a brilliant idea. I'm going to implement it soon if you don't do it first!
Reply
#36

Quote:
Originally Posted by ToFFiK
Посмотреть сообщение
You have to compile PHP, or find repository for CentOS, for debian you have ex. dotdeb.org
And how about use other plugins written for pawn, timers etc
You cannot use the php versions from the repositories, those are not compiled with the embed sapi.
Using plugins written for pawn is not possible atm like I said a post before

Quote:
Originally Posted by Dan..
Посмотреть сообщение
Why don't you link the plugin SDK with PHP using some kind of abstraction layer between them? This way, you won't have any problems porting existing plugins and scripts.

EDIT: Actually, this is a brilliant idea. I'm going to implement it soon if you don't do it first!
You want to make the plugin SDK available in php? I don't think this is that easy and I think performance would also be worse than with bindings through c++, or have I misunderstood you?
Reply
#37

This whould be possible but the next gamemode might be confused, that the players are already spawned.
Reply
#38

Quote:
Originally Posted by lapayo
Посмотреть сообщение
You want to make the plugin SDK available in php? I don't think this is that easy and I think performance would also be worse than with bindings through c++, or have I misunderstood you?
The performance would be worse, but it would be an intersting piece of code. I'm thinking of advantages right now.
Reply
#39

Let me just put out my questions..

We can use then our custom classes right?
like
PHP код:
class Stupid_Functions {
     static public function 
Hai($player) {
         
SendClientMessageToAll(0xFFFFFF"Everyone says hello to ".$player->GetPlayerName()."!");
     }
}
////
Event::on("PlayerConnect", function($player) {
     
Stupid_Functions::Hai($player);
}); 
?

I'm asking such thing since currently i cannot test[i don't have gta sa here]
Reply
#40

Of course you can
(But it is $player->getName())

Also you wouldnt need a closure, you can simply say:
PHP код:
Event::on('PlayerConnect', ['Stupid_Functions''Hai']); 
Reply


Forum Jump:


Users browsing this thread: 4 Guest(s)