17.09.2012, 20:42
Useful Snippets
18.09.2012, 02:02
Oops didnt think of mistakes in that reload detector.
Thanks all and now I've fixed it.
Thanks all and now I've fixed it.
23.09.2012, 04:00
(
Последний раз редактировалось Lordzy; 08.01.2014 в 13:07.
)
<REMOVED>
23.09.2012, 04:21
Hmmm didn't know you could
if(GetPlayerScore(playerid) == 50,100,150,250) {
That actually works?
if(GetPlayerScore(playerid) == 50,100,150,250) {
That actually works?
23.09.2012, 04:31
23.09.2012, 04:32
even i neveer knew that
23.09.2012, 12:59
Quote:
You're confusing switch with if checks.
In switch cases you can do this pawn Код:
pawn Код:
pawn Код:
|
Quote:
Originally Posted by [HLF]SouthClaw
One more thing about switch, you can only have static number checks so this isn't valid:
pawn Код:
|
Can you explain?
Btw the code which I posted is wrong or correct?
It worked for me before.
23.09.2012, 13:13
Umm..okay.
Like this :
.
Like this :
pawn Код:
#include <a_samp>
#define F_Weaps 38,37,36,35
public OnPlayerUpdate(playerid)
{
switch(GetPlayerWeapon(playerid))
{
case F_Weaps: Ban(playerid);
}
return 1;
}
23.09.2012, 14:24
Simple RCON Login Protector:
Thanks to the SA-MP Scripting IRC channel for the login attempt counter
Thanks to the SA-MP Scripting IRC channel for the login attempt counter
Quote:
#pragma tabsize 0 new RCONLoginCount[MAX_PLAYERS]; public OnPlayerConnect(playerid) { RCONLoginCount[playerid] = 0; return 1; } public OnRconLoginAttempt(ip[], password[], success) { if(!success) //If the password was incorrect { printf("Someone tried to login to your RCON! %s tried to login with password: %s",ip, password); new PlayerIP[16]; for(new i=0; i<MAX_PLAYERS; i++) //Loop through all players { GetPlayerIp(i, PlayerIP, sizeof(PlayerIP)); if(!strcmp(ip, PlayerIP, true)) //If a player's IP is the IP that failed the login { RCONLoginCount[i] ++; if(RCONLoginCount[i] >= 5) Ban(i); print("The hacker has been BANNED."); } } } return 1; } |
24.09.2012, 05:13
25.09.2012, 15:50
Here's a huge array of country names I had sitting in my scripts that I made a while back:
Can't find a use for it, xD.
pawn Код:
new stock cntNames[][] =
{
{"Alaska"},
{"Greenland"},
{"Canada"},
{"United States"},
{"Mexico"},
{"Guatemala"},
{"El Salvador"},
{"Costa Rica"},
{"Panama"},
{"Cuba"},
{"Jamaica"},
{"Belize"},
{"Honduras"},
{"Nicaragua"},
{"Haiti"},
{"Puerto Rico"},
{"Bahamas"},
{"Dominican Republic"},
{"Dominica"},
{"Barbados"},
{"Trinidad and Tobago"},
{"Guyana"},
{"Suriname"},
{"French Guiana"},
{"Venezuela"},
{"Colombia"},
{"Ecuador"},
{"Peru"},
{"Brazil"},
{"Bolivia"},
{"Paraguay"},
{"Uruguay"},
{"Chile"},
{"Argentina"},
{"Europe"},
{"Iceland"},
{"Ireland"},
{"United Kingdom"},
{"Norway"},
{"Sweden"},
{"Finland"},
{"Estonia"},
{"Latvia"},
{"Portugal"},
{"Spain"},
{"France"},
{"The Netherlands"},
{"Italy"},
{"Switzerland"},
{"Austria"},
{"Bosnia and Herzegovina"},
{"Hungary"},
{"Slovakia"},
{"Slovenia"},
{"Romania"},
{"Lithuania"},
{"Belarus"},
{"Ukraine"},
{"Moldova"},
{"Bulgaria"},
{"Turkey"},
{"Greece"},
{"Albania"},
{"Czechoslovakia"},
{"Yugoslavia"},
{"Croatia"},
{"Germany"},
{"Poland"},
{"Russia"},
{"Asia"},
{"Syria"},
{"Israel"},
{"Iraq"},
{"Jordan"},
{"Kuwait"},
{"Qatar"},
{"U.A.E."},
{"Saudi Arabia"},
{"Oman"},
{"Yemen"},
{"Iran"},
{"Georgia"},
{"Armenia"},
{"Azerbaijan"},
{"Turkmenistan"},
{"Uzbekistan"},
{"Kazakhstan"},
{"Kyrgyzstan"},
{"Tajikistan"},
{"Afghanistan"},
{"Pakistan"},
{"India"},
{"Nepal"},
{"Bhutan"},
{"Bangladesh"},
{"Mongolia"},
{"Korea"},
{"Japan"},
{"China"},
{"Myanmar"},
{"Laos"},
{"Thailand"},
{"Vietnam"},
{"Cambodia"},
{"Sri Lanka"},
{"Maldives"},
{"Brunei"},
{"Malaysia"},
{"Singapore"},
{"Indonesia"},
{"Taiwan"},
{"Philippines"},
{"Guam"},
{"Micronesia"},
{"Solomon Islands"},
{"Kiribati"},
{"Hawaii"},
{"Papua New Guinea"},
{"New Caledonia"},
{"Australia"},
{"Tasmania"},
{"New Zealand"},
{"Fiji"},
{"Africa"},
{"Morocco"},
{"Tunisia"},
{"Algeria"},
{"Western Sahara"},
{"Senegal"},
{"The Gambia"},
{"Guinea-Bissau"},
{"Sierra Leone"},
{"Liberia"},
{"Guinea"},
{"Mauritania"},
{"Libya"},
{"Egypt"},
{"Sudan"},
{"Ethiopia"},
{"Somalia"},
{"Dijbouti"},
{"Chad"},
{"Congo"},
{"C.A.R."},
{"Niger"},
{"Nigeria"},
{"Cameroon"},
{"Benin"},
{"Burkina Faso"},
{"Mali"},
{"Ghana"},
{"Togo"},
{"Sao Tome & Principe"},
{"Gabon"},
{"Uganda"},
{"Rwanda"},
{"Zaire"},
{"Kenya"},
{"Burundi"},
{"Tanzania"},
{"Mozambique"},
{"Zimbabwe"},
{"Swaziland"},
{"Lesotho"},
{"Madagascar"},
{"South Africa"},
{"Botswana"},
{"Zambia"},
{"Malawi"},
{"Angola"},
{"Namibia"},
{"Antarctica"},
{"North Pole"},
{"South Pole"}
};
25.09.2012, 16:49
Quote:
Here's a use: I have the GeoIP plugin, and often players connect with an un-listed IP so GeoIP just returns a blank country name, in this case I have a randomiser that chooses from: Liberty City, Mordor, Narnia, Mars... and a few more random places, you could use it for that!
|
Or, for example, if a player is entering a country name in a dialog box, you can loop through the whole array and find similar matches, then display them to the player.
I've been tampering with that huge array for a while now. :S
26.09.2012, 16:29
@Emmet_ Yugoslavia does not exist anymore. It's now Serbia, Croatia, Montenegro etc. :3
15.12.2012, 01:40
Chat while server restart(only tested in a local server):
Make a FS with this code:
Add this to your gamemode:
Make a FS with this code:
pawn Код:
#include <a_samp>
public OnPlayerText(playerid, text[])
{
if(!CallRemoteFunction("Running", ""))
{
new str[128 + MAX_PLAYER_NAME];
GetPlayerName(playerid, str, MAX_PLAYER_NAME);
format(str, sizeof str, "{808080}%s:{FFFFFF} %s", str, text);
SendClientMessageToAll(-1, str);
}
return 1;
}
pawn Код:
forward Running();
public Running() return 1;
10.01.2013, 03:40
Get player id from part of name.
pawn Код:
if(!strfind(cmdtext, "/pegarid", true)){
if(strlen(cmdtext) == 9 || strlen(cmdtext) == 8)
return SendClientMessage(playerid, -1, "/Pegarid <nome>");
static
NickName[32],
TotalPlayers,
iString[60],
Integer
;
strdel(cmdtext, 0, 9);
for(TotalPlayers = GetMaxPlayers(), Integer = 0; Integer != TotalPlayers; ++Integer){
GetPlayerName(Integer, NickName, 24);
if(strfind(NickName, cmdtext, true) != -1){
format(iString, 128, "%s[ID:%i]", NickName, Integer);
SendClientMessage(playerid, -1, iString);
break;
}
}
if(Integer == (TotalPlayers)){
SendClientMessage(playerid, -1, "NUN ACHO, I AGORA ?");
}
return true;
}
03.02.2013, 02:33
Where can I get Functions Or Filterscript,, AUTO PARK
I mean it, "if we get out of the car or we logout of the server, my car was in last place out of.
I mean it, "if we get out of the car or we logout of the server, my car was in last place out of.
03.02.2013, 02:53
pawn Код:
#define cache_get_row_int(%0,%1,%2,%3) cache_get_row(%0,%1,temporaryVariable,%3), %2 = strval(temporaryVariable)
pawn Код:
new temporaryVariable[128];
cache_get_row_int(0, 44, playersAge, mConnectionHandle);
cache_get_row_int(0, 45, playersGender, mConnectionHandle);
09.02.2013, 02:32
(
Последний раз редактировалось JordanMaddox; 10.02.2013 в 12:52.
)
It's not much...made it in like 5 minutes...but I guess it can be quite useful
Код:
#define COLOR_YELLOW 0xFFFF00AA //<--Incase you don't have yellow defined, add it to the top of your script with all your other definitions CMD:arims(playerid, params[]) { if(PlayerInfo[playerid][pAdmin] >= changeme) //Change this to whatever you use { if(isnull(params)) { SendClientMessage(playerid, COLOR_WHITE, "USAGE: /arims [rim model]"); SendClientMessage(playerid, COLOR_GRAD1, "Rim Models: Cutter, Switch, OffRoad, Shadow, Mega, Rimshine, Wire"); return 1; } if(strcmp(params,"cutter",true) == 0) { SendClientMessage(playerid, COLOR_YELLOW, "You have placed Cutter Rims on this vehicle."); AddVehicleComponent(GetPlayerVehicleID(playerid), 1079); } else if(strcmp(params,"switch",true) == 0) { SendClientMessage(playerid, COLOR_YELLOW, "You have placed Switch Rims on this vehicle."); AddVehicleComponent(GetPlayerVehicleID(playerid), 1080); } else if(strcmp(params,"offroad",true) == 0) { SendClientMessage(playerid, COLOR_YELLOW, "You have placed OffRoad Rims on this vehicle."); AddVehicleComponent(GetPlayerVehicleID(playerid), 1026); } else if(strcmp(params,"shadow",true) == 0) { SendClientMessage(playerid, COLOR_YELLOW, "You have placed Shadow Rims on this vehicle."); AddVehicleComponent(GetPlayerVehicleID(playerid), 1073); } else if(strcmp(params,"mega",true) == 0) { SendClientMessage(playerid, COLOR_YELLOW, "You have placed Mega Rims on this vehicle."); AddVehicleComponent(GetPlayerVehicleID(playerid), 1074); } else if(strcmp(params,"rimshine",true) == 0) { SendClientMessage(playerid, COLOR_YELLOW, "You have placed Rimshine Rims on this vehicle."); AddVehicleComponent(GetPlayerVehicleID(playerid), 1075); } else if(strcmp(params,"wire",true) == 0) { SendClientMessage(playerid, COLOR_YELLOW, "You have placed Wire Rims on this vehicle."); AddVehicleComponent(GetPlayerVehicleID(playerid), 1076); } } else { SendClientMessage(playerid, COLOR_GRAD1, "You're not authorized to use that command!"); } return 1; }
10.02.2013, 20:25
(
Последний раз редактировалось DonWade; 11.02.2013 в 11:35.
)
Don't know if anyone posted something like this but just created it for myself , could be used by someone:
Код:
stock FindFreeObjectSlot(playerid) { for(new i; i < MAX_PLAYER_ATTACHED_OBJECTS; i++) { if(!IsPlayerAttachedObjectSlotUsed(playerid, i)) { return i; } } return -1; }
10.02.2013, 20:58
Quote:
It's not much...made it in like 5 minutes...but I guess it can be quite useful
Код:
#define COLOR_YELLOW 0xFFFF00AA //<--Incase you don't have yellow defined, add it to the top of your script with all your other definitions CMD:arims(playerid, params[]) { if(PlayerInfo[playerid][pAdmin] >= changeme) //Change this to whatever you use { if(isnull(params)) { SendClientMessage(playerid, COLOR_WHITE, "USAGE: /arims [rim model]"); SendClientMessage(playerid, COLOR_GRAD1, "Rim Models: Cutter, Switch, OffRoad, Shadow, Mega, Rimshine, Wire"); return 1; } if(strcmp(params,"cutter",true) == 0) { SendClientMessage(playerid, COLOR_YELLOW, "You have placed Cutter Rims on this vehicle."); AddVehicleComponent(GetPlayerVehicleID(playerid), 1079); } else if(strcmp(params,"switch",true) == 0) { SendClientMessage(playerid, COLOR_YELLOW, "You have placed Switch Rims on this vehicle."); AddVehicleComponent(GetPlayerVehicleID(playerid), 1080); } else if(strcmp(params,"offroad",true) == 0) { SendClientMessage(playerid, COLOR_YELLOW, "You have placed OffRoad Rims on this vehicle."); AddVehicleComponent(GetPlayerVehicleID(playerid), 1026); } else if(strcmp(params,"shadow",true) == 0) { SendClientMessage(playerid, COLOR_YELLOW, "You have placed Shadow Rims on this vehicle."); AddVehicleComponent(GetPlayerVehicleID(playerid), 1073); } else if(strcmp(params,"mega",true) == 0) { SendClientMessage(playerid, COLOR_YELLOW, "You have placed Mega Rims on this vehicle."); AddVehicleComponent(GetPlayerVehicleID(playerid), 1074); } else if(strcmp(params,"rimshine",true) == 0) { SendClientMessage(playerid, COLOR_YELLOW, "You have placed Rimshine Rims on this vehicle."); AddVehicleComponent(GetPlayerVehicleID(playerid), 1075); } else if(strcmp(params,"wire",true) == 0) { SendClientMessage(playerid, COLOR_YELLOW, "You have placed Wire Rims on this vehicle."); AddVehicleComponent(GetPlayerVehicleID(playerid), 1076); } } else { SendClientMessage(playerid, COLOR_GRAD1, "You're not authorized to use that command!"); } return 1; } |
pawn Код:
PlayerInfo[playerid][pAdmin] >= changeme
« Next Oldest | Next Newest »
Users browsing this thread: 1 Guest(s)