General Reference
#81

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
Reply
#82

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
Reply
#83

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

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

Do we need to click something for Clickable textdraw?
Reply
#86

Yes, the text draw!
Reply
#87

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

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

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

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

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

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

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

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

nice
Reply
#96

Good job guys
Reply
#97

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

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
Reply
#99

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
Reply

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


Forum Jump:


Users browsing this thread: 1 Guest(s)