17.05.2014, 19:23
Useful Functions
17.05.2014, 21:17
@Hwang
Why 256 cells? OMG
Why 256 cells? OMG
18.05.2014, 12:02
You should at least note what include you need for ptask (y_timers), foreach (y_iterate) and the Distance function (I hope that this is just a macro for the VectorSize native)
I also noticed that some of the 0.3z functions are missing on the wiki page Scripting Functions
I also noticed that some of the 0.3z functions are missing on the wiki page Scripting Functions
25.05.2014, 18:31
Send server variables to a website
gamemode:
samp.php on your website:
Example usage:
Printing the variable on a website:
gamemode:
pawn Код:
#define VARIABLEUPDATE_KEY "q4z2Y5o" //CHANGE THIS TO SOMETHING RANDOM (YOU MUST UPDATE THE KEY IN THE PHP SCRIPT TOO)
forward SendVariable(url[], varname[], value[], id);
public SendVariable(url[], varname[], value[], id)
{
new str[128];
format(str, sizeof str, "key=%s&var=%s&val=%s", VARIABLEUPDATE_KEY, varname, value);
if(HTTP(id, HTTP_POST, url, str, "HTTPResponse")) return 1;
return 0;
}
forward HTTPResponse(index, response_code, data[]);
public HTTPResponse(index, response_code, data[])
{
if(response_code == 200) if(!strcmp(data, "false")) printf("HTTP variable update failed (%s).", data);
else printf("HTTP variable update failed (%d).", response_code);
}
PHP код:
<?php
if($_POST['key'] == "q4z2Y5o") //CHANGE THIS TO SOMETHING RANDOM (YOU MUST UPDATE THE KEY IN YOUR GAMEMODE TOO)
{
file_put_contents($_POST['var'] . '.txt', $_POST['val']);
echo 'true';
}
else echo 'false';
?>
pawn Код:
public OnPlayerConnect(playerid)
{
new name[MAX_PLAYER_NAME+1];
GetPlayerName(playerid, name, sizeof(name));
SendVariable("yoursite.com (without http://) /samp.php", "LastLogged", name, playerid);
//"LastLogged" is the variable name. name is the value of the variable. playerid can be anything.
return 1;
}
PHP код:
<?php
$text = file_get_contents('LastLogged.txt');
echo $text;
?>
25.05.2014, 18:41
25.05.2014, 18:47
It doesn't. It returns the colour with changed the alpha value only (between 0 and 255).
25.05.2014, 18:49
Evidently.. I was just pointing out the naming.
26.05.2014, 04:38
(
Последний раз редактировалось Calgon; 27.05.2014 в 00:11.
)
Calculate the amount of seconds between now and the next whole hour (XX:00). May be useful for those making payday systems.
pawn Код:
stock GetSecsBetwnWholeHour() {
new
iTime[3];
gettime(iTime[0], iTime[1], iTime[2]);
return (59 - iTime[1]) * 60 + (60 - iTime[2]);
}
26.05.2014, 15:22
showPlayerSkinName
edit by RyDeR` thanks.
pawn Code:
static const
s_aszSkinNames[299][41 char] = {
!"Carl \'CJ\' Johnson",
!"The Truth",
!"Maccer",
!"Andre",
!"Barry \'Big Bear\' Thorne (Thin)",
!"Barry \'Big Bear\' Thorne (Big)",
!"Emmet",
!"Taxi Driver/Train Driver",
!"Janitor",
!"Normal Eleman",
!"Old Woman",
!"Casino Croupier",
!"Rich Woman",
!"Street Girl",
!"Normal Eleman",
!"Mr.Whittaker (RS Haul Owner)",
!"Airport Ground Worker",
!"Businessman",
!"Beach Visitor",
!"DJ",
!"Rich Guy (Madd Dogg\'s Manager",
!"Normal Eleman",
!"Normal Eleman",
!"BMXer",
!"Madd Dogg\'s Bodyguard",
!"Madd Dogg\'s Bodyguard",
!"Backpacker",
!"Construction Work",
!"Drug Dealer",
!"Drug Dealer",
!"Drug Dealer",
!"Farm Town Inhabitant",
!"Farm Town Inhabitant",
!"Farm Town Inhabitant",
!"Farm Town Inhabitant",
!"Gardener",
!"Golfer",
!"Golfer",
!"Normal Eleman",
!"Normal Eleman",
!"Normal Eleman",
!"Normal Eleman",
!"Jethro",
!"Normal Eleman",
!"Normal Eleman",
!"Beach Visitor",
!"Normal Eleman",
!"Normal Eleman",
!"Normal Eleman",
!"Snakehead (Da Nang)",
!"Mechanic",
!"Mountain Biker",
!"Unknown",
!"Street Girl",
!"Normal Eleman",
!"Normal Eleman",
!"Normal Eleman",
!"Feds",
!"Normal Eleman",
!"Normal Eleman",
!"Normal Eleman",
!"Pilot",
!"Colonel Fuhrberger",
!"Prostitute",
!"Prostitute",
!"Kendl Johnson",
!"Pool Player",
!"Pool Player",
!"Priest/Preacher",
!"Normal Eleman",
!"Doktor",
!"Security Guard",
!"Hippy",
!"Hippy",
!"Prostitute",
!"Normal Eleman",
!"Homeless",
!"Homeless",
!"Homeless",
!"Boxer",
!"Boxer",
!"Black Elvis",
!"White Elvis",
!"Blue Elvis",
!"Prostitute",
!"Ryder With Robbery Mask",
!"Stripper",
!"Normal Eleman",
!"Normal Eleman",
!"Jogger",
!"Rich Woman",
!"Rollerskater",
!"Normal Eleman",
!"Normal Eleman",
!"Normal Eleman",
!"Jogger",
!"Lifeguard",
!"Normal Eleman",
!"Homeless",
!"Biker",
!"Normal Eleman",
!"Balla",
!"Balla",
!"Balla",
!"Grove Street Families",
!"Grove Street Families",
!"Grove Street Families",
!"Los Santos Vagos",
!"Los Santos Vagos",
!"Los Santos Vagos",
!"The Russian Mafia",
!"The Russian Mafia",
!"The Russian Mafia",
!"Varios Los Aztecas",
!"Varios Los Aztecas",
!"Varios Los Aztecas",
!"Triad",
!"Triad",
!"Johhny Sindacco",
!"Triad Boss",
!"Da Nang Boy",
!"Da Nang Boy",
!"Da Nang Boy",
!"Mafia",
!"Mafia",
!"Mafia",
!"Mafia",
!"Farm Inhabitant",
!"Farm Inhabitant",
!"Farm Inhabitant",
!"Farm Inhabitant",
!"Farm Inhabitant",
!"Farm Inhabitant",
!"Homeless",
!"Homeless",
!"Homeless",
!"Homeless",
!"Beach Visitor",
!"Beach Visitor",
!"Beach Visitor",
!"Businesswoman",
!"Taxi Driver",
!"Crack Maker",
!"Crack Maker",
!"Crack Maker",
!"Normal Eleman",
!"Businessman",
!"Businesswoman",
!"Big Smoke Armored",
!"Businesswoman",
!"Normal Eleman",
!"Prostitute",
!"Construction Worker",
!"Beach Visitor",
!"Well Stacked Pizza Worker",
!"Barber",
!"Hillbilly",
!"Farmer",
!"Hillbilly",
!"Hillbilly",
!"Farmer",
!"Hillbilly",
!"Black Bouncer",
!"White Bouncer",
!"White MIB Agent",
!"Black MIB Agent",
!"Cluckin\' Bell Worker",
!"Hotdog/Chilli Dog Vendor",
!"Normal Eleman",
!"Normal Eleman",
!"Blackjack Dealer",
!"Casino Croupier",
!"San Fierro Rifa",
!"San Fierro Rifa",
!"San Fierro Rifa",
!"Barber",
!"Barber",
!"Whore",
!"Ammunation Salesman",
!"Tattoo Artist",
!"Punk",
!"Cab Driver",
!"Normal Eleman",
!"Normal Eleman",
!"Normal Eleman",
!"Normal Eleman",
!"Businessman",
!"Normal Eleman",
!"Valet",
!"Barbara Schternvart",
!"Helena Wankstein",
!"Michelle Cannes",
!"Katie Zhan",
!"Millie Perkins",
!"Denise Robinson",
!"Farm Town Inhabitant",
!"Hillbilly",
!"Farm Town Inhabitant",
!"Farm Town Inhabitant",
!"Hillbilly",
!"Farmer",
!"Farmer",
!"Karate Teacher",
!"Karate Teacher",
!"Burger Shot Cashier",
!"Cab Driver",
!"Prostitute",
!"Su Xi Mu (Suzie)",
!"Noodle Stand Vendor",
!"Boater",
!"Clothes Shop Staff",
!"Homeless",
!"Weird Old Man",
!"Waitress (Maria Latore)",
!"Normal Eleman",
!"Normal Eleman",
!"Clothes Shop Staff",
!"Normal Eleman",
!"Rich Woman",
!"Cab Driver",
!"Normal Eleman",
!"Normal Eleman",
!"Normal Eleman",
!"Normal Eleman",
!"Hillbilly",
!"Normal Eleman",
!"Businessman",
!"Normal Eleman",
!"Normal Eleman",
!"Homeless",
!"Normal Eleman",
!"Normal Eleman",
!"Normal Eleman",
!"Cab Driver",
!"Normal Eleman",
!"Normal Eleman",
!"Prostitute",
!"Prostitute",
!"Homeless",
!"The D.A",
!"Afro American",
!"Mexican",
!"Prostitute",
!"Stripper",
!"Prostitute",
!"Stripper",
!"Biker",
!"Biker",
!"Pimp",
!"Normal Eleman",
!"Lifeguard",
!"Naked Valet",
!"Bus Driver",
!"Biker Drug Dealer",
!"Chauffeur (Limo Driver)",
!"Stripper",
!"Stripper",
!"Heckler",
!"Heckler",
!"Construction Worker",
!"Cab Driver",
!"Cab Driver",
!"Normal Eleman",
!"Clown",
!"Officer Frank Tenpenny (Corrupt Cop)",
!"Officer Eddie Pulaski (Corrupt Cop)",
!"Officer Jimmy Hernandez",
!"Dwaine/Dwayne",
!"Melvin \'Big Smoke\' Harris",
!"Sean \'Sweet\' Johnson",
!"Lance \'Ryder\' Wilson",
!"Mafia Boss",
!"T-Bone Mendez",
!"Paramedic (Emergency Medical Technician)",
!"Paramedic (Emergency Medical Technician)",
!"Paramedic (Emergency Medical Technician)",
!"Itfaiyeci",
!"Itfaiyeci",
!"Itfaiyeci",
!"Los Santos Polis",
!"San Fierro Polis",
!"Las Venturas Polis",
!"Country Sheriff",
!"LSPD Motorbike Cop",
!"S.W.A.T. Special Forces",
!"Federal Agent",
!"San Andreas Army",
!"Desert Sheriff",
!"Zero",
!"Ken Rosenberg",
!"Kent Paul",
!"Cesar Vialpando",
!"Jeffery \'OG Loc\' Martin/Cross",
!"Wu Zi Mu (Woozie)",
!"Michael Toreno",
!"Jizzy B",
!"Madd Dogg",
!"Catalina",
!"Claude Speed"
}
;
pawn Code:
stock showPlayerSkinName(playerid) {
static
s_szName[41]
;
strunpack(s_szName, s_aszSkinNames[GetPlayerSkin(playerid) % sizeof(s_aszSkinNames)]);
GameTextForPlayer(playerid, s_szName, 2000, 4);
}
edit by RyDeR` thanks.
26.05.2014, 15:46
nvm...
26.05.2014, 15:59
(
Последний раз редактировалось Luis-; 27.05.2014 в 00:21.
)
Quote:
Calculate the amount of seconds between now and the next whole hour (XX:00). May be useful for those making payday systems.
pawn Код:
|
26.05.2014, 16:05
Just seconds
27.05.2014, 00:11
Quote:
You add the current seconds, that seems like it should be a subtraction:
XX.59.00 gives 60, correctly, but XX.59.01 gives 61, and XX.59.59 gives 119. Just from thinking about it: pawn Код:
|
27.05.2014, 01:56
anyone have a Anti-CarPush System?
Thanks
Thanks
30.05.2014, 13:47
This Is Simple Teleport System
IN CMD:
so it will be
pawn Код:
stock TeleportPlayer(playerid,Float:x,Float:y,Float:z,telename[],telecmd[])
{
new sendername[MAX_PLAYER_NAME], string[500];
GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, sizeof(string), "%s(%d) Has Teleported To %s (%s)", sendername,playerid,telename,telecmd);
SendClientMessageToAll(-1, string);
SetPlayerPos(playerid,x,y,z);
return 1;
}
pawn Код:
CMD:ls(playerid,params[])
{
TeleportPlayer(playerid,0.00,0.00,0.00+5,"Blueberry","/bb");
return 1;
}
PHP код:
Player_Name(0) Has Teleported To Blueberry (/bb)
06.06.2014, 15:30
(
Последний раз редактировалось Lordzy; 06.06.2014 в 17:44.
)
This function stores random characters from a string to the one mentioned. The storing length is the size of that array by default however it can be lowered.
Example:
It can be used for various types of reactions or any sort of random stuffs.
pawn Код:
stock GetRandomizedChars(const rchar_array[], trchars[], size = sizeof(trchars),
rsize = sizeof(rchar_array))
{
new
temp_rchar;
for(new i; i< size; i++)
{
temp_rchar = rchar_array[random(rsize)];
trchars[i] = temp_rchar;
}
return 1;
}
pawn Код:
new
r_Chars[] = "aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ0123456789"
;
public OnRconCommand(cmd[])
{
if(!strcmp(cmd, "rcharprint", true)) {
new
tenchar[10];
GetRandomizedChars(r_Chars, tenchar, sizeof(tenchar));
printf("%s", tenchar);
return 1;
}
return 1;
}
06.06.2014, 21:45
hi guys , i need help about how to make 2 commands for 1 function using dcmd
Code:
/rob /rb , /rape /ra , /heal /h
06.06.2014, 23:36
pawn Код:
space(chr)
return chr == 0x20 || chr == 0x09 || chr == 0x0a || chr == 0x0b || chr == 0x0c || chr == 0x0d;
10.06.2014, 18:26
(
Последний раз редактировалось Patrick; 20.06.2014 в 16:28.
)
I was tired of escaping strings in SQLite every time I execute a query so I decided to use formatex include by Slice and created a simple specifier %E, the reason I didn't use %e because it will collide with MySQL who ever uses MySQL + SQLite.
You need Function
Usage
EDIT: Spoke to ****** and assuming mysql_format and format is different, I decided to change the specifier to %e instead of %E
You need Function
pawn Код:
FormatSpecifier<'e'>(output[], string[])
{
if(string[0] == EOS)
print("Error: Empty string, the system can't escape anything.");
else
format(output, sizeof(output), "%s", DB_Escape(string));
}
pawn Код:
new string[128];
format(string, sizeof(string), "INSERT INTO Table (RowID1) VALUES ('%e')", "EscapeMe");
db_query(dbHandle, string);
11.06.2014, 05:28
Hey i saw a function here (SetObjectFaceCoords3D) and now ,
i want to know how can i use it for a player
i want to Set Player Facing Angle to an Object like a KeyPad
i want to know how can i use it for a player
i want to Set Player Facing Angle to an Object like a KeyPad
« Next Oldest | Next Newest »
Users browsing this thread: 27 Guest(s)