Little coding questions - For general minor queries 5
#1

The last topic was getting full so I decided to make a new one again.
Use the search on the forums to search for your question before posting here. Chances are its already be answered.

Part 1: Missing in action
Part 2: Missing in action
Part 3: Missing in action
Part 4: Missing in action

Don't paste big scripts in that topic, use pastebin for that.
If you don't know how to port your script to 0.2, post/ask in the 0.1 to 0.2 topic.

First help should be ALWAYS the IRC-channel irc.sa-mp.com #sa-mp.scripting. If you can't join use this thread as place to ask if you need some help with a code snippet or something doesn't work. Scripting Beginners should check the intro first.
Reply
#2

Can filterscripts been called from a gm? Is there something that will get return the running FS?
Reply
#3

You can load a fs from the gamemode using SendRconCommand
Reply
#4

Yes there is.. native function.. GetServerVarAsString will do it..

GetServerVarAsString( "Filterscripts", buffer[], len );
Reply
#5

Quote:
Originally Posted by !damo!spiderman
Yes there is.. native function.. GetServerVarAsString will do it..

GetServerVarAsString( "Filterscripts", buffer[], len );
Oke, thanks!
Reply
#6

Ya, but when you use GetServerVarAsString("filterscripts".. it returns only the first on the line, as with gamemode0 etc, it doesn't return the 'repeat number', it seem to ignore all after the space
Reply
#7

My script reboots itself upon the script ending and the team finishing the objective, sometimes the server crashes though whilst reloading the script, is this a SA:MP instability or a script erorr?
Reply
#8

Script most likely.
Reply
#9

Hi there

I have a menu option for my script
When i click the option nothing happens
Why is this?

pawn Code:
case 0:{
     SendClientMessage(playerid,COLOR_LIGHTBLUE,"[!]Teleported to: SF Biffin Bridge Hotel");
     HideMenuForPlayer(sftp, playerid);
     if(IsPlayerInAnyVehicle(playerid)) {
        new vid =GetPlayerVehicleID(playerid);
        SetVehiclePos(vid,-2456.4417,137.2120,34.8212);
     }else{
         SetPlayerPos(playerid,-2456.4417,137.2120,34.8212);
        }
      }
Is the option.
Reply
#10

[SCF]ConTron:

if it doesn't show the SendClientMessage, you're doing something wrong somewhere else. Plus you don't need HideMenu in the callback for when a row was selected. (however it may be called)
Reply
#11

Quote:
Originally Posted by mabako
[SCF]ConTron:

if it doesn't show the SendClientMessage, you're doing something wrong somewhere else. Plus you don't need HideMenu in the callback for when a row was selected. (however it may be called)
I dont get it though, i copied it from a working bit of the menu. I just dont know why it dosent teleport me
Reply
#12

Are there any known limits on how many people can be banned? I mean, surely eventually the samp ban file will become so big it'll be hard to read, and slow down stuff, yes/no?

(Sorry, I'm just trying to debug my servers instability and my SSH reporting weird errors)
Reply
#13

We were just discussing this actually... a ban file of over 1000 you'll see a considerable amount of increase in cpu usage. For larger servers we'd probably suggest using a sqllite database to check for bans. Or just clear you ban file every couple of months
Reply
#14

For strings in enumerations, something like

Code:
enum e_test { bla[50] }
new test[e_test];
printf("sizeof bla = %i", sizeof(test[bla]));
works fine, but how would you get the size from a multidimensional array like

Code:
new test[10][e_test]
Reply
#15

Edit: sorry misread.
Reply
#16

pawn Code:
sizeof( test[0][bla] );
Replace 0 with whatever cell you want to check
Reply
#17

Code:
enum e_test { bla[50] }
new test[10][e_test];
printf("sizeof bla = %i", sizeof(test[0][bla]));
doesn't even compile
Reply
#18

Try
Code:
enum e_test { bla[50] }
new test[10][e_test];
printf("sizeof bla = %i", strlen(test[0][bla]));
I've got also question about multidimensional array but with enumeration. When I create for example array:
Code:
new ObjectInfo[200][oInfo];
that has enumeration:
Code:
enum oInfo
{
	realid[MAX_PLAYERS],
	modelid,
	Float:x,
	Float:y,
	Float:z,
	Float:rx,
	Float:ry,
	Float:rz,
	bool:isset[MAX_PLAYERS]
}
then I put numbers in and I print the modelid of first 8 dimensions from array
Code:
[15:57] 615
[15:57] 615
[15:57] 615
[15:57] 3249
[15:57] 3241
[15:57] 744
[15:57] 744
[15:57] 744
This is what I need. Everything is proper. But when I change

Code:
new ObjectInfo[200][oInfo];
to
Code:
new ObjectInfo[][oInfo];
I get printed
Code:
[15:58] 0
[15:58] 579
[15:58] 615
[15:58] 0
[15:58] 3241
[15:58] 744
[15:58] 744
[15:58] 744
As you can see few numbers are printed correctly, but rest not.

And here's my question, why does it happen. And I cannot use number to set number of dimensions, because I'd have to use 5000 which makes my script almost 2MB large.
Reply
#19

Ok but when I set number of dimensions I get 2MB amx... Is there any way to reduce this size?
Reply
#20

Did they clean up this topic?
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)