Welcome, Guest |
You have to register before you can post on our site.
|
Online Users |
There are currently 240 online users. » 0 Member(s) | 238 Guest(s) Bing, Applebot
|
Latest Threads |
Discord server - Ban Appe...
Forum: Chat
Last Post: joshcoconutard
8 hours ago
» Replies: 0
» Views: 11
|
I know Kalcor left the bu...
Forum: Questions and Suggestions
Last Post: NoxxeR
Yesterday, 02:22 PM
» Replies: 4
» Views: 112
|
Desolation Roleplay
Forum: Gamemodes
Last Post: Nikore
Yesterday, 07:04 AM
» Replies: 2
» Views: 4,532
|
Battlefields - TDM (Team ...
Forum: Gamemodes
Last Post: Nikore
Yesterday, 04:14 AM
» Replies: 3
» Views: 2,780
|
Will there be a higher pl...
Forum: General Discussions
Last Post: Armeat2005
2025-04-21, 08:40 AM
» Replies: 0
» Views: 30
|
DOF2.1 (DOF2 Updated)
Forum: Libraries
Last Post: GracieStith
2025-04-21, 04:51 AM
» Replies: 1
» Views: 869
|
Kontak Layanan CIMB Niaga...
Forum: Support
Last Post: bosquee9053
2025-04-20, 03:44 PM
» Replies: 0
» Views: 27
|
CS Bank DBS Customer Cent...
Forum: Chat
Last Post: bosquee9053
2025-04-20, 03:37 PM
» Replies: 0
» Views: 34
|
Sponsors and Donations
Forum: Questions and Suggestions
Last Post: NoxxeR
2025-04-20, 05:48 AM
» Replies: 0
» Views: 44
|
Best practices for conver...
Forum: Tech
Last Post: Mido
2025-04-19, 09:53 PM
» Replies: 1
» Views: 101
|
|
|
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.
|
|
|
Death spam bug |
Posted by: Uberanwar - 2019-05-28, 03:39 AM - Forum: Pawn Scripting
- Replies (4)
|
 |
Hi guys, I am currently experiencing a death spam bug. I am unsure what exactly made it happen. It is rare to other players, but it happens often to those who are lagging. I previously never had this issue.
Quote:[27/05/2019 06:22:03] [connection] xxxxxxxx:21883 requests connection cookie.
[27/05/2019 06:22:05] [join] Deba has joined the server (7:xxxxxxxx)
[27/05/2019 06:22:19] OnPlayerSpawn - Deba (7) | X: -567.648986, Y: -1036.349975, Z: 24.195400, Int: 0, World: 0, Business: -1, Entrance: -1, House: -1
[27/05/2019 06:22:20] [death] Deba died 255
[27/05/2019 06:22:20] OnPlayerSpawn - Deba (7) | X: -567.648986, Y: 24.195400, Z: -1036.349975, Int: 0, World: 0, Business: -1, Entrance: -1, House: -1
[27/05/2019 06:22:20] [death] Deba died 255
[27/05/2019 06:22:21] OnPlayerSpawn - Deba (7) | X: -567.648986, Y: 24.195400, Z: -1036.349975, Int: 0, World: 0, Business: -1, Entrance: -1, House: -1
[27/05/2019 06:22:21] [death] Deba died 255
[27/05/2019 06:22:21] OnPlayerSpawn - Deba (7) | X: -567.648986, Y: 24.195400, Z: -1036.349975, Int: 3, World: 107, Business: -1, Entrance: -1, House: -1
[27/05/2019 06:22:21] [death] Deba died 255
[27/05/2019 06:22:22] OnPlayerSpawn - Deba (7) | X: -567.648986, Y: 24.195400, Z: -1036.349975, Int: 3, World: 107, Business: -1, Entrance: -1, House: -1
[27/05/2019 06:22:22] [death] Deba died 255
[27/05/2019 06:22:22] OnPlayerSpawn - Deba (7) | X: -567.648986, Y: 24.195400, Z: -1036.349975, Int: 3, World: 107, Business: -1, Entrance: -1, House: -1
[27/05/2019 06:22:22] [death] Deba died 255
[27/05/2019 06:22:23] OnPlayerSpawn - Deba (7) | X: -567.648986, Y: 24.195400, Z: -1036.349975, Int: 3, World: 107, Business: -1, Entrance: -1, House: -1
[27/05/2019 06:23:19] OnPlayerDisconnect - Deba (7) | X: -294.178710, Y: 1005.997924, Z: 19.585987, Location: Fort Carson | Int: 0, World: 0 [Reason: 1]
[27/05/2019 06:23:19] [part] Deba has left the server (7:1)
This is my OnPlayerDeath. What seems to be the problem??
Code: public OnPlayerDeath(playerid, killerid, reason)
{
if(playerid == INVALID_PLAYER_ID) {
? ?return false; }
? ?
PlayerData[playerid][pSpawned] = 0;
new log[300], Float:pX, Float:pY, Float:pZ;
? ?new vid = GetPlayerVehicleID(playerid);
GetPlayerPos(playerid, pX, pY, pZ);
if (killerid != INVALID_PLAYER_ID)
{
? ?if (1 <= reason <= 46) {
? ? ? ?format(log, sizeof(log), "[%s] %s (%d) has killed %s (%s) [%f %f %f] [World: %d, Int: %d] [Location: %s].", ReturnDate(), ReturnName(killerid), killerid, ReturnName(playerid), playerid, ReturnWeaponName(reason), pX, pY, pZ, GetPlayerVirtualWorld(playerid), GetPlayerInterior(playerid), GetPlayerLocation(playerid));
}
else {
? format(log, sizeof(log), "[%s] %s has killed %s (reason %d) [%f %f %f] [World: %d, Int: %d] [Location: %s].", ReturnDate(), ReturnName(killerid), ReturnName(playerid), reason, pX, pY, pZ, GetPlayerVirtualWorld(playerid), GetPlayerInterior(playerid), GetPlayerLocation(playerid));
}
if (reason == 51 && killerid != INVALID_PLAYER_ID) {
format(log, sizeof(log), "[%s] %s has been killed by explosion by %s. [%f %f %f] [World: %d, Int: %d] [Location: %s].", ReturnDate(), ReturnName(playerid), ReturnName(killerid), reason, pX, pY, pZ, GetPlayerVirtualWorld(playerid), GetPlayerInterior(playerid), GetPlayerLocation(playerid));
}
}
else
{
if (reason == 51)
{
if(killerid == INVALID_PLAYER_ID && IsPlayerInAnyVehicle(playerid) && vid != INVALID_VEHICLE_ID)
{
format(log, sizeof(log), "[%s] %s has been killed in a car explosion [vehicle id: %d]. [%f %f %f] [World: %d, Int: %d] [Location: %s].", ReturnDate(), ReturnName(playerid), vid, pX, pY, pZ, GetPlayerVirtualWorld(playerid), GetPlayerInterior(playerid), GetPlayerLocation(playerid));
}
else if(killerid == INVALID_PLAYER_ID && !IsPlayerInAnyVehicle(playerid) && vid == INVALID_VEHICLE_ID)
{
? ?format(log, sizeof(log), "[%s] %s has been killed in an explosion. [%f %f %f] [World: %d, Int: %d] [Location: %s].", ReturnDate(), ReturnName(playerid), pX, pY, pZ, GetPlayerVirtualWorld(playerid), GetPlayerInterior(playerid), GetPlayerLocation(playerid));
}
}
if (reason == 53 && killerid == INVALID_PLAYER_ID) {
format(log, sizeof(log), "[%s] %s has drowned in the water. [%f %f %f] [World: %d, Int: %d] [Location: %s].", ReturnDate(), ReturnName(playerid), pX, pY, pZ, GetPlayerVirtualWorld(playerid), GetPlayerInterior(playerid), GetPlayerLocation(playerid));
}
if (reason == 54 && killerid == INVALID_PLAYER_ID) {
format(log, sizeof(log), "[%s] %s has fell (Splat). [%f %f %f] [World: %d, Int: %d] [Location: %s].", ReturnDate(), ReturnName(playerid), pX, pY, pZ, GetPlayerVirtualWorld(playerid), GetPlayerInterior(playerid), GetPlayerLocation(playerid));
}
if (reason == 255 && killerid == INVALID_PLAYER_ID) {
format(log, sizeof(log), "[%s] %s has suicided. [%f %f %f] [World: %d, Int: %d] [Location: %s].", ReturnDate(), ReturnName(playerid), pX, pY, pZ, GetPlayerVirtualWorld(playerid), GetPlayerInterior(playerid), GetPlayerLocation(playerid));
}
}
printf(log);
return true;
}
|
|
|
error 029: invalid expression, assumed zero |
Posted by: mouiz - 2019-05-27, 04:52 PM - Forum: Pawn Scripting
- Replies (4)
|
 |
Here is an array containing points for a polygon:
Code: new Float: ZombieZone [MAX_ZONES][] = {
{ 2595.0,52.0,2594.0,31.0,2569.0,31.0,2568.0,-16.0,2524.0,-19.0,2523.0,-48.0,2454.0,-50.0,2453.0,-75.0,2356.0,-76.0,2355.0,-106.0,
2332.0,-107.0,2333.0,-145.0,2234.0,-145.0,2234.0,-108.0,2213.0,-100.0,2176.0,-101.0,2175.0,-25.0,2176.0,52.0,2183.0,117.0,2220.0,149.0,
2221.0,191.0,2271.0,190.0,2272.0,183.0,2296.0,183.0,2304.0,203.0,2323.0,222.0,2357.0,222.0,2383.0,203.0,2408.0,133.0,2447.0,147.0,
2548.0,147.0,2571.0,102.0,2595.0,52.0 },
{ 1229.0,113.0,1311.0,128.0,1400.0,192.0,1431.0,211.0,1442.0,238.0,1431.0,278.0,1525.0,361.0,1502.0,399.0,1419.0,465.0,1356.0,493.0,
1303.0,419.0,1221.0,368.0,1190.0,297.0,1182.0,231.0,1185.0,146.0,1229.0,113.0 },
{ 861.0,-636.0,871.0,-612.0,870.0,-577.0,831.0,-481.0,727.0,-435.0,651.0,-437.0,591.0,-475.0,591.0,-541.0,607.0,-614.0,655.0,-652.0,
861.0,-636.0 },
{ 270.0,-315.0,326.0,-258.0,378.0,-160.0,379.0,-61.0,337.0,-10.0,354.0,62.0,349.0,68.0,334.0,70.0,240.0,55.0,201.0,43.0,
135.0,-8.0,123.0,-76.0,79.0,-147.0,77.0,-203.0,17.0,-219.0,-236.0,-175.0,-251.0,-214.0,-249.0,-249.0,-117.0,-392.0,18.0,-397.0,
18.0,-344.0,203.0,-345.0,270.0,-315.0 },
{ -21.0,-1122.0,-41.0,-1160.0,-56.0,-1158.0,-83.0,-1222.0,-104.0,-1217.0,-99.0,-1201.0,-135.0,-1187.0,-89.0,-1095.0,-21.0,-1122.0 },
{ -631.0,-1300.0,-665.0,-1689.0,-707.0,-1725.0,-775.0,-1692.0,-776.0,-1296.0,-745.0,-1258.0,-684.0,-1292.0,-631.0,-1300.0 },
{ -303.0,-2140.0,-259.0,-2138.0,-253.0,-2174.0,-246.0,-2249.0,-308.0,-2269.0,-344.0,-2158.0,-303.0,-2140.0 },
{ 148.0,-1743.0,346.0,-1741.0,384.0,-1777.0,463.0,-1751.0,642.0,-1776.0,711.0,-1809.0,711.0,-1916.0,398.0,-1908.0,399.0,-1933.0,380.0,-1933.0,
380.0,-2011.0,400.0,-2013.0,400.0,-2047.0,408.0,-2047.0,410.0,-2089.0,348.0,-2089.0,348.0,-2047.0,359.0,-2047.0,359.0,-2038.0,352.0,-2038.0,
352.0,-2024.0,359.0,-2024.0,360.0,-1902.0,167.0,-1892.0,165.0,-1935.0,177.0,-1951.0,166.0,-1970.0,142.0,-1972.0,130.0,-1952.0,143.0,-1934.0,
148.0,-1743.0 },
{ 2764.0,-2187.0,2764.0,-2251.0,2811.0,-2330.0,2810.0,-2566.0,2775.0,-2581.0,2721.0,-2581.0,2666.0,-2566.0,2526.0,-2697.0,2482.0,-2713.0,2427.0,-2713.0,
2374.0,-2698.0,2275.0,-2706.0,2148.0,-2705.0,2150.0,-2657.0,2170.0,-2631.0,2184.0,-2589.0,2186.0,-2504.0,2185.0,-2433.0,2204.0,-2384.0,2294.0,-2293.0,
2391.0,-2205.0,2432.0,-2183.0,2764.0,-2187.0 },
{ 1753.0,-1601.0,1420.0,-1601.0,1448.0,-1430.0,1723.0,-1432.0,1753.0,-1601.0 },
{ 2849.0,-265.0,2592.0,-331.0,2676.0,-455.0,2914.0,-566.0,2849.0,-265.0 },
{ 1687.0,-262.0,1692.0,-374.0,1715.0,-483.0,1740.0,-499.0,1727.0,-638.0,1709.0,-773.0,1717.0,-816.0,1663.0,-795.0,1695.0,-667.0,1694.0,-563.0,
1684.0,-473.0,1663.0,-370.0,1651.0,-289.0,1652.0,-177.0,1687.0,-262.0 }
};
Here is the code for making the polygon (s)
Code: for (new i = 0; i < MAX_ZONES; i)
{
? ? Z_Zone [i] = CreateDynamicPolygon (ZombieZones [i][]);
}:
But im getting this error:?
Code: error 029: invalid expression, assumed zero
Any way how to fix this?
|
|
|
Client/Server Crash Format |
Posted by: JustMichael - 2019-05-27, 03:21 PM - Forum: Support
- No Replies
|
 |
Information
This will be our official format thread for crashes caused by the?SA-MP Client or Server. You should follow this format if you have experienced a crash and would like help in getting it solved. We
will advise all members to use this, and failing to do so, might mean that other members will be less inclined to help you.
This format ensures that the OP (original poster), provides all the needed details to his/her case so that we as a community can provide the correct support. The following code block
will provide you with the needed text. You can copy and paste this text into your thread and then alter it to provide information about your case.
Client Format
Code: [color=#ff33cc]Type:[/color] Client
[color=#ff33cc]Crash Code:[/color] 0x00000000
[color=#ff33cc]Crash Extra Information:[/color] <paste a link to hastebin/pastebin with the error from the crash dialog box>
[color=#ff33cc]Client Version:[/color] 0.3.7 R2
[color=#ff33cc]Mods Installed:[/color] Yes/No
[color=#ff33cc]Mods (if above is yes):[/color]
crashfix - [url=https://github.com/Whitetigerswt/gtasa_crashfix/releases]https://github.com/Whitetigerswt/gtasa_crashfix[/url]
[color=#ff33cc]Explanation (Be detailed yet simple in your answers):[/color]
I spawned in San Fierro, walked around until I found a vehicle, upon entering that vehicle (turismo, modded wheels) my game crashed.
Server Format
Code: [color=#ff33cc]Type:[/color] Server
[color=#ff33cc]Operating System:[/color] Windows/Linux/Mac
[color=#ff33cc]Server Version:[/color] 0.3.7 R2-2
[color=#ff33cc]Plugins Installed:[/color] Yes/No
[color=#ff33cc]Plugins (If above is yes):[/color]
discord-connector - [url=https://github.com/maddinat0r/samp-discord-connector]https://github.com/maddinat0r/samp-discord-connector[/url]
PawnPlus - [url=https://github.com/IllidanS4/PawnPlus/]https://github.com/IllidanS4/PawnPlus/[/url]
[color=#ff33cc]YSI Included:[/color] Yes/No
[color=#ff33cc]Output (Logs):[/color] <paste a link to hastebin/pastebin with the logs included> (please remove any sensitive information)
Please make sure to use this format and to give as much information as possible
|
|
|
sampctl linux compiling |
Posted by: 6cadilab9 - 2019-05-27, 02:41 PM - Forum: Support
- Replies (13)
|
 |
Hello,?
So I switched to ubuntu 16.04 bc of my job and now I decided to move whole project on to sampctl because of its included linux compiler, now i installed all packages, setted the whole project up, and when i run
sampctl package build
the amx of 0 bytes is generated but nothing happens, i get nothing in the terminal it looks like its running but I don't believe that it's supposed to take this long especially with the machine im running it on
|
|
|
|