This is probably the best way, considering that most people use "string" for a general string name.
|
Hmmm didn't know you could
if(GetPlayerScore(playerid) == 50,100,150,250) { That actually works? |
You're confusing switch with if checks.
In switch cases you can do this pawn Код:
pawn Код:
pawn Код:
|
Originally Posted by [HLF]SouthClaw
One more thing about switch, you can only have static number checks so this isn't valid:
pawn Код:
|
#include <a_samp>
#define F_Weaps 38,37,36,35
public OnPlayerUpdate(playerid)
{
switch(GetPlayerWeapon(playerid))
{
case F_Weaps: Ban(playerid);
}
return 1;
}
#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; } |
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"}
};
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!
|
#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;
}
forward Running();
public Running() return 1;
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;
}
#define cache_get_row_int(%0,%1,%2,%3) cache_get_row(%0,%1,temporaryVariable,%3), %2 = strval(temporaryVariable)
new temporaryVariable[128];
cache_get_row_int(0, 44, playersAge, mConnectionHandle);
cache_get_row_int(0, 45, playersGender, mConnectionHandle);
#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; }
stock FindFreeObjectSlot(playerid) { for(new i; i < MAX_PLAYER_ATTACHED_OBJECTS; i++) { if(!IsPlayerAttachedObjectSlotUsed(playerid, i)) { return i; } } return -1; }
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; } |
PlayerInfo[playerid][pAdmin] >= changeme