SA-MP Forums Archive
General Reference - 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: General Reference (/showthread.php?tid=4)

Pages: 1 2 3 4 5 6


Re: General Reference - Kar - 07.07.2012

In vehicle Mouse Wheel Detection

pawn Код:
#define KEY_MOUSE_SCROLL_CLICK  (320) // VEHICLE ONLY

public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    if(newkeys == 320)
    {
        SendClientMessage(playerid, -1, "Mouse-click.");
    }
    return 1;
}
KEY_CTRL_BACK is used to detect mouse wheel scrolling backwards in vehicle


Re: General Reference - detter - 21.08.2012

Need time machine to go few hours back!
my whole RP mode ( i was still working on it) with 6k+ lines disapired
DAMN!!!!
days of scripting ,designing ,mapping :/

is there way to convert .amx to .pwn


Re: General Reference - Virus. - 28.10.2012

What are TextDraws supposed to do and how to use them? Thanks.


Re: General Reference - Lordzy - 28.10.2012

Quote:
Originally Posted by Virus.
Посмотреть сообщение
What are TextDraws supposed to do and how to use them? Thanks.
TextDraws are kind of texts or designs which are displayed on the screen. There are 2 kind of textdraws.
1)Normal Textdraw just like Gametext.
2)Clickable textdraw.

In clickable textdraw, we can create some kind of responses when a player clicks the textdraw. Just like the button response of a Dialog. Here are some pics:


Here those texts such as "You are kicked from the server" and "Exceeded 15 minutes" are textdraws which is being displayed.
PS:They aren't clickable.
Those are created by me on L-AFK system to show that when a player goes on AFK. I hope you understood about textdraws.


Re: General Reference - Virus. - 28.10.2012

Do we need to click something for Clickable textdraw?


Re: General Reference - Y_Less - 28.10.2012

Yes, the text draw!


Re: General Reference - [KHK]Khalid - 09.11.2012

This is a quick guide to textdraws. Also see this for clickable ones.


Re: General Reference - Virus. - 19.11.2012

Hello guys I want to make a speedometer. I have searched the forum, but I get only text speedometers.


Re: General Reference - Y_Less - 19.11.2012

Quote:
Originally Posted by Virus.
View Post
Hello guys I want to make a speedometer. I have searched the forum, but I get only text speedometers.
Hmm, that's very interesting, thank you for that useful reference information.


Re: General Reference - Schocc - 17.12.2012

Adding the parameter timer Interval in milliseconds (To auto Hide)
pawn Код:
TextDrawShowForPlayer( playerid, Text:text, Interval );
TextDrawShowForAll( Text:text, Interval );



Re: General Reference - SilverKiller - 03.02.2013

Quote:
Originally Posted by ******
Посмотреть сообщение
Yes, the text draw!
Good Job, ******


Re: General Reference - mastermax7777 - 11.02.2013

can i get the SOUND ID of Player getting hurt?
like something from PAIN_A ? (but not neccesary)
help


Re: General Reference - Austin - 04.04.2013

Not sure how well known this is, only just figured this out for myself.

I wanted to limit the length of a string in a format, and usually I would have a separate string of the needed length, or use strmid, but I figured out that it can be done in format just like it can be done with floats.

