Welcome, Guest |
You have to register before you can post on our site.
|
Forum Statistics |
» Members: 6,510
» Latest member: nami16504
» Forum threads: 2,233
» Forum posts: 12,034
Full Statistics
|
Online Users |
There are currently 559 online users. » 1 Member(s) | 554 Guest(s) Bing, Yandex, Google, Discord, Polovzky
|
Latest Threads |
I humor myself
Forum: Programming
Last Post: nami16504
1 hour ago
» Replies: 5
» Views: 8,035
|
Command does not work in-...
Forum: Pawn Scripting
Last Post: PANZEHIR_
2024-11-23, 06:36 PM
» Replies: 0
» Views: 41
|
White Screen
Forum: Support
Last Post: Phat202146_real
2024-11-21, 02:50 PM
» Replies: 0
» Views: 39
|
I get error 021 using y_h...
Forum: Pawn Scripting
Last Post: daniscript18
2024-11-18, 11:34 PM
» Replies: 0
» Views: 60
|
Il reste des français sur...
Forum: French/Fran?ais
Last Post: tysanio
2024-11-18, 05:39 AM
» Replies: 2
» Views: 466
|
Object creation issues
Forum: Programming
Last Post: K1271
2024-11-15, 11:51 PM
» Replies: 0
» Views: 56
|
Is the SAMP Hosting the s...
Forum: General Discussions
Last Post: OperaGX
2024-11-14, 09:33 PM
» Replies: 0
» Views: 74
|
Run time error 19: "File ...
Forum: Pawn Scripting
Last Post: Rexey
2024-11-14, 03:50 AM
» Replies: 0
» Views: 65
|
How to Compile Your Gamem...
Forum: Tutorials
Last Post: thelante
2024-11-13, 08:50 AM
» Replies: 3
» Views: 470
|
Modeller wanted
Forum: Development Updates
Last Post: acc.gangbeni
2024-11-11, 05:10 PM
» Replies: 9
» Views: 16,504
|
|
|
Very specific problem regarding file functions and y_hooks |
Posted by: Plastikmensch - 2019-10-09, 10:35 AM - Forum: Pawn Scripting
- No Replies
|
|
So... I don't really know if it is even script related or a bug with samp, y_hooks or sampctl.
TL;DR: hook of CreateMenu doesn't get called when file functions (fwrite, fread etc..) are also hooked
Problem description:
Setup: 2 local Servers, only difference: server 1 uses sampctl, server 2 doesn't
Exact same code:
include file:
Code: #include <a_samp>
#include <YSI_Coding\y_hooks>
hook function fclose(File:handle)
{
? ?if(handle) return continue(handle);
? ?printf("Invalid handle passed to fclose!");
? ?return ~0;
}
hook function fwrite(File:handle, const string[])
{
? ?if(handle) return continue(handle, string);
? ?printf("Invalid handle passed to fwrite!");
? ?return ~0;
}
hook function fread(File:handle, string[], size = sizeof string, bool:pack = false)
{
? ?if(handle) return continue(handle, string, size, pack);
? ?printf("Invalid handle passed to fread!");
? ?return ~0;
}
hook function fputchar(File: handle, value, bool: utf8 = true)
{
? ?if(handle) return continue(handle, value, utf8);
? ?printf("Invalid handle passed to fputchar!");
? ?return ~0;
}
hook function fgetchar(File: handle, value, bool: utf8 = true)
{
? ?if(handle) return continue(handle, value, utf8);
? ?printf("Invalid handle passed to fgetchar!");
? ?return ~EOF;
}
hook function fblockwrite(File: handle, const buffer[], size = sizeof buffer)
{
? ?if(handle) return continue(handle, buffer, size);
? ?printf("Invalid handle passed to fblockwrite!");
? ?return ~0;
}
hook function fblockread(File: handle, buffer[], size = sizeof buffer)
{
? ?if(handle) return continue(handle, buffer, size);
? ?printf("Invalid handle passed to fblockread!");
? ?return ~0;
}
hook function fseek(File: handle, position = 0, seek_whence:whence = seek_start)
{
? ?if(handle) return continue(handle, position, whence);
? ?printf("Invalid handle passed to fseek!");
? ?return ~0;
}
hook function flength(File: handle)
{
? ?if(handle) return continue(handle);
? ?printf("Invalid handle passed to flength!");
? ?return ~0;
}
hook function CreateMenu(const title[], columns, Float:x, Float:y, Float:col1width, Float:col2width = 0.0)
{
? ?print("hook called");
}
Gamemode:
Code: #include <a_samp>
#include <test>
main()
{
}
public OnGameModeInit()
{
? ?new Menu:test = CreateMenu("Your Menu", 2, 200.0, 100.0, 150.0, 150.0);
? ?return 1;
}
Result server 1: nothing
Result server 2: hook called
When I delete (or comment out) the file hooks in server 1, it prints, but only then.
It doesn't make any difference in server 2.
So... can someone confirm this issue and/or has any solution or any idea why this happens?
I'm out of ideas.
Can provide more information if needed.
(btw. are code tags broken when using formatting?)
//Update:
It works in server 1 when the CreateMenu hook is placed before the file hooks. Still don't know why this happens...
But didn't test yet, if the file hooks are called when switched place.
Will do more tests, after I finish the include, but seems like this isn't a scripting related problem.
If someone wants to move this thread to the appropriate section, I'd be thankful.
On a side note: if(handle) should be if(handle > 0). It's very unlikely a negative handle is passed by accident, but would still crash.
//Update2:
After adding some more hooks, CreateMenu wasn't called again.
I commented out the hook right after it (in this case DestroyMenu) and it got called again.
Oh, and tested file functions and none of them gets called.
So... I still don't know why, but it seems it has nothing to do with the script or hooks itself.
Also should add that I added a print to the gamemode in the meantime to print menuid and it is printing -2 now, which is very odd.
//Update3:
I give up. I can't find out why this happens.
Creating a third server using sampctl, running code works, still not in server 1 (Again same code).
Also it seems random which hook doesn't get called depending on where it's placed.
Can be more precise, but I don't see the point anymore.
Only assumption I can make is that it doesn't even matter what is hooked.
Solved the return of -2: I returned the menuid of created menu and used "return ~menuid", remove "~" and it returns the correct value.
|
|
|
Centos 7 screen help |
Posted by: Salesman - 2019-10-08, 06:26 PM - Forum: Support
- Replies (1)
|
|
Hello, I try to run my SA-MP server on Centos 7 with screen command but when I try it just says screen terminated it worked before but I had trouble with libstdc but now it doesn't start the server like it should have.
|
|
|
MySQL Weapon save custom |
Posted by: Zow - 2019-09-30, 04:17 PM - Forum: Pawn Scripting
- Replies (1)
|
|
They saved every weapon from the server after disconnected
But I wants them to custom save
exam: /getgun from the gang = not save
/weapon = save
sorry for my bad explain I don't know how to explain to be clear
PHP Code: public OnPlayerDisconnect(playerid, reason)
{
for (new i = 0; i <= 12; i)
{
? ?GetPlayerWeaponData(playerid, i, weapons1[i][0], weapons1[i][1]);
? ?if(!weapons1[i][0]) continue; // don't insert if there's no weapon in this slot
mysql_format(dbCon, query, sizeof(query), "INSERT INTO `WeaponData` (ID, WeaponID, Ammo) VALUES (%d, %d, %d) ON DUPLICATE KEY UPDATE `Ammo` = `Ammo` %d", PlayerInfo[playerid][pSQLID], weapons1[i][0], weapons1[i][1], weapons1[i][1]);
mysql_query(dbCon, query);
printf("weapon: %d, ammo: %d", weapons1[i][0], weapons1[i][1]);
}
return 1;
}
PHP Code: ?if(strcmp(cmd, "/weapon", true) == 0)
?{
???? GivePlayerWeapon(playerid, 24, 500);
???? GivePlayerWeapon(playerid, 30, 500);
???? GivePlayerWeapon(playerid, 8, 1);
?}
PHP Code: ?if(strcmp(cmd, "/getgun", true) == 0)
?{
???? GivePlayerWeapon(playerid, 24, 500);
???? GivePlayerWeapon(playerid, 30, 500);
???? GivePlayerWeapon(playerid, 8, 1);
?}
|
|
|
Block/reject queries with opcode 'c' using iptables |
Posted by: AdrianBZG - 2019-09-27, 09:03 AM - Forum: Support
- No Replies
|
|
Hi,
I have seen some servers that even tho they have less than 100 players, the players are not listed in the server browser. This is obviously a measure against UDP query flood to the server.
I was wondering if someone could help me or tell me how to do the exact same thing.
Does this require to block SAMP UDP packets with a specific opcode using iptables, e.g. opcode 63 (flag c), which is the one that gives the players info? See?https://wiki.sa-mp.com/wiki/Query_Mechanism#Opcodes?for info about opcodes.
I tried with this iptables rules, but it's not working, I still get the server info in the server browser:
iptables -I INPUT -p udp --dport 7777 -m string --algo kmp --hex-string '|53414d50|' -m string --algo kmp --hex-string '|611e63|' -j DROP
I'm not sure how to do that, please help.
Thanks.
|
|
|
pawno no respond |
Posted by: nbx2000 - 2019-09-27, 04:05 AM - Forum: Pawn Scripting
- No Replies
|
|
hello everyone I had a problem compiling it locks but compiles the scrip. important I test with another server that downloads and also does the same thing pawno does not respond but compiles ... why did this happen ???
|
|
|
Bank Robbery System [HELP!] |
Posted by: Fuzzy - 2019-09-24, 12:37 PM - Forum: Pawn Scripting
- Replies (1)
|
|
PHP Code: // Bank Robbery
new robbing[MAX_PLAYERS];
new alreadyrobbed[MAX_PLAYERS];
new robbingTimer[MAX_PLAYERS];
forward bankrob(playerid);
forward robbedoff(playerid);
public bankrob(playerid)
{
? ?new robcash = random(25000) 35000;
? ?SendClientMessage(playerid, COLOR_WHITE, " Your finished robbing the bank, Run now");
? ?GiveMoney(playerid, robcash);
? ?//SendClientMessage(playerid, COLOR_WHITE, "You've been rob {33CC33}%s{FFFFFF}Dollars from the bank vault.", FormatNumber(robcash));
? ?alreadyrobbed[playerid] = 1;
? ?robbing[playerid] = 0;
? ?robbingTimer[playerid] = SetTimerEx("robbedoff", 3600000, false, "i", playerid);
? ?SendClientMessageToAll(COLOR_ORANGE, "||----------Latest News----------||");
? ?SendClientMessageToAll(COLOR_WHITE, " It looks like the bankrobber got the cash.");
? ?SendClientMessageToAll(COLOR_WHITE, " The cops is currently waiting outside.");
? ?SendClientMessageToAll(COLOR_ORANGE, "||----------Latest News----------||");
? ?return 1;
}
public robbedoff(playerid)
{
? ?alreadyrobbed[playerid] = 0;
? ?SendClientMessage(playerid, COLOR_WHITE, " You can now rob the bank again [/report to ask an admin to approve.]");
? ?return 1;
}
PHP Code: public OnPlayerDeath(playerid, killerid, reason)
{
? ?// Bank Robbey
? ?KillTimer(robbingTimer[playerid]);
? ?robbing[playerid] = 0;
? ?SendClientMessageToAll(COLOR_ORANGE, "||----------Latest News----------||");
? ?SendClientMessageToAll(COLOR_WHITE, " Los Santos Police have been caught the suspect. ");
? ?SendClientMessageToAll(COLOR_ORANGE, "||----------Latest News----------||");
return 1;
}
PHP Code: public OnPlayerDisconnect(playerid, reason)
{
? ?/*// Bank Robbey
? ?KillTimer(robbingTimer[playerid]);
? ?robbing[playerid] = 0;
? ?SendClientMessageToAll(COLOR_ORANGE, "||----------Latest News----------||");
? ?SendClientMessageToAll(COLOR_WHITE, " Los Santos Police have been caught the suspect. ");
? ?SendClientMessageToAll(COLOR_ORANGE, "||----------Latest News----------||");*/
PHP Code: CMD:robbank(playerid, params[])
{
if(robbing[playerid] == 1)
? ? ? return SendErrorMessage(playerid, " You are already robbing the bank, please slow down");
? ?if(alreadyrobbed[playerid] == 1)
? ? ? return SendErrorMessage(playerid, "You already robbed the bank! Wait 1 hour.");
? ? ? ? ? ? ?
? if (!Inventory_HasItem(playerid, "C4"))
? ? ? return SendErrorMessage(playerid, "You don't have a C4.");
? ? ? ? ? ?
? ?if(!IsPlayerInRangeOfPoint(playerid, 5.0, 1435.3354,-981.6418,983.6462)) return SendErrorMessage(playerid, "You are not at the bank !");
? ?SendClientMessage(playerid, COLOR_WHITE, " You started to rob the bank, This will take 10 minutes");
? ?SetTimerEx("bankrob", 600000, false, "i", playerid);
? ?robbing[playerid] = 1;
? ?Inventory_Remove(playerid, "C4");
? ?SendClientMessageToAll(COLOR_ORANGE, "||----------Latest News----------||");
? ?SendClientMessageToAll(COLOR_WHITE, " The bank is currently getting robbed.");
? ?SendClientMessageToAll(COLOR_WHITE, " Los Santos Police units are on the way.");
? ?SendClientMessageToAll(COLOR_WHITE, " We will report more when we get more information");
? ?SendClientMessageToAll(COLOR_ORANGE, "||----------Latest News----------||");
? ?return 1;
}
when player die/quit its gives the msg of the suspect is down but if he stays online for 10min he still get the cash and also if he's relog after quiting he still get the cash after 10 minutes.
Also sometimes the?" Los Santos Police have been caught the suspect. " message showing for no reason
Have any idea how to fix it?
|
|
|
Server is starting, but not visible in the client |
Posted by: Luciano - 2019-09-23, 08:47 PM - Forum: Support
- Replies (1)
|
|
Hello, I'm trying to run a server on VPS running CentOS 7 64bit.
I'm trying with the default SA-MP package, so the default game modes and everything. The server is starting (server log is fine), but it's not responding in the client.
Permissions are fine, I don't use any plugins, and I added "bind [ipaddress]" and "announce 1" in the server.cfg.
|
|
|
|