Little coding questions - For general minor queries 5

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

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();
Reply

Are you using the lastest version of it?
Reply

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
Reply

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

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

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
Reply

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
Reply

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

What _: Means? Why and when should I use it?
Reply

Quote:
Originally Posted by Electrifying
View Post
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");
}
Reply

Does anyone here can send me the link of ps-format?
Is it still useful to this day?
Reply

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

how to rezolve?
PHP Code:
if(PlayerText:linia11 == strcmp("PLD_SLOT:r_69","LD_SLOT:r_69"))
 
warning 213tag mismatchexpected tag "PlayerText"but found none ("_"
Reply

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

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)
}
Reply

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

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

Quote:
Originally Posted by Dignity
View Post
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 0free_slot sizeof AttachedObjects[vehicled]; free_slot++)
        if (
AttachedObjects[vehicled][free_slot] == 0) break; 
    
AttachedObjects[vehicleid][free_slot] = objectid;
}
DestroyObjectsAttachedToVehicle(vehicleid)
{
    for (new 
isizeof AttachedObjects[vehicleid]; i++)
        
DestroyObject(AttachedObjects[vehicleid][i])

What do you think about this alternative? This loops over only the objects attached to a vehicle.
Reply

Quote:
Originally Posted by coool
View Post
PHP Code:
new AttachedObjects[MAX_VEHICLES][100];
hook AttachObjectToVehicle()
{
    new 
free_slot;
    for (
free_slot 0free_slot sizeof AttachedObjects[vehicled]; free_slot++)
        if (
AttachedObjects[vehicled][free_slot] == 0) break; 
    
AttachedObjects[vehicleid][free_slot] = objectid;
}
DestroyObjectsAttachedToVehicle(vehicleid)
{
    for (new 
isizeof 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.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)