Re: Little coding questions - For general minor queries 5 -
Infra - 18.01.2018
Quote:
Originally Posted by Garavel
I somehow managed to make all the cars in my gamemode invincible against bullet damage. They take collision damage fine but they ignore bullets... Can't remember what I did that might cause that. I run a TDM server so it is pretty important  Anyone have any idea what might be causing this? I know it is not setvehiclehealth, because I don't use it at all.
|
Try that:
pawn Code:
public OnPlayerWeaponShot(playerid, weaponid, hittype, hitid, Float:fX, Float:fY, Float:fZ)
{
if (hittype == BULLET_HIT_TYPE_VEHICLE)
return false;
return true;
}
Quote:
This callback is only called when lag compensation is enabled.
|
Re: Little coding questions - For general minor queries 5 -
coool - 19.01.2018
Quote:
Originally Posted by BanhVo
I still can not open it. I want to take the Faction Dog open. I made it into filterscripts. Help me .
|
Dog?
People are getting creative.
Re: Little coding questions - For general minor queries 5 -
Garavel - 19.01.2018
Quote:
Originally Posted by Infra
Try that:
pawn Code:
public OnPlayerWeaponShot(playerid, weaponid, hittype, hitid, Float:fX, Float:fY, Float:fZ) { if (hittype == BULLET_HIT_TYPE_VEHICLE) return false; return true; }
|
Doesn't that
make sure no vehicle is damaged though?
I need the opposite, I need the vehicles to do take damage from bullets
Re: Little coding questions - For general minor queries 5 -
Infra - 19.01.2018
Quote:
Originally Posted by Garavel
Doesn't that make sure no vehicle is damaged though?
I need the opposite, I need the vehicles to do take damage from bullets 
|
Got your post wrong , wops
Re: Little coding questions - For general minor queries 5 -
Dayrion - 19.01.2018
CreateActor and CreateDynamicActor follow the same id incrementation or it's separate?
Re: Little coding questions - For general minor queries 5 -
ThePhenix - 19.01.2018
Quote:
Originally Posted by Dayrion
CreateActor and CreateDynamicActor follow the same id incrementation or it's separate?
|
It's a different ID increment.
Re: Little coding questions - For general minor queries 5 -
Dayrion - 19.01.2018
Quote:
Originally Posted by ThePhenix
It's a different ID increment.
|
Yes, still weird. Sometimes it does, sometimes it doesn't or it's maybe my code ahah
Re: Little coding questions - For general minor queries 5 -
GaByM - 10.02.2018
Is there any problems if I do this?
PHP Code:
CreateVehicleEx__(type, Float:x, Float:y, Float:z, Float:a, c1, c2, respawn=300, addsiren=0)
{
new q;
if((q = CreateVehicle(type, x, y, z, a, c1, c2, respawn, addsiren)) == INVALID_VEHICLE_ID) return INVALID_VEHICLE_ID;
CallLocalFunction("OnVehicleCreate", "iiffffiiii", q, type, x, y, z, a, c1, c2, respawn, addsiren);
return q;
}
#if defined _ALS_CreateVehicle
#undef CreateVehicle
#else
#define _ALS_CreateVehicle
#endif
#define CreateVehicle CreateVehicleEx__
// later..
#include <YSI\y_hooks>
hook OnVehicleCreate(vehicleid)
{
// i don't need info about vehicle's spawn pos here, so there is just vehicleid as parameter.
}
I know it works and it compiles, but can this cause memory leaks / other problems?
EDIT: or if I use SetTimerEx instead of CallLocalFunction
Re: Little coding questions - For general minor queries 5 -
GaByM - 12.02.2018
Quote:
Originally Posted by GaByM
Is there any problems if I do this?
PHP Code:
CreateVehicleEx__(type, Float:x, Float:y, Float:z, Float:a, c1, c2, respawn=300, addsiren=0)
{
new q;
if((q = CreateVehicle(type, x, y, z, a, c1, c2, respawn, addsiren)) == INVALID_VEHICLE_ID) return INVALID_VEHICLE_ID;
CallLocalFunction("OnVehicleCreate", "iiffffiiii", q, type, x, y, z, a, c1, c2, respawn, addsiren);
return q;
}
#if defined _ALS_CreateVehicle
#undef CreateVehicle
#else
#define _ALS_CreateVehicle
#endif
#define CreateVehicle CreateVehicleEx__
// later..
#include <YSI\y_hooks>
hook OnVehicleCreate(vehicleid)
{
// i don't need info about vehicle's spawn pos here, so there is just vehicleid as parameter.
}
I know it works and it compiles, but can this cause memory leaks / other problems?
EDIT: or if I use SetTimerEx instead of CallLocalFunction
|
1. ^^^
2. mysql log-core.log:
Code:
[ERROR] signal 11 (SIGSEGV) catched; shutting log-core down (errno: 0, signal code: 1, exit status: 1)
What does this means?
Re: Little coding questions - For general minor queries 5 -
GospodinX - 28.02.2018
Do I need to hide textdraws onplayerdisconnect?
Re: Little coding questions - For general minor queries 5 -
KayJ - 04.03.2018
Quote:
Originally Posted by GospodinX
Do I need to hide textdraws onplayerdisconnect?
|
Yes, otherwise it will be bugged for player who joins after him.
Re: Little coding questions - For general minor queries 5 -
Aeny - 16.03.2018
First post after a long time of lurking.
It seems OnPlayerEnterVehicle doesn't get called when a player wants to enter a vehicle as driver and the doors are locked, but does get called when the doors are unlocked. OnPlayerEnterVehicle always gets called for passengers even when doors are locked.
Is this a known issue and is there a workaround for this? I know the animation not getting triggered is a known thing, but the callback not being called?
Re: Little coding questions - For general minor queries 5 -
ISmokezU - 16.03.2018
Could be an error in your code. Do you mind sharing it?
Re: Little coding questions - For general minor queries 5 -
Aeny - 19.03.2018
Quote:
Originally Posted by ISmokezU
Could be an error in your code. Do you mind sharing it?
|
Used following code to reproduce the issue I'm having
Code:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
new playerAnnouncement[128];
format(playerAnnouncement, sizeof(playerAnnouncement), "playerid %d attempted to enter vehicleId %d (passenger %d)", playerid, vehicleid, ispassenger);
SendClientMessage(playerid, 0xfffafa, playerAnnouncement);
return 1;
}
The rest of the script is just bare.pwn as included within the server download.
Re: Little coding questions - For general minor queries 5 -
Amads - 03.05.2018
Am I retarded?
PHP Code:
new Float:fPos[3];
fPos = {2487.2512, 2401.2402, 11.4465};
Code:
A:\path\gm.pwn(2) : warning 213: tag mismatch
Re: Little coding questions - For general minor queries 5 -
Amads - 06.05.2018
Code:
new strNames[500][4][MAX_PLAYER_NAME];
How resource heavy is an array like this one (if any)?
Re: Little coding questions - For general minor queries 5 -
Nero_3D - 06.05.2018
Quote:
Originally Posted by Amads
Code:
new strNames[500][4][MAX_PLAYER_NAME];
How resource heavy is an array like this one (if any)?
|
266000 Bytes = 259,765625 KiB - if global or static
or
10000 Bytes = 9,765625 KiB - if local, the remaining bytes will be allocated in stack
You can calculate the values by yourself or compile an empty file with this array and the -d3 flag (to get debug information)
Re: Little coding questions - For general minor queries 5 -
coool - 09.09.2018
use a 'where' clause
PHP код:
SELECT `name` FROM `accounts` WHERE `account id` = 0
//accounts is the name of table where you store your Users' data.
Re: Little coding questions - For general minor queries 5 -
KinderClans - 09.09.2018
And to show it in a message?
Re: Little coding questions - For general minor queries 5 -
0xAAAAAA - 20.09.2018
Hello. In a house system, when player stands near the entrance pickup of a house, and types /buyhouse, he gets a dialog, which he should either submit or cancel, if player submits it, then on response of this dialog there should be all the stuff with money and mysql queries. The problem is that when player types /buyhouse, server loops through all houses (which might be over 2000 on a server), to find at which house's entrance the player is at, then on respone of the dialog there is the same loop, to get id of the house again. So this is kind of ineficcient to do those 2 loops, a solution that comes to my mind is to store the id of the house in a special variable in player's enum when he types /buyhouse, then use the value in it in the ondialogresponse function, but is this a bad practice?
P.S. by id of house i mean the index of it in the array of houses, and i obviously need to change variables in it after it's purchased.