Re: Little coding questions - For general minor queries 5 -
Marko Koprivanac - 16.01.2020
Quote:
Originally Posted by Calisthenics
Use single quotes around strings '%s' and '%e'
By the way, you do not need LIMIT clause if `ID` is PRIMARY KEY (which should be).
|
I tried that before posting, tried every type of format, with ' ' and without in whole query, still no results, i used print to debug and password get hashed, salt changes, but for some reason it does not get updated, i don't know why.
I will open new thread so we don't spam this one so much, if you think you can help take a look.
Re: Little coding questions - For general minor queries 5 -
Marko Koprivanac - 26.01.2020
Hi does someone know what does this warning mean:
Code:
jit.inc(35) : warning 231: state specification on forward declaration is ignored
The line 35 in jit.inc include is:
Code:
forward OnJITCompile();
Re: Little coding questions - For general minor queries 5 -
Runn3R - 31.01.2020
Are you using the lastest version of it?
Re: Little coding questions - For general minor queries 5 -
v4yne1 - 13.03.2020
Can one NPC be used for more players at once?
for instance, I want to make an airplane flight intro before registration process
what if more players started the registration process (npc intro) at the same time, what would happen? how to counter that? ty
Re: Little coding questions - For general minor queries 5 -
David (Sabljak) - 11.04.2020
Code:
Header size: 24996 bytes
Code size: 4612988 bytes
Data size: 25335180 bytes
Stack/heap size: 16384 bytes; estimated max. usage=4110 cells (16440 bytes)
Total requirements:29989548 bytes
Is this optimized?
AMX 9 MB
Freeroam/Deatmatch script - For about 80k lines.
Re: Little coding questions - For general minor queries 5 -
Runn3R - 14.04.2020
Quote:
Originally Posted by v4yne1
Can one NPC be used for more players at once?
for instance, I want to make an airplane flight intro before registration process
what if more players started the registration process (npc intro) at the same time, what would happen? how to counter that? ty
|
Its an old post but i'd like to answer it.
You can join the same npc but i wouldn't reccomend that. Have you tried using plane objects from samp and instead of NPC-s move them? Or making a new model of the plane and implementing it trough 0.3DL and then using it?
Re: Little coding questions - For general minor queries 5 -
GeoV - 14.04.2020
Hello there
Just started playing with pawno first ever in my life and I get the "undefined symbol" after I try to compile a script
Quote:
nscript.pwn(26) : error 017: undefined symbol "cmdtext"
|
Code:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
if (!strcmp(cmdtext, "/randomc", true))
{
ChangeVehicleColor(vehicleid, 0, 1);
ShowPlayerDialog(playerid, 1, DIALOG_STYLE_MSGBOX, "INFO", "You got your car colored", "OK","YE");
}
return SendClientMessage(playerid,0xffffffff,"You aren't probably in a car.");
}
Never mind the condition itself, I'm just concerned about that undefined symbol
Thanks a lot
Re: Little coding questions - For general minor queries 5 -
Runn3R - 14.04.2020
well you are trying to place a command inside the OnPlaeyrEnterVehicle callback hence the error as the string doesn't exits.
Commands go under OnPlayerCommandText
Re: Little coding questions - For general minor queries 5 -
GTLS - 18.04.2020
Quote:
Originally Posted by v4yne1
Can one NPC be used for more players at once?
for instance, I want to make an airplane flight intro before registration process
what if more players started the registration process (npc intro) at the same time, what would happen? how to counter that? ty
|
Create NPCs and object in different Virtual world. It solves the issue..
Re: Little coding questions - For general minor queries 5 -
Electrifying - 22.04.2020
What _: Means? Why and when should I use it?
Re: Little coding questions - For general minor queries 5 -
Nero_3D - 23.04.2020
Quote:
Originally Posted by Electrifying
What _: Means? Why and when should I use it?
|
It is somewhat explained here ->
https://sampwiki.blast.hk/wiki/Scripting:tags
But to make it short it is usually used to overwrite tags
pawn Code:
new MyTag: myvar;
if(_: myvar == 0) {
print("yay");
}
Re: Little coding questions - For general minor queries 5 -
Electrifying - 27.04.2020
Does anyone here can send me the link of ps-format?
Is it still useful to this day?
Re: Little coding questions - For general minor queries 5 -
Nero_3D - 27.04.2020
Quote:
Originally Posted by Electrifying
Does anyone here can send me the link of ps-format?
Is it still useful to this day?
|
Took me literally one search to find it, on the second last page of the main thread attached to this reply
Quote:
Originally Posted by RogueDrifter
There you go guys enjoy it ^^
|
If it is useful, depends, packed strings are only useful if you plan to save a lot of long string globally and you want to save a bit of memory otherwise not
Re: Little coding questions - For general minor queries 5 -
Calinut200 - 23.05.2020
how to rezolve?
PHP Code:
if(PlayerText:linia11 == strcmp("PLD_SLOT:r_69","LD_SLOT:r_69"))
warning 213: tag mismatch: expected tag "PlayerText", but found none ("_")
Re: Little coding questions - For general minor queries 5 -
SkyFlare - 24.06.2020
How to make unbreakable atm machines/objects?, this example isnt working below
Code:
DynamicAtms[atmid][ObjectID] = CreateDynamicObject(DynamicAtms[atmid][ModelID], DynamicAtms[atmid][PosX], DynamicAtms[atmid][PosY], DynamicAtms[atmid][PosZ], 0.0, 0.0, 0.0, 0, 0, -1, 100.0);
SetDynamicObjectMaterialText(DynamicAtms[atmid][ObjectID],0,"None",50," Arial",24,0,0,0,1);
would be nice to know how this works, thanks in advance.
Re: Little coding questions - For general minor queries 5 -
Alpays - 21.07.2020
what is the difference between
new Float:TDMSpawn[][] =
{
{1,1,1,1},
{1,1,1,1)
}
and
new Float:TDMSpawn[2][4] =
{
{1,1,1,1},
{1,1,1,1)
}
Re: Little coding questions - For general minor queries 5 -
RoboN1X - 21.07.2020
Quote:
Originally Posted by Alpays
what is the difference between
new Float:TDMSpawn[][] =
{
{1,1,1,1},
{1,1,1,1)
}
and
new Float:TDMSpawn[2][4] =
{
{1,1,1,1},
{1,1,1,1)
}
|
The first one will have the compiler calculate the array size based on the initializer, thus it will technically becomes [2][4]. It is only possible if the initial values are declared, so you cant just have:
Code:
new Float:TDMSpawn[][];
The second will have fixed amount array size as you specified, which is [2][4]... giving [1][3] will result error because the array size mismatch and giving more like [3][5] will result a warning because the array must be fully initialized.
Since the array size is explicit, you can declare without initial value, so you can have:
Code:
new Float:TDMSpawn[2][4];
which will have all 0 for initial values.
Note that it is possible to have
Code:
new Float:TDMSpawn[][4] =
{
{1,1,1,1},
{1,1,1,1}
}
In case you will be adding more tdm spawn rows in the initializer but dont want to accidentally change the column size
Code:
new Float:TDMSpawn[][4] =
{
{1,1,1,1},
{1,1,1,1},
{1,1,1,1} // ok
}
Code:
new Float:TDMSpawn[][4] =
{
{1,1,1,1},
{1,1,1,1},
{1,1,1} // error
}
Check out the pawn-lang.pdf documentation
Re: Little coding questions - For general minor queries 5 -
Dignity - 22.07.2020
What would be the most efficient way of removing dynamic objects attached to a vehicle, for ANY vehicle?
I've got more than 10,000 objects easily in my server, so a loop is not ideal...
The only "true" way to consider all objects is by hooking CreateObject, storing the value in a variable and then looping through it, using Streamer_GetIntData to match the vehicle ID and then remove it however considering the amount of objects I have this would end up being very laggy and bad for server performance...
Any alternatives?
Re: Little coding questions - For general minor queries 5 -
coool - 25.07.2020
Quote:
Originally Posted by Dignity
What would be the most efficient way of removing dynamic objects attached to a vehicle, for ANY vehicle?
I've got more than 10,000 objects easily in my server, so a loop is not ideal...
The only "true" way to consider all objects is by hooking CreateObject, storing the value in a variable and then looping through it, using Streamer_GetIntData to match the vehicle ID and then remove it however considering the amount of objects I have this would end up being very laggy and bad for server performance...
Any alternatives?
|
PHP Code:
new AttachedObjects[MAX_VEHICLES][100];
hook AttachObjectToVehicle()
{
new free_slot;
for (free_slot = 0; free_slot < sizeof AttachedObjects[vehicled]; free_slot++)
if (AttachedObjects[vehicled][free_slot] == 0) break;
AttachedObjects[vehicleid][free_slot] = objectid;
}
DestroyObjectsAttachedToVehicle(vehicleid)
{
for (new i; i < sizeof AttachedObjects[vehicleid]; i++)
DestroyObject(AttachedObjects[vehicleid][i])
}
What do you think about this alternative? This loops over only the objects attached to a vehicle.
Re: Little coding questions - For general minor queries 5 -
Dignity - 02.08.2020
Quote:
Originally Posted by coool
PHP Code:
new AttachedObjects[MAX_VEHICLES][100];
hook AttachObjectToVehicle()
{
new free_slot;
for (free_slot = 0; free_slot < sizeof AttachedObjects[vehicled]; free_slot++)
if (AttachedObjects[vehicled][free_slot] == 0) break;
AttachedObjects[vehicleid][free_slot] = objectid;
}
DestroyObjectsAttachedToVehicle(vehicleid)
{
for (new i; i < sizeof AttachedObjects[vehicleid]; i++)
DestroyObject(AttachedObjects[vehicleid][i])
}
What do you think about this alternative? This loops over only the objects attached to a vehicle.
|
Looks good. I thought of doing it in a similar fashion but not using the same loop... this saved me some headache thanks a lot.