21.10.2010, 20:49
Useful Functions
22.10.2010, 10:59
Cheaters got the ability to change their player state. So tbh the PVar method would be better, but of course the other one is the best one if you ignore the cheater part in my message :P
22.10.2010, 13:32
This are macros, not functions, but I'll post them anyway.
It's not "useful", it just keeps my script tidy.
It's not "useful", it just keeps my script tidy.
pawn Код:
#define SECONDS(%1) ((%1)*(1000))
#define MINUTES(%1) ((%1)*(60*1000))
#define HOURS(%1) ((%1)*(60*60*1000))
22.10.2010, 17:06
Nice but should this work ?
?
pawn Код:
SetTimer("anything",(HOURS(1)+MINUTES(30)),false);
23.10.2010, 08:56
Quote:
You set the coordinates, it can teleport you to any part of the map.
SetPlayerPos(0.0, 0.0, 0.0), the '0.0' parts are coordinates, 3 sets of them separated by commas: ',' one for X axis [east and west] one for Y axis [north and south] and one for Z [Height], coordinates are always in the order XYZ. '0.0, 0.0, 0.0' is the center of the map, no meters east, west, north or south. so if your coordinate was south of the center of the map, it would be '0.0, -10.0, 0.0', east [right if you're looking north] would be '10.0, 0.0, 0.0' west would be '-10.0' not '10.0', because the center of the map is 0.0 so you use minus values for anywhere behind this. Hope that cleared that up |
23.10.2010, 09:03
We don't know how your account load/save system works, therefore we're only able to give you the functions you'll need. You need to get player coordinates OnPlayerDisconnect, then save it to a file/database and then after player login again load the coordinates from the file/database and set the player position.
23.10.2010, 09:10
It does save it on the data base as you can see it here:
Ip=94.123.100.163
Registered=1
RegisteredDate=22/10/2010
Loggedin=0
Banned=0
Level=0
AccountType=0
LastOn=22.10.2010
Money=0
Kills=0
Deaths=0
WantedLevel=0
Score=0
Hours=0
Minutes=2
Seconds=25
NoQuestion=0
Question=acun
QuestionR=A6F927F25D4E4CACA44728FCD3E9C9125735E479 39B5657C814FB4F87BF2875433B7B2707B7548A6C629B24D5F 37840D731DC0887E4E58AF5CBA6DF8B619FEB0
x1=1778
y1=1264
z1=7
interior1=0
Weapon1=0
Weapon1Ammo=0
Weapon2=0
Weapon2Ammo=0
Weapon3=0
Weapon3Ammo=0
Weapon4=0
Weapon4Ammo=0
Weapon5=0
Weapon5Ammo=0
Weapon6=0
Weapon6Ammo=0
Health=83
Armour=0
TimesOnServer=1
But i only need when player reconnects.
Ip=94.123.100.163
Registered=1
RegisteredDate=22/10/2010
Loggedin=0
Banned=0
Level=0
AccountType=0
LastOn=22.10.2010
Money=0
Kills=0
Deaths=0
WantedLevel=0
Score=0
Hours=0
Minutes=2
Seconds=25
NoQuestion=0
Question=acun
QuestionR=A6F927F25D4E4CACA44728FCD3E9C9125735E479 39B5657C814FB4F87BF2875433B7B2707B7548A6C629B24D5F 37840D731DC0887E4E58AF5CBA6DF8B619FEB0
x1=1778
y1=1264
z1=7
interior1=0
Weapon1=0
Weapon1Ammo=0
Weapon2=0
Weapon2Ammo=0
Weapon3=0
Weapon3Ammo=0
Weapon4=0
Weapon4Ammo=0
Weapon5=0
Weapon5Ammo=0
Weapon6=0
Weapon6Ammo=0
Health=83
Armour=0
TimesOnServer=1
But i only need when player reconnects.
30.10.2010, 22:57
Any suggestions or request as function you guys want? Please tell me ^^
30.10.2010, 23:08
I was thinking of this the other day, and it's probably possible.
Get two sets of coordinates: xyz1 xyz2
detect if the player is one direction past the line between the two sets of co-ords.
something like that
I had an idea of how it would be done but I forgot
It's a bit like IsPlayerInArea, but with a line, and it can be diagonal.
Just a brainstorm, someone can see if they can make it into a code.
Get two sets of coordinates: xyz1 xyz2
detect if the player is one direction past the line between the two sets of co-ords.
something like that
Code:
x < position 2 / / /x < player position / x < position 1
It's a bit like IsPlayerInArea, but with a line, and it can be diagonal.
Just a brainstorm, someone can see if they can make it into a code.
30.10.2010, 23:11
(
Last edited by Double-O-Seven; 30/10/2010 at 11:41 PM.
)
Southclaw, this is very easy! I'll give you a GetDistanceFromPointToLine function. (fast one, no loop)
//EDIT: Here you go!
Save it as include to be able to use the native declaration for easier usage (display for arguments).
This function could be used for a very effective head shot script!
All headshots script I have seen in this forum were using loops to check if a player is aiming at the head of someone. This is not efficient.
Solution:
The cross product of the camera vector and the vector defined by the camera position and the position of the players head.
//EDIT: Here you go!
pawn Code:
#include <a_samp>
#if defined _gdfptl_included
#endinput
#endif
#define _gdfptl_included
/*
native crossp(Float:v1x, Float:v1y, Float:v1z, Float:v2x, Float:v2y, Float:v2z, &Float:output);
native GetDistanceFromPointToLine(&Float:distance, Float:line_vector_x, Float:line_vector_y, Float:line_vector_z, Float:line_x, Float:line_y, Float:line_z, Float:point_x, Float:point_y, Float:point_z);
*/
stock crossp(Float:v1x, Float:v1y, Float:v1z, Float:v2x, Float:v2y, Float:v2z, &Float:output)
{
new
Float:c1 = (v1y * v2z) - (v1z * v2y),
Float:c2 = (v1z * v2x) - (v1x * v2z),
Float:c3 = (v1x * v2y) - (v1y * v2x);
output = floatsqroot ((c1 * c1) + (c2 * c2) + (c3 * c3));
return 0;
}
stock GetDistanceFromPointToLine(&Float:distance, Float:line_vector_x, Float:line_vector_y, Float:line_vector_z, Float:line_x, Float:line_y, Float:line_z, Float:point_x, Float:point_y, Float:point_z)
{
//A line is defined by a point (which is on the line (line_x/y/z)) and a vector which defines the direction (line_vector_x/y/z).
new Float:output;
crossp(line_vector_x, line_vector_y, line_vector_z, point_x - line_x, point_y - line_y, point_z - line_z, output);//Cross product of 2 vectors.
distance = output / floatsqroot ((line_vector_x * line_vector_x) + (line_vector_y * line_vector_y) + (line_vector_z * line_vector_z));
return 0;
}
This function could be used for a very effective head shot script!
All headshots script I have seen in this forum were using loops to check if a player is aiming at the head of someone. This is not efficient.
Solution:
The cross product of the camera vector and the vector defined by the camera position and the position of the players head.
31.10.2010, 00:15
uhm Ryder just a suggestion, can you make something so like when someone types like this...
Heyyyy! (Beginning of the line starts with a space)
Heeeeyy! Whats up?!?! (Has more than one space)
Takes the spaces out or doesn't let them send the line? and so if they type ~ then it don't send the line either? If so that be great for me.
Heyyyy! (Beginning of the line starts with a space)
Heeeeyy! Whats up?!?! (Has more than one space)
Takes the spaces out or doesn't let them send the line? and so if they type ~ then it don't send the line either? If so that be great for me.
31.10.2010, 02:24
pawn Код:
public OnPlayerText( playerid, text[ ] )
{
if ( text[ 0 ] == ' ' || text[ 0 ] == '~' )
return 0;
return 1;
}
31.10.2010, 09:10
@g_aSlice:
It's not complete.
This should work. Didn't test it yet.
It's not complete.
pawn Код:
public OnPlayerText(playerid, text[])
{
if(strfind(text, "~", true) != -1 || !text[0]) return 0;
new
i
;
for( ; (text[i] != '\0' && text[i] <= ' ') ; ) ++i;
strmid(text, text, i, strlen(text), 128);
return 1;
}
31.10.2010, 11:04
oh, i didn't get what he meant yesterday.
31.10.2010, 13:05
Didn't work Ryder, it just auto spaces where the first letter should be. ( http://tinypic.com/r/r0eff9/7 )
EDIT: the ~ worked though thanks!
EDIT: the ~ worked though thanks!
31.10.2010, 13:35
The forum did what he wanted, it removes useless spaces before and between words so we couldnt understand what he exactly wanted
With that it should be clear
Try that
With that it should be clear
Quote:
Code:
Heyyyy! (Beginning of the line starts with a space) Heeeeyy! Whats up?!?! (Has more than one space) |
pawn Code:
public OnPlayerText(playerid, text[])
{
if(strfind(text, "~", true) != -1) return 0;
for(new i, j; ; i++) {
switch(text[i]) {
case EOS: break;
case ' ': {
for(j = i; text[++j] == ' '; ) {}
if(i == 0) {
strdel(text, 0, j); //Dont know if other string functions are better ^^"
} else {
strdel(text, (i + 1), j);
}
}
}
}
}
31.10.2010, 13:43
There should be
SlapPlayer(playerid);
SlapPlayer(playerid);
31.10.2010, 13:47
Can you just break that up for the spaces only? The ~~~~ one works already.
31.10.2010, 14:14
31.10.2010, 14:26
(
Последний раз редактировалось willsuckformoney; 31.10.2010 в 14:43.
)
About to test, keeping the ~ that you made since I'm to lazy to delete it.
EDIT: The space still doesn't work.
EDIT: The space still doesn't work.
« Next Oldest | Next Newest »
Users browsing this thread: 1 Guest(s)