Welcome, Guest |
You have to register before you can post on our site.
|
Forum Statistics |
» Members: 7,518
» Latest member: zuzx
» Forum threads: 2,415
» Forum posts: 12,367
Full Statistics
|
Online Users |
There are currently 499 online users. » 0 Member(s) | 496 Guest(s) Bing, Google, Applebot
|
|
|
Get away from those single file gamemodes |
Posted by: Double-O-Seven - 2019-05-31, 06:48 PM - Forum: Questions and Suggestions
- Replies (11)
|
 |
I just check out Github and saw that even the 3 example gamemodes are single files. I think you should lead as an example and implement examples in a modularized manner, no matter how small the gamemode. I think if SAMPs example had been more modularized from the beginning we wouldn?t have as many 60k line single file?abominations as we have today.
|
|
|
Plugin failed to load |
Posted by: Hype - 2019-05-31, 02:07 PM - Forum: Support
- Replies (2)
|
 |
I'm trying to load compiled GDK map in plugin but it fails to load:
1. I followed all steps correctly, gamemode loads
2. I compiled plugin in x64 instead of x86 since I don't see option to compile it in x86.
3. I have all MS bullshit .dlls for server to run this plugin
My IDE is Microsoft Visual Studio.
There are no more options to choose.
https://imgur.com/a/JGQJQvH
|
|
|
sampctl again |
Posted by: 6cadilab9 - 2019-05-30, 09:51 PM - Forum: Support
- Replies (3)
|
 |
Sorry for asking for help again, feeling like a noob, but this is my first time using this package manager,
i've managed to compile the script, i guess everything from plugins to includes is as it is supposed to be, but now when I try to start the server using
sampctl server run
I get
ERROR: failed to interpret directory as Pawn package: failed to unmarshal samp.json: json: cannot unmarshal string into Go struct field Runtime.output of type bool
Same if I try to ensure, this is samp.json
Code: {
"rcon_password": "hidden",
"port": 7777,
"hostname": "Balkan Underground",
"maxplayers": 32,
"entry": "balkan-underground.pwn",
"output": "balkan-underground.amx"
}
|
|
|
SA-MP protocol |
Posted by: steve2 - 2019-05-30, 09:40 PM - Forum: Support
- Replies (2)
|
 |
How do I can get an online and ping of a SA-MP servers? As I know, a SA-MP client sends UDP requests to the?server. There are?protocol description? Thx. Also I use Node.js
|
|
|
[GU?A] Administrador de Templates simples PHP |
Posted by: DarkThinking - 2019-05-30, 05:16 PM - Forum: Programaci?n
- Replies (8)
|
 |
En esta gu?a te har? un simple administrador de templates.
Aclaro:
-> este script reemplaza un tag {dato} por una variable o el resultado de una funci?n,
-> es simple y no necesita tanto conocimiento de php para adaptarlo.
Primero crearemos una funcion para obtener el archivo:
PHP Code: <?php class Template { ? ?private $tags = []; // tags ? ?private $template; // archivo
? ?public function getFile($file) // obtener archivo ? ?{ ? ? ? ?if(file_exists($file)) // si existe el archivo ? ? ? ?{ ? ? ? ? ? ?$file = file_get_contents($file); // obtiene los datos ? ? ? ? ? ?return $file; // y retorna el archivo (los datos) ? ? ? ?} ? ? ? ?else ? ? ? ?{ ? ? ? ? ? ?return false; // retorna 0 o falso en caso de error o no existir el archivo ? ? ? ?} ? ?}
Luego creamos una funcion para "renderizar" el codigo
PHP Code: ? ?public function render() // renderizar o reemplazar tags ? ?{ ? ? ? ?$this->replaceTags(); // reemplazar tags?
? ? ? ?echo $this->template; // imprimir los datos de php reemplazando los tags ? ?}
Ahora la funcion __construct y el set para poder poner lo reemplazable en el HTML
PHP Code: ? ?public function __construct($templateFile) // buscar archivo ? ?{ ? ? ? ?$this->template = $this->getFile($templateFile); ? ? ? ?if(!$this->template) { ? ? ? ? ? ?return "Error! no puedo cargar el template -> $templateFile"; ? ? ? ?} ? ?} ? ?public function set($tag, $value) // crear tags ? ?{ ? ? ? ?$this->tags[$tag] = $value; ? ?}
Ahora la funcion que REEMPLAZA los codigos tag
PHP Code: ? ?private function replaceTags() // reemplazar tags ? ?{ ? ? ? ?foreach ($this->tags as $tag => $value) { ? ? ? ? ? ?$this->template = str_replace('{'.$tag.'}', $value, $this->template); ? ? ? ?}
? ? ? ?return true; ? ?}
}
bueno esto funciona as?:
PHP Code: <?php require_once 'Template.php'; $tpl = new Template('archivo.html'); // creamos el template el cual se carga automaticamente
$tpl->set('codigoparahtml', $variableofuncion); // creamos el tag
$tpl->render(); // "renderizamos" ?>
en el HTML ponemos:
Code: <h3>{codigoparahtml}</h3>
y se reemplazar? por
$variableofuncion
Codigo completo:
PHP Code: <?php class Template { ? ?private $tags = []; // tags ? ?private $template; // archivo
? ?public function getFile($file) // obtener archivo ? ?{ ? ? ? ?if(file_exists($file)) ? ? ? ?{ ? ? ? ? ? ?$file = file_get_contents($file); ? ? ? ? ? ?return $file; ? ? ? ?} ? ? ? ?else ? ? ? ?{ ? ? ? ? ? ?return false; ? ? ? ?} ? ?}
? ?public function render() // renderizar o reemplazar tags ? ?{ ? ? ? ?$this->replaceTags();
? ? ? ?echo $this->template; ? ?}
? ?public function __construct($templateFile) // buscar archivo ? ?{ ? ? ? ?$this->template = $this->getFile($templateFile); ? ? ? ?if(!$this->template) { ? ? ? ? ? ?return "Error! no puedo cargar el template -> $templateFile"; ? ? ? ?} ? ?} ? ?public function set($tag, $value) // crear tags ? ?{ ? ? ? ?$this->tags[$tag] = $value; ? ?} ? ?private function replaceTags() // reemplazar tags ? ?{ ? ? ? ?foreach ($this->tags as $tag => $value) { ? ? ? ? ? ?$this->template = str_replace('{'.$tag.'}', $value, $this->template); ? ? ? ?}
? ? ? ?return true; ? ?}
}
|
|
|
simplificar checkpoints |
Posted by: zzztgtzzz - 2019-05-30, 12:00 AM - Forum: Programaci?n
- Replies (2)
|
 |
