Little coding questions - For general minor queries 5

Quote:
Originally Posted by Garavel
View Post
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.

Reply

Quote:
Originally Posted by BanhVo
View Post
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.
Reply

Quote:
Originally Posted by Infra
View Post
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
Reply

Quote:
Originally Posted by Garavel
View Post
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
Reply

CreateActor and CreateDynamicActor follow the same id incrementation or it's separate?
Reply

Quote:
Originally Posted by Dayrion
View Post
CreateActor and CreateDynamicActor follow the same id incrementation or it's separate?
It's a different ID increment.
Reply

Quote:
Originally Posted by ThePhenix
View Post
It's a different ID increment.
Yes, still weird. Sometimes it does, sometimes it doesn't or it's maybe my code ahah
Reply

Is there any problems if I do this?

PHP Code:
CreateVehicleEx__(typeFloat:xFloat:yFloat:zFloat:ac1c2respawn=300addsiren=0)
{
    new 
q;
    if((
CreateVehicle(typexyzac1c2respawnaddsiren)) == INVALID_VEHICLE_ID) return INVALID_VEHICLE_ID;
    
CallLocalFunction("OnVehicleCreate""iiffffiiii"qtypexyzac1c2respawnaddsiren);
    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
Reply

Quote:
Originally Posted by GaByM
View Post
Is there any problems if I do this?

PHP Code:
CreateVehicleEx__(typeFloat:xFloat:yFloat:zFloat:ac1c2respawn=300addsiren=0)
{
    new 
q;
    if((
CreateVehicle(typexyzac1c2respawnaddsiren)) == INVALID_VEHICLE_ID) return INVALID_VEHICLE_ID;
    
CallLocalFunction("OnVehicleCreate""iiffffiiii"qtypexyzac1c2respawnaddsiren);
    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?
Reply

Do I need to hide textdraws onplayerdisconnect?
Reply

Quote:
Originally Posted by GospodinX
View Post
Do I need to hide textdraws onplayerdisconnect?
Yes, otherwise it will be bugged for player who joins after him.
Reply

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?
Reply

Could be an error in your code. Do you mind sharing it?
Reply

Quote:
Originally Posted by ISmokezU
View Post
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.
Reply

Am I retarded?
PHP Code:
new Float:fPos[3];
fPos = {2487.25122401.240211.4465}; 
Code:
A:\path\gm.pwn(2) : warning 213: tag mismatch
Reply

Code:
new strNames[500][4][MAX_PLAYER_NAME];
How resource heavy is an array like this one (if any)?
Reply

Quote:
Originally Posted by Amads
View Post
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)
Reply

use a 'where' clause
PHP код:
SELECT `nameFROM `accountsWHERE `account id` = 0
//accounts is the name of table where you store your Users' data. 
Reply

And to show it in a message?
Reply

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.
Reply


Forum Jump:


Users browsing this thread: 22 Guest(s)