This would show a float as a maximum of 4 decimal points.
Код:
format(str, sizeof(str), "%0.4f", somefloat);
You would think that this potentially the method to limit a string to 10 characters would be...
Код:
format(str, sizeof(str), "%10s", somestring);
...but it's not, it's the same as the float...
Код:
format(str, sizeof(str), "%0.10s", somestring);
... one thing that might be possible (haven't checked yet) is to use %5.10s to start at the 6th character in the string and take 10 characters from that point.

Sorry if this is old news.


Re: General Reference - LarzI - 04.04.2013

Quote:
Originally Posted by Austin
Посмотреть сообщение
Not sure how well known this is, only just figured this out for myself.

I wanted to limit the length of a string in a format, and usually I would have a separate string of the needed length, or use strmid, but I figured out that it can be done in format just like it can be done with floats.

This would show a float as a maximum of 4 decimal points.
Код:
format(str, sizeof(str), "%0.4f", somefloat);
You would think that this potentially the method to limit a string to 10 characters would be...
Код:
format(str, sizeof(str), "%10s", somestring);
...but it's not, it's the same as the float...
Код:
format(str, sizeof(str), "%0.10s", somestring);
... one thing that might be possible (haven't checked yet) is to use %5.10s to start at the 6th character in the string and take 10 characters from that point.

Sorry if this is old news.
Didn't know this - thanks!
I think this would be more fitting in the Tips & Tricks thread, though.


Re: COMANDO COM LIMITE DE DISTГNCIA - Smoking_Script - 18.07.2013

nice


Re: General Reference - Guest4390857394857 - 30.04.2014

Good job guys


Re: General Reference - MarvinPWN - 01.09.2015

Quote:
Originally Posted by SoFahim
View Post
Please fix all links. They are not valid
Which links do you mean?


Re: General Reference - Yashas - 17.10.2015

Default Ammo given by Weapon Pickups

Pickup IDPickup NameAmmo Given
321Regular Dildo1
322White Dildo1
323Vibrator1
324Another Vibrator1
325Flowers1
326Cane1
331Brass Knuckles1
333Golf Club1
334Night Stick1
335Combat Knife1
336Baseball Bat1
337Shovel1
338Pool Cue1
339Katana1
341Chainsaw1
342Frag Grenade8
343Tear Gas Grenade8
344Molotov Cocktail8
346Colt 45 Pistol30
347Silenced Colt 45 Pistol10
348Desert Eagle10
349Regular Shotgun15
350Sawn-Off Shotgun10
351Combat Shotgun/SPAZ-1210
352Micro UZI60
353MP560
355AK-47 Assault Rifle80
356M4 Assault Rifle80
357Country Rifle20
358Sniper Rifle10
359Rocket Launcher4
360Heat Seeking Rocket Launcher3
361Flamethrower100 (Client see it as 10)
362Minigun500
363Satchel Charges5
365Spray Paint Can500
367Camera36
368Night Vision GogglesCannot be collected as pickup
369Infra-Red ******sCannot be collected as a pickup
371Parachute1
372Tech-960



Re: General Reference - GangstaSunny - 05.02.2016

PHP Code:
stock GetNulledTimeFormat()
{
    new 
YearMonthDayHourMinuteSecond;
    new 
monthstr[11], daystr[11], hourstr[11], minutestr[11], secondstr[11], result[32];
    
getdate(YearMonthDay); gettime(HourMinuteSecond);
    
    if(
Day 9){format(daystr,sizeof(daystr),"%d",Day);}
     else if(
Day 10){format(daystr,sizeof(daystr),"0%d.",Day);}
    
     if(
Month 9){format(monthstr,sizeof(monthstr),"%d.%d",Month,Year);}
     else if(
Month 10){format(monthstr,sizeof(monthstr),"0%d.%d",Month,Year);}
     
     if(
Hour 9){format(hourstr,sizeof(hourstr)," %d:",Hour);}
     else if(
Hour 10){format(hourstr,sizeof(hourstr)," 0%d:",Hour);}
     
     if(
Minute 9){format(minutestr,sizeof(minutestr),"%d:",Minute);}
     else if(
Minute 10){format(minutestr,sizeof(minutestr),"0%d:",Minute);}
     
     if(
Second 9){format(secondstr,sizeof(secondstr),"%d",Second);}
     else if(
Second 10){format(secondstr,sizeof(secondstr),"0%d",Second);}
     
     
strcat(resultdaystr); strcat(resultmonthstr); strcat(resulthourstr);
     
strcat(resultminutestr); strcat(resultsecondstr);
     return 
result;

Code:
Will return something like | 05.02.2016 08:25:10



Re: General Reference - Crayder - 10.02.2016

Quote:
Originally Posted by GangstaSunny
View Post
PHP Code:
stock GetNulledTimeFormat()
{
    new 
YearMonthDayHourMinuteSecond;
    new 
monthstr[11], daystr[11], hourstr[11], minutestr[11], secondstr[11], result[32];
    
getdate(YearMonthDay); gettime(HourMinuteSecond);
    
    if(
Day 9){format(daystr,sizeof(daystr),"%d",Day);}
     else if(
Day 10){format(daystr,sizeof(daystr),"0%d.",Day);}
    
     if(
Month 9){format(monthstr,sizeof(monthstr),"%d.%d",Month,Year);}
     else if(
Month 10){format(monthstr,sizeof(monthstr),"0%d.%d",Month,Year);}
     
     if(
Hour 9){format(hourstr,sizeof(hourstr)," %d:",Hour);}
     else if(
Hour 10){format(hourstr,sizeof(hourstr)," 0%d:",Hour);}
     
     if(
Minute 9){format(minutestr,sizeof(minutestr),"%d:",Minute);}
     else if(
Minute 10){format(minutestr,sizeof(minutestr),"0%d:",Minute);}
     
     if(
Second 9){format(secondstr,sizeof(secondstr),"%d",Second);}
     else if(
Second 10){format(secondstr,sizeof(secondstr),"0%d",Second);}
     
     
strcat(resultdaystr); strcat(resultmonthstr); strcat(resulthourstr);
     
strcat(resultminutestr); strcat(resultsecondstr);
     return 
result;

Code:
Will return something like | 05.02.2016 08:25:10
First off, this should be in Useful Functions.

Now, learn more about formatting...
pawn Code:
if(Second > 9){format(secondstr,sizeof(secondstr),"%d",Second);}
    else if(Second < 10){format(secondstr,sizeof(secondstr),"0%d",Second);}
Could simply be this:
pawn Code:
format(secondstr,sizeof(secondstr),"%02d",Second);
The '0' is to make it use leading zeros, '2' is the 'at least this many characters' amount.