Re: Little coding questions - For general minor queries 5 -
karakana7 - 28.10.2010
Thank you guys, but now there's another small question.What is difference between () and [].Let's say we creating register/login system, so we need logged variable, and we are writing it with playerid, so it looks like that:logged[playerid].So playerid checks player id and finds it, but why we can't write it like this- logged(playerid)?
Re: Little coding questions - For general minor queries 5 -
Backwardsman97 - 28.10.2010
Because the brackets ([]) are used to reference an index in an array. While parenthesis are used for functions. Kinda hard to explain.
Re: Little coding questions - For general minor queries 5 -
karakana7 - 29.10.2010
Quote:
Originally Posted by Backwardsman97
Because the brackets ([]) are used to reference an index in an array. While parenthesis are used for functions. Kinda hard to explain.
|
But when to know when to put these "[]" or these "()"?
Re: Little coding questions - For general minor queries 5 -
Hiddos - 30.10.2010
Is it possible to set an "optional" parameter at a function? Just like the DrawDistance at CreateObject() is optional and has a default value if not set.
Re: Little coding questions - For general minor queries 5 -
marinov - 01.11.2010
How do I make all the players in a team move faster than normal ?
Re: Little coding questions - For general minor queries 5 -
Miguel - 01.11.2010
Quote:
Originally Posted by Hiddos
Is it possible to set an "optional" parameter at a function? Just like the DrawDistance at CreateObject() is optional and has a default value if not set.
|
https://sampforum.blast.hk/showthread.php?tid=186616
Re: Little coding questions - For general minor queries 5 -
Sexserghy - 08.01.2011
Quote:
Originally Posted by ******
Look for CreateVehicle, AddStaticVehicle and AddStaticVehicleEx, those are all the vehicle creation commands.
|
I delete all that but still i've got cars in script
Re: Little coding questions - For general minor queries 5 -
John_F - 08.01.2011
Then you have an FS/include that creates vehicles in the server.
EDIT:
Is there any SoundID that I can use with PlayerPlaySound that will play the sound of an explosion?
Checked the wiki but couldn't find an explosion sound.
Re: Little coding questions - For general minor queries 5 -
Coffeemonster - 09.01.2011
Wondering how I could script a private messaging system with a key? Like when player presses something it brings a dialog or something to type id/playername and then message to the ID.
Re: Little coding questions - For general minor queries 5 -
RAEN - 10.01.2011
How to stock SetTimerEx
pawn Код:
stock Test_SetTimerEx(funcname[], interval, repeating, const format[], {Float,_}:...)
{
SetTimerEx(?)
}
AW: Re: Little coding questions - For general minor queries 5 -
Nero_3D - 10.01.2011
Quote:
Originally Posted by NiZ
Wondering how I could script a private messaging system with a key? Like when player presses something it brings a dialog or something to type id/playername and then message to the ID.
|
With
OnPlayerKeyStateChange and ShowPlayerDialog - DIALOG_STYLE_INPUT
Quote:
Originally Posted by RAEN
How to stock SetTimerEx
pawn Код:
stock Test_SetTimerEx(funcname[], interval, repeating, const format[], {Float,_}:...) { SetTimerEx(?) }
|
you could do it with numarg and getarg but thats a lot of effort and a waste
Why do you need a SetTimerEx stock ?
Re: Little coding questions - For general minor queries 5 -
WestTillIdie - 10.01.2011
how can i get attachedobjecttovehicle position?
Re: AW: Re: Little coding questions - For general minor queries 5 -
RAEN - 11.01.2011
Quote:
you could do it with numarg and getarg but thats a lot of effort and a waste
Why do you need a SetTimerEx stock ?
|
To Debugged when the timer is start etc... Because sometimes my sever is shutdown, and I can't find the problem.
Re: AW: Re: Little coding questions - For general minor queries 5 -
_rAped - 11.01.2011
Quote:
Originally Posted by RAEN
To Debugged when the timer is start etc... Because sometimes my sever is shutdown, and I can't find the problem.
|
You could just do a print or something?
pawn Код:
// Wherever you are calling the timer.
SetTimer("TestMessage", 5000, false); // or SetTimerEx if you need params.
print("Timer started. (#TestMessage)");
// Your callback
forward TestMessage();
public TestMessage()
{
print("Timer done, callback called. (#TestMessage)");
}
Re: Little coding questions - For general minor queries 5 -
GangsTa_ - 15.01.2011
Why when I script something with dialogs I get errors "Undefined symbol ShowPlayerDialog" and "Function lacks forward declaration "OnDialogResponse."?
Re: Little coding questions - For general minor queries 5 -
dice7 - 15.01.2011
Download the latest server package with the newest includes
Re: Little coding questions - For general minor queries 5 -
cessil - 12.02.2011
Quote:
Originally Posted by Tupac
will pvars work in 2 scripts at once? gm/npcmode
|
yes, if you use SetPVarInt(playerid,"test",2

; in one script you can use GetPVarInt(playerid,"test"); in another script and it'll return the value you set in the first script
Re: Little coding questions - For general minor queries 5 -
knackworst - 02.11.2011
Is there a way to reverse words? So to check if a player typed a word reversed...
Re: Little coding questions - For general minor queries 5 -
RyDeR` - 03.11.2011
Quote:
Originally Posted by knackworst
Is there a way to reverse words? So to check if a player typed a word reversed...
|
Sure, here you go:
pawn Code:
stock ReverseText(szText[]) {
for(new i = 0, j = strlen(szText) - 1; i < j; ++i, --j) {
szText[i] ^= szText[j], szText[j] ^= szText[i], szText[i] ^= szText[j];
}
}
Re: Little coding questions - For general minor queries 5 -
knackworst - 03.11.2011
Looks pretty neat ty, but what is the outputstring?