forward RandomPlayerScreen(playerid);
public RandomPlayerScreen(playerid) {
new screen = random(10);
SetPlayerInterior(playerid, 0);
switch(screen) {
case 0: {
SetPlayerPos(playerid,-346.083618,1599.942139,164.472366);
SetPlayerCameraPos(playerid,-345.877228,1601.342896,164.518951);
SetPlayerCameraLookAt(playerid,-340.641968,1938.658447,83.722984); }
case 1: {
SetPlayerPos(playerid,1485.0194,-892.1475,74.4098);
SetPlayerCameraPos(playerid,1479.7717,-886.2401,73.9461);
SetPlayerCameraLookAt(playerid,1415.3817,-807.9097,85.0613); }
case 2: {
SetPlayerPos(playerid,589.1550,373.1002,15.7948);
SetPlayerCameraPos(playerid,543.9864,349.3647,14.9968);
SetPlayerCameraLookAt(playerid,422.1727,599.0107,19.1812); }
case 3: {
SetPlayerPos(playerid,2155.0137,1129.7897,18.6397);
SetPlayerCameraPos(playerid,2149.3992,1132.6051,24.3125);
SetPlayerCameraLookAt(playerid,2105.0222,1156.5306,11.6470); }
case 4: {
SetPlayerPos(playerid,-2818.1499,1144.0898,19.2409);
SetPlayerCameraPos(playerid,-2808.0366,1161.1864,20.3125);
SetPlayerCameraLookAt(playerid,-2817.9348,1143.5291,19.3762); }
case 5: {
SetPlayerPos(playerid,2144.2822,1279.8054,7.9840);
SetPlayerCameraPos(playerid,2154.24,1306.50,41.46);
SetPlayerCameraLookAt(playerid,2273.45,1262.09,33.78); }
case 6: {
SetPlayerPos(playerid,-1771.7858,-565.5638,-0.5834);
SetPlayerCameraPos(playerid,-1771.4641,-566.3715,16.4844);
SetPlayerCameraLookAt(playerid,2105.0222,1156.5306,11.6470); }
case 7: {
SetPlayerPos(playerid,-1254.7159,953.9262,139.2734);
SetPlayerCameraPos(playerid,-1256.6115,953.2058,139.2734);
SetPlayerCameraLookAt(playerid,-1529.6639,689.2731,45.3311); }
case 8: {
SetPlayerPos(playerid,-2295.7979,712.2764,69.7422);
SetPlayerCameraPos(playerid,-2265.6101,730.9575,49.2969);
SetPlayerCameraLookAt(playerid,-2243.5103,731.5889,62.7217); }
case 9: {
SetPlayerPos(playerid,50.0000,50.0000,70.0000);
SetPlayerCameraPos(playerid,50.0000,50.0000,70.2203);
SetPlayerCameraLookAt(playerid,499.8851,504.5435,7.6593); } } }
#define String:: str_
#define Integer:: int_
#define function
#define private static stock
// Example
private function String::ToInteger(const string[]) {
return strval(string);
}
|
This is not actually a snippet, but it can make your code more read-able. I already posted something using this definitions in Useful codes board.
pawn Код:
|
#define StringToInteger strval
|
Smooth Timer Loading
This script will stop lag (you must use this every time you load a timer for smooth results). pawn Код:
|
|
Learn how to read codes, and this is shit? You couldn't script shit like this, so shut the fuck up troll.
For all of you dumb shits who don't know what this code does, it loads a timer at OnPlayerConnect then 20 milliseconds later it kills the timer. Easy eh? And what the fuck does this have to do with 10 players connecting in 3 seconds? |
|
Learn how to read codes, and this is shit? You couldn't script shit like this, so shut the fuck up troll.
For all of you dumb shits who don't know what this code does, it loads a timer at OnPlayerConnect then 20 milliseconds later it kills the timer. Easy eh? And what the fuck does this have to do with 10 players connecting in 3 seconds? |
|
TheHoodRat: Your code is not making timer loading any smoother, you load it the exact same way any other code does, you just destroy it differently. And like wups said, if you have multiple people connect quickly, the code would overwrite itself and only use the timer for one person, since you use one global variable.
|
#include <a_samp>
#define HEXNUM "%04h%04h"
#define PRINTHEX(%0) ( ( ( %0 ) & ( 0xFFFF0000 ) ) >>> 16 ), ( ( %0 ) & ( 0xFFFF ) )
public OnFilterScriptInit( )
{
printf( "Bad: %x.", 0xFFFFFFFF );
printf( "Good: " HEXNUM ".", PRINTHEX( 0xFFFFFFFF ) );
}
#define StripAlpha(%0) ( ( %0 ) >>> 8 )
format( .., .., "blablalba{%h}blabla", StripAlpha( GetPlayerColor( playerid ) ) );
|
pawn Код:
|