Buenas! quer?a saber como se puede hacer para reducir los checkpoints, en vez de tener todas estas lineas, hacerlo mas reducido.
Code: ? ?if(GetPVarInt(playerid,"TEST_CP") == 0)
? ? ? ? ? ?{
? ? ? ? ? ? ? ?SetPVarInt(playerid, "TEST_CP", 1);
? ? ? ? ? ? ? ? SetPlayerCheckpoint(playerid, -4048.2869,-3002.8801,1351.9772, 5);
? ? ? ? ? ? ? ?return 1;
? ? ? ? ? ?}
? ? ? ? ? ?if(GetPVarInt(playerid,"TEST_CP") == 1)
? ? ? ? ? ?{
? ? ? ? ? ? ? ?SetPVarInt(playerid, "TEST_CP", 2);
? ? ? ? ? ? ? ?PuntoTest[playerid] ;
? ? ? ? ? ? ? ? SetPlayerCheckpoint(playerid, -4035.4558,-3038.5496,1351.9779, 5);
? ? ? ? ? ? ? ?return 1;
? ? ? ? ? ?}
? ? ? ? ? ?if(GetPVarInt(playerid,"TEST_CP") == 2)
? ? ? ? ? ?{
? ? ? ? ? ? ? ?SetPVarInt(playerid, "TEST_CP", 3);
? ? ? ? ? ? ? ? SetPlayerCheckpoint(playerid, -4039.2056,-3066.4712,1351.9767, 5);
? ? ? ? ? ? ? ?return 1;
? ? ? ? ? ?}
? ? ? ? ? ?if(GetPVarInt(playerid,"TEST_CP") == 3)
? ? ? ? ? ?{
? ? ? ? ? ? ? ?SetPVarInt(playerid, "TEST_CP", 4);
? ? ? ? ? ? ? ? SetPlayerCheckpoint(playerid, -4017.9539,-3052.5557,1351.9771, 5);
? ? ? ? ? ? ? ?return 1;
? ? ? ? ? ?}
? ? ? ? ? ?if(GetPVarInt(playerid,"TEST_CP") == 4)
? ? ? ? ? ?{
? ? ? ? ? ? ? ?SetPVarInt(playerid, "TEST_CP", 0);
? ? ? ? ? ? ? ? SetPlayerCheckpoint(playerid, ?-4048.2869,-3002.8801,1351.9772, 5);
? ? ? ? ? ? ? ?return 1;
? ? ? ? ? ?}
|
|
|
y_inline - y_hooks |
Posted by: Juance - 2019-05-28, 10:38 PM - Forum: Spanish/Espa?ol
- Replies (2)
|
 |
Buenas a todos, mirando por el foro me encontr? que muchos acostumbran a usar librer?as de YSI como son las: y_hooks y tambi?n y_inline
Alguien podr?a darme una breve introducci?n acerca de esos dos librer?as?y en qu? caso se pueden aplicar? muchas gracias
|
|
|
Loops |
Posted by: Cubie - 2019-05-28, 12:49 PM - Forum: Pawn Scripting
- Replies (8)
|
 |
Is there actually a way to check if a loop is finished?
I'm going to try to explain.
e.g loop:
PHP Code: foreach (new i : Player)
{
? ??if(example[playerid] == 4)
? ? {
? ? ? //Someting
? ? }
? ? return 1;
}
e.g what I wonder:
PHP Code: [Loop Finishes]
{
? //Code
}
If anybody knows a fancy other trick that is fine too off course.
Thanks in advance.
|
|
|
|