SA-MP Forums Archive
Little coding questions - For general minor queries 5 - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Little coding questions - For general minor queries 5 (/showthread.php?tid=30938)



Little coding questions - For general minor queries 5 - !damo!spiderman - 21.03.2008

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.


Re: Little coding questions - For general minor queries 5 - Antironix - 21.03.2008

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


Re: Little coding questions - For general minor queries 5 - !damo!spiderman - 21.03.2008

You can load a fs from the gamemode using SendRconCommand


Re: Little coding questions - For general minor queries 5 - !damo!spiderman - 21.03.2008

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

GetServerVarAsString( "Filterscripts", buffer[], len );


Re: Little coding questions - For general minor queries 5 - Antironix - 21.03.2008

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

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


Re: Little coding questions - For general minor queries 5 - yom - 21.03.2008

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


Re: Little coding questions - For general minor queries 5 - Redirect Left - 21.03.2008

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?


Re: Little coding questions - For general minor queries 5 - Pixels^ - 22.03.2008

Script most likely.


Re: Little coding questions - For general minor queries 5 - ConTron - 22.03.2008

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.


Re: Little coding questions - For general minor queries 5 - mabako - 22.03.2008

[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)


Re: Little coding questions - For general minor queries 5 - ConTron - 23.03.2008

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


Re: Little coding questions - For general minor queries 5 - Redirect Left - 24.03.2008

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)


Re: Little coding questions - For general minor queries 5 - !damo!spiderman - 24.03.2008

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


Re: Little coding questions - For general minor queries 5 - Dabombber - 25.03.2008

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]



Re: Little coding questions - For general minor queries 5 - yom - 25.03.2008

Edit: sorry misread.


Re: Little coding questions - For general minor queries 5 - !damo!spiderman - 25.03.2008

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


Re: Little coding questions - For general minor queries 5 - Dabombber - 25.03.2008

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


Re: Little coding questions - For general minor queries 5 - homie.pl - 25.03.2008

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.


Re: Little coding questions - For general minor queries 5 - homie.pl - 25.03.2008

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


Re: Little coding questions - For general minor queries 5 - Backwardsman97 - 28.03.2008

Did they clean up this topic?