#define GivePlayerScore(%0,%1) SetPlayerScore(%0, (GetPlayerScore(%0) + %1))
enum LanguageCodes(+=1)
{
AA = 1, // Afar
AB, // Abkhazian
AF, // Afrikaans
AM, // Amharic
AR, // Arabic
AS, // Assamese
AY, // Aymara
AZ, // Azerbaijani
BA, // Bashkir
BE, // Byelorussian
BG, // Bulgarian
BH, // Bihari
BI, // Bislama
BN, // Bengali, Bangla
BO, // Tibetan
BR, // Breton
CA, // Catalan
CO, // Corsican
CS, // Czech
CY, // Welsh
DA, // Danish
DE, // German
DZ, // Bhutani
EL, // Greek
EN, // English, American
EO, // Esperanto
ES, // Spanish
ET, // Estonian
EU, // Basque
FA, // Persian
FI, // Finnish
FJ, // Fiji
FO, // Faeroese
FR, // French
FY, // Frisian
GA, // Irish
GD, // Gaelic Scots, Gaelic
GL, // Galician
GN, // Guarani
GU, // Gujarati
HA, // Hausa
HI, // Hindi
HR, // Croatian
HU, // Hungarian
HY, // Armenian
IA, // Interlingua
IE, // Interlingue
IK, // Inupiak
IN, // Indonesian
IS, // Icelandic
IT, // Italian
IW, // Hebrew
JA, // Japanese
JI, // Yiddish
JW, // Javanese
KA, // Georgian
KK, // Kazakh
KL, // Greenlandic
KM, // Cambodian
KN, // Kannada
KO, // Korean
KS, // Kashmiri
KU, // Kurdish
KY, // Kirghiz
LA, // Latin
LN, // Lingala
LO, // Laothian
LT, // Lithuanian
LV, // Latvian Lettish
MG, // Malagasy
MI, // Maori
MK, // Macedonian
ML, // Malayalam
MN, // Mongolian
MO, // Moldavian
MR, // Marathi
MS, // Malay
MT, // Maltese
MY, // Burmese
NA, // Nauru
NE, // Nepali
NL, // Dutch
NO, // Norwegian
OC, // Occitan
OM, // Oromo Afan
OR, // Oriya
PA, // Punjabi
PL, // Polish
PS, // Pashto Pushto
PT, // Portuguese
QU, // Quechua
RM, // Rhaeto-Romance
RN, // Kirundi
RO, // Romanian
RU, // Russian
RW, // Kinyarwanda
SA, // Sanskrit
SD, // Sindhi
SG, // Sangro
SH, // Serbo-Croatian
SI, // Singhalese
SK, // Slovak
SL, // Slovenian
SM, // Samoan
SN, // Shona
SO, // Somali
SQ, // Albanian
SR, // Serbian
SS, // Siswati
ST, // Sesotho
SU, // Sudanese
SV, // Swedish
SW, // Swahili
TA, // Tamil
TE, // Tegulu
TG, // Tajik
TH, // Thai
TI, // Tigrinya
TK, // Turkmen
TL, // Tagalog
TN, // Setswana
TO, // Tonga
TR, // Turkish
TS, // Tsonga
TT, // Tatar
TW, // Twi
UK, // Ukrainian
UR, // Urdu
UZ, // Uzbek
VI, // Vietnamese
VO, // Volapuk
WO, // Wolof
XH, // Xhosa
YO, // Yoruba
ZH, // Chinese
ZU // Zulu
};
stock UpdateVehicleParamsEx(vehicleid, bool: status, { _, Float }: ...)
{
new
vehicleParams[7],
vehicleParamsData[7][10] =
{
{ "Engine" },
{ "Lights" },
{ "Alarm" },
{ "Doors" },
{ "Bonnet" },
{ "Boot" },
{ "Objective" }
},
totalArgs = numargs()
;
if(totalArgs < 3)
{
return 0;
}
GetVehicleParamsEx(vehicleid, vehicleParams[0], vehicleParams[1], vehicleParams[2], vehicleParams[3], vehicleParams[4], vehicleParams[5], vehicleParams[6]);
for(new i = 2, j = 0, ch = '\0'; i != totalArgs; ++i)
{
new
tempString[10]
;
for(j = 0; (ch = getarg(i, j)) != EOS; ++j)
{
tempString[j] = ch;
}
for(j = 0; j != sizeof(vehicleParamsData); ++j)
{
if(!strcmp(vehicleParamsData[j], tempString, true))
{
vehicleParams[j] = status;
}
}
}
SetVehicleParamsEx(vehicleid, vehicleParams[0], vehicleParams[1], vehicleParams[2], vehicleParams[3], vehicleParams[4], vehicleParams[5], vehicleParams[6]);
return 1;
}
UpdateVehicleParamsEx(vehicleid, true, "Engine", "Boot", "Doors");
UpdateVehicleParamsEx(vehicleid, true, "Alarm", "Bonnet", "Doors", "Boot", "Engine");
|
pawn Код:
pawn Код:
or pawn Код:
Notice: true is for ON and false is for OFF. |
enum
Params_type
{
Engine,
Lights,
Alarm,
Doors,
Bonnet,
Boot,
Objective
};
stock UpdateVehicleParamsEx(vehicleid, status, {Params_type}:...)
{
new
v_Params[7],
argpos = numargs() - 2; // vehicleid and status = 2 arguments
GetVehicleParamsEx(vehicleid, v_Params[0], v_Params[1], v_Params[2], v_Params[3], v_Params[4], v_Params[5], v_Params[6]);
while(argpos--)
{
switch(Params_type:getarg(argpos+2))
{
case Engine: v_Params[0] = status;
case Lights: v_Params[1] = status;
case Alarm: v_Params[2] = status;
case Doors: v_Params[3] = status;
case Bonnet: v_Params[4] = status;
case Boot: v_Params[5] = status;
case Objective: v_Params[6] = status;
}
}
SetVehicleParamsEx(vehicleid, v_Params[0], v_Params[1], v_Params[2], v_Params[3], v_Params[4], v_Params[5], v_Params[6]);
return 1;
}
stock
UpdateVehicleParamsEx(vehicleid, status, {Params_type}:...)
{
new
v_Params[7],
argpos = numargs() - 2; // vehicleid and status = 2 arguments
GetVehicleParamsEx(vehicleid, v_Params[0], v_Params[1], v_Params[2], v_Params[3], v_Params[4], v_Params[5], v_Params[6]);
while(argpos--)
v_Params[getarg(argpos+2)] = status;
SetVehicleParamsEx(vehicleid, v_Params[0], v_Params[1], v_Params[2], v_Params[3], v_Params[4], v_Params[5], v_Params[6]);
return 1;
}
COMMAND:testparams(playerid, params[])
{
new
vehicleid = GetPlayerVehicleID(playerid);
if(vehicleid)
UpdateVehicleParamsEx(vehicleid, VEHICLE_PARAMS_ON, Lights, Boot, Bonnet);
return 1;
}