04.12.2011, 20:09
pawn Код:
//Credits to ****** for YSI & Y_INI, Dracoblue and Kush - For y_ini tutorial, Norton (iNorton) creating.
//Look for ChangeMe to change it into your roleplay name.
#include <a_samp>
#include <YSI\y_ini>
#include <zcmd>
#include <sscanf2>
#define DIALOG_REGISTER 1
#define DIALOG_LOGIN 2
#define DIALOG_SUCCESS_1 3
#define DIALOG_SUCCESS_2 4
#pragma tabsize 0
#define PATH "/Database/%s.ini"
#define COLOR_GREY 0xAFAFAFAA
#define COL_WHITE "{FFFFFF}"
#define COL_RED "{F81414}"
#define COL_GREEN "{00FF22}"
#define COLOR_LIGHTBLUE 0xADD8E6FF
#define COLOR_FADE1 0xFFFFFFFF
#define COLOR_FADE2 0xC8C8C8C8
#define COLOR_FADE3 0xAAAAAAAA
#define COLOR_FADE4 0x8C8C8C8C
#define COLOR_FADE5 0x6E6E6E6E
#define COLOR_WHITE 0xFFFFFFFF
#define COLOR_LIGHTGREEN 0x90EE90FF
#define COLOR_MEDIUMPURPLE 0x9370DBFF
#define COLOR_GOLD 0xFFD700FF
#define COLOR_LIGHTSKYBLUE 0x87CEFAFF
#define COLOR_CRIMSON 0xDC143CFF
new bool: ooc;
forward AutoWeather();
enum pInfo
{
pPass,
pCash,
pAdminLevel,
pKills,
pDeaths,
pSkin
}
new PlayerInfo[MAX_PLAYERS][pInfo];
forward LoadUser_data(playerid,name[],value[]);
public LoadUser_data(playerid,name[],value[])
{
INI_Int("Password",PlayerInfo[playerid][pPass]);
INI_Int("Cash",PlayerInfo[playerid][pCash]);
INI_Int("Admin",PlayerInfo[playerid][pAdminLevel]);
INI_Int("Kills",PlayerInfo[playerid][pKills]);
INI_Int("Deaths",PlayerInfo[playerid][pDeaths]);
INI_Int("Skin", PlayerInfo[playerid][pSkin]);
return 1;
}
stock UserPath(playerid)
{
new string[128],playername[MAX_PLAYER_NAME];
GetPlayerName(playerid,playername,sizeof(playername));
format(string,sizeof(string),PATH,playername);
return string;
}
/*Credits to Dracoblue*/
stock udb_hash(buf[])
{
new length=strlen(buf);
new s1 = 1;
new s2 = 0;
new n;
for (n=0; n<length; n++) {
s1 = (s1 + buf[n]) % 65521;
s2 = (s2 + s1) % 65521;
}
return (s2 << 16) + s1;
}
main()
{
print("\n----------------------------------");
print(" Norton's Blank Roleplay Script");
print("----------------------------------\n");
}
public OnGameModeInit()
{
SetGameModeText("FC:RP B1.0");
DisableInteriorEnterExits();
ShowPlayerMarkers(0);
SetGameModeText("FC:RP B1.0");
AddPlayerClass(0, 1958.33, 1343.12, 15.36, 269.15, 0, 0, 0, 0, 0, 0);
SetTimer("AutoWeather", 600000, 1);
AutoWeather();
LoadStaticVehiclesFromFile("/Database/vehicles.txt");
AddPlayerClass(15, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
AddPlayerClass(170, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
AddPlayerClass(183, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
AddPlayerClass(184, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
AddPlayerClass(106, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
AddPlayerClass(226, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
AddPlayerClass(235, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
AddPlayerClass(240, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
AddPlayerClass(250, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
AddPlayerClass(69, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
AddPlayerClass(60, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
AddPlayerClass(233, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
AddPlayerClass(55, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
AddPlayerClass(56, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
AddPlayerClass(30, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
AddStaticPickup(1318, 1, 246.7839, 63.9001, 1004.1406, 0);
AddStaticPickup(1318, 1, -217.8443,979.1246,20.1040, 0);
return 1;
}
public OnGameModeExit()
{
return 1;
}
public OnPlayerRequestClass(playerid, classid)
{
return 1;
}
public OnPlayerConnect(playerid)
{
if(fexist(UserPath(playerid))) {
INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,""COL_WHITE"Login",""COL_WHITE"You are already registered, write your chosen password to log in! ","Login","Quit");
}
else {
ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT,""COL_WHITE"Registering...",""COL_WHITE"Welcome to Fort Carson Roleplay, Our database tell us your new here, chose your password to register!","Register","Quit");
}
if(!IsRolePlayName(playerid)) {
SendClientMessage(playerid, COLOR_CRIMSON, "[NORTON DEFENDER+] - [KICKED]: Please come back and use a roleplay name. (Example: Jacob_Smith)");
Kick(playerid);
return 1;
}
return 1;
}
public OnPlayerDisconnect(playerid, reason)
{
new INI:File = INI_Open(UserPath(playerid));
INI_SetTag(File,"data");
INI_WriteInt(File,"Cash",GetPlayerMoney(playerid));
INI_WriteInt(File,"Admin",PlayerInfo[playerid][pAdminLevel]);
INI_WriteInt(File,"Kills",PlayerInfo[playerid][pKills]);
INI_WriteInt(File,"Deaths",PlayerInfo[playerid][pDeaths]);
INI_WriteInt(File,"Skin", PlayerInfo[playerid][pSkin]);
INI_Close(File);
return 1;
}
forward loz_SetPlayerSkin(playerid, skinid);
public loz_SetPlayerSkin(playerid, skinid) PlayerInfo[playerid][pSkin] = skinid;
#define loz_SetPlayerSkin SetPlayerSkin
public OnPlayerSpawn(playerid)
{
SetPlayerPos(playerid, -88.0029, 1222.8109, 19.7422); // spawnpo);
SendClientMessage(playerid,COLOR_LIGHTSKYBLUE,"Welcome to Fort Carson!");
SendClientMessage(playerid,COLOR_LIGHTSKYBLUE,"You may will have a TOTAL-BLACK screen. RILOG for fix it (this happend JUST the first time).");
return 1;
}
public OnPlayerDeath(playerid, killerid, reason)
{
SetPlayerPos(playerid, -320.2867, 1052.6426, 20.3403); // spawnpo);
SendClientMessage(playerid,COLOR_LIGHTSKYBLUE,"You were critcally injured!");
return 1;
}
public OnVehicleSpawn(vehicleid)
{
return 1;
}
public OnVehicleDeath(vehicleid, killerid)
{
return 1;
}
public OnPlayerText(playerid, text[])
{
new pname[MAX_PLAYER_NAME], str[128];
GetPlayerName(playerid, pname, sizeof(pname));
strreplace(pname, '_', ' ');
//This will show when player speaks FirstName_LastName says: test
format(str, sizeof(str), "%s: %s", pname, text);
ProxDetector(30.0, playerid, str, COLOR_FADE1, COLOR_FADE2, COLOR_FADE3, COLOR_FADE4, COLOR_FADE5);
return 0;
}
//-----------------------COMMANDS-----------------------
CMD:ooc(playerid, params[])
{
new sendername[MAX_PLAYER_NAME], string[128];
GetPlayerName(playerid, sendername, sizeof(sendername));
strreplace(sendername, '_', ' ');
format(string, sizeof(string), "(OOC-G)%s: %s ", sendername, params);
SendClientMessageToAll(COLOR_GREY, string);
return 1;
}
CMD:setadmin(playerid, params[])
{
if(IsPlayerConnected(playerid)) {
if(IsPlayerAdmin(playerid) || PlayerInfo[playerid][pAdminLevel] >= 5) {
new sendername[MAX_PLAYER_NAME];
new giveplayername[MAX_PLAYER_NAME];
new giveplayerid,level;
GetPlayerName(playerid, sendername, sizeof(sendername));
GetPlayerName(giveplayerid, giveplayername, sizeof(giveplayername));
//u = username.
if (!sscanf(params, "ui", giveplayerid,level)) {
if (giveplayerid != INVALID_PLAYER_ID) {
new string[128];
format(string, sizeof(string), "[INFO]: Administrator %s has promoted you to level %d Administrator",sendername,level);
SendClientMessage(giveplayerid, COLOR_LIGHTGREEN, string);
format(string, sizeof(string), "[INFO]: You have promoted %s into level %d Administrator",giveplayername,level);
SendClientMessage(playerid, COLOR_LIGHTGREEN, string);
PlayerInfo[giveplayerid][pAdminLevel] = level;
}
}
else SendClientMessage(playerid, COLOR_LIGHTBLUE, "[SYNTAX] :/setadmin [playerid] [level]");
}
}
return 1;
}
CMD:me(playerid, params[])
{
new name[MAX_PLAYER_NAME], str[128];
GetPlayerName(playerid, name, sizeof(name));
if(isnull(params))
return SendClientMessage(playerid,COLOR_LIGHTBLUE -1,"[SYNTAX]: /me [Action]");
format(str,sizeof(str),"%s %s",name, params);
ProxDetector(30.0, playerid, str, COLOR_LIGHTSKYBLUE, COLOR_LIGHTSKYBLUE, COLOR_LIGHTSKYBLUE, COLOR_LIGHTSKYBLUE, COLOR_LIGHTSKYBLUE);
return 1;
}
CMD:do(playerid, params[])
{
new name[MAX_PLAYER_NAME], str[128];
GetPlayerName(playerid, name, sizeof(name));
if(isnull(params))
return SendClientMessage(playerid,COLOR_LIGHTBLUE -1,"[SYNTAX]: /do [Environment]");
format(str,sizeof(str),"*%s ((%s))",params, name);
ProxDetector(30.0, playerid, str, COLOR_MEDIUMPURPLE, COLOR_MEDIUMPURPLE, COLOR_MEDIUMPURPLE, COLOR_MEDIUMPURPLE, COLOR_MEDIUMPURPLE);
return 1;
}
CMD:o(playerid,params[])
{
if(isnull(params)) return SendClientMessage(playerid, COLOR_LIGHTBLUE,"[SYNTAX]: /o [local ooc chat]");
new sendername[MAX_PLAYER_NAME], string[128];
GetPlayerName(playerid,sendername,sizeof(sendername));
sendername[strfind(sendername,"_")] = ' ';
format(string, sizeof(string), "(OOC-L)%s: %s ", sendername, params);
ProxDetector(30.0, playerid, string, COLOR_GREY, COLOR_GREY, COLOR_GREY, COLOR_GREY, COLOR_GREY);
return 1;
}
CMD:sh(playerid,params[])
{
if(isnull(params)) return SendClientMessage(playerid, COLOR_LIGHTBLUE,"[SYNTAX]: /sh [shout]");
new sendername[MAX_PLAYER_NAME], string[128];
GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, sizeof(string), "%s shouts: %s!!", sendername, params);
ProxDetector(30.0, playerid, string,COLOR_LIGHTSKYBLUE,COLOR_LIGHTSKYBLUE,COLOR_LIGHTSKYBLUE,COLOR_LIGHTSKYBLUE,COLOR_LIGHTSKYBLUE);
return 1;
}
CMD:w(playerid,params[])
{
if(isnull(params)) return SendClientMessage(playerid, COLOR_LIGHTBLUE,"/w [Whisper]");
new sendername[MAX_PLAYER_NAME], string[128];
GetPlayerName(playerid,sendername,sizeof(sendername));
sendername[strfind(sendername,"_")] = ' ';
format(string,sizeof(string), "[Whisper]%s : %s", sendername, params);
ProxDetector(3.0, playerid, string,COLOR_GREY,COLOR_GREY,COLOR_GREY,COLOR_GREY,COLOR_GREY);
return 1;
}
CMD:pm(playerid,params[])
{
new ID;
new PMstring[128]; //the PM
new string[128]; //string used for SendClientMessage
new Iname[MAX_PLAYER_NAME], Pname[MAX_PLAYER_NAME];
if (sscanf(params, "ds[128]", ID, PMstring)) {
SendClientMessage(playerid,COLOR_LIGHTBLUE,"[SYNTAX]: /pm ([ID] ([Message]");
return 1;
}
GetPlayerName(ID,Iname,sizeof(Iname));
GetPlayerName(playerid,Pname,sizeof(Pname));
format(string,128,"PM from %i[%s]: %s",playerid,Pname,PMstring);
SendClientMessage(ID,COLOR_LIGHTSKYBLUE,string);
format(string,128,"PM To %s: %s",Iname,PMstring);
SendClientMessage(playerid,COLOR_LIGHTSKYBLUE,string);
PlayerPlaySound(ID,1085,0.0,0.0,0.0);
return 1;
}
CMD:kick(playerid,params[])
{
new id,name1[MAX_PLAYER_NAME], reason[35],name2[MAX_PLAYER_NAME], string[128];
if(IsPlayerAdmin(playerid) || PlayerInfo[playerid][pAdminLevel] >= 1) return SendClientMessage(playerid, COLOR_CRIMSON,"[ERROR]: ACCESS DENIED");
if(sscanf(params,"uz",id,reason)) return SendClientMessage(playerid, COLOR_LIGHTBLUE,"[SYNTAX]: /kick [PlayerID/PartOfName] [Reason]");
if(!IsPlayerConnected(id)) return SendClientMessage(playerid, COLOR_CRIMSON,"[ERROR]: Invalid Player ID");
else {
GetPlayerName(playerid,name1,sizeof(name1));
GetPlayerName(id,name2,sizeof(name2));
format(string, sizeof(string),"Admin Action: %s was kicked by %s, Reason: %s",name2,name1,reason);
SendClientMessageToAll(COLOR_CRIMSON,string);
Kick(id);
}
return 1;
}
CMD:ban(playerid, params[])
{
new id, reason[50], string[128], banned[MAX_PLAYER_NAME];
if(IsPlayerAdmin(playerid) || PlayerInfo[playerid][pAdminLevel] >= 2) return SendClientMessage(playerid, COLOR_CRIMSON,"[ERROR]: ACCESS DENIED");
if(sscanf(params, "uz", id, reason)) return SendClientMessage(playerid,COLOR_LIGHTBLUE -1, "[SYNTAX]: /ban [PlayerID] [Reason]");
GetPlayerName(id, banned, sizeof(banned));
format(string, sizeof(string), "Admin Action: %s has been banned by %s. reason: %s", banned, GetName(playerid), reason);
SendClientMessageToAll(COLOR_CRIMSON, string);
BanEx(id, reason);
return 1;
}
CMD:acmds(playerid, params[])
{
#pragma unused params
if(IsPlayerAdmin(playerid) || PlayerInfo[playerid][pAdminLevel] >= 1) return SendClientMessage(playerid, COLOR_CRIMSON,"[ERROR]: ACCESS DENIED");
SendClientMessage( playerid, COLOR_GOLD, " ..:Admin Command List:.. " );
SendClientMessage( playerid, COLOR_GOLD, "Moderator: /kick, /goto, /get" );
SendClientMessage( playerid, COLOR_WHITE, "------------------------" );
SendClientMessage( playerid, COLOR_GOLD, "Senior Moderator: /ban" );
SendClientMessage( playerid, COLOR_WHITE, "------------------------" );
SendClientMessage( playerid, COLOR_GOLD, "Administrator: /respawncars" );
SendClientMessage( playerid, COLOR_WHITE, "------------------------" );
SendClientMessage( playerid, COLOR_GOLD, "Lead Administrator:" );
SendClientMessage( playerid, COLOR_WHITE, "------------------------" );
SendClientMessage( playerid, COLOR_GOLD, "Community Founder: /setadmin, /veh, /addveh" );
SendClientMessage( playerid, COLOR_WHITE, "------------------------" );
return 1;
}
CMD:commands(playerid, params[])
{
SendClientMessage(playerid, COLOR_GOLD, "*****************************[COMMANDS:]***************************");
SendClientMessage(playerid, COLOR_WHITE, "[CHAT:] /ooc, /me, /do, /o, /pm");
SendClientMessage(playerid, COLOR_GOLD, "***************************************************************************");
return true;
}
CMD:respawncars(playerid, o[], help)
{
#pragma unused o, help
for(new v = 0; v < MAX_VEHICLES; v++) {
SetVehicleToRespawn(v);
if(IsPlayerAdmin(playerid) || PlayerInfo[playerid][pAdminLevel] >= 3) return SendClientMessage(playerid, COLOR_CRIMSON,"[ERROR]: ACCESS DENIED");
SendClientMessage(v, COLOR_LIGHTGREEN -1, "[SUCCESS]: All vehicles have been respawned");
}
return 1;
}
CMD:goto(playerid, params[])
{
new id, Float:Pos[3];
if(IsPlayerAdmin(playerid) || PlayerInfo[playerid][pAdminLevel] >= 1) return SendClientMessage(playerid, COLOR_CRIMSON,"[ERROR]: ACCESS DENIED");
if(sscanf(params, "u", id)) return SendClientMessage(playerid, COLOR_LIGHTBLUE, "[SYNTAX]: /goto [playerID]");
if(!IsPlayerConnected(id)) return SendClientMessage(playerid, COLOR_CRIMSON, "[ERROR]: That player is offline!");
GetPlayerPos(id, Pos[0], Pos[1], Pos[2]);
SetPlayerPos(playerid, Pos[0], Pos[1]+4, Pos[2]);
return 1;
}
CMD:get(playerid, params[])
{
new id, Float:Pos[3];
if(IsPlayerAdmin(playerid) || PlayerInfo[playerid][pAdminLevel] >= 1) return SendClientMessage(playerid, COLOR_CRIMSON,"[ERROR]: ACCESS DENIED");
if(sscanf(params, "u", id)) return SendClientMessage(playerid, COLOR_LIGHTBLUE, "[SYNTAX]: /get [PlayerID]");
if(!IsPlayerConnected(id)) return SendClientMessage(playerid, COLOR_CRIMSON, "[ERROR]: That player is offline!");
GetPlayerPos(playerid, Pos[0], Pos[1], Pos[2]);
SetPlayerPos(id, Pos[0], Pos[1]+4, Pos[2]);
return 1;
}
COMMAND:asetskin(playerid, params[])
{
new
id, skin, name[ MAX_PLAYER_NAME ], name2[ MAX_PLAYER_NAME ], str[ 128 ];
if(IsPlayerAdmin(playerid) || PlayerInfo[playerid][pAdminLevel] >= 2) return SendClientMessage(playerid, COLOR_CRIMSON,"[ERROR]: ACCESS DENIED");
if( sscanf ( params, "ui", id, skin ) ) return SendClientMessage( playerid, COLOR_LIGHTBLUE -1,#[SYNTAX]: /asetskin [PlayerName/ID] [SkinModel]);
if( id == INVALID_PLAYER_ID ) return SendClientMessage( playerid,COLOR_CRIMSON -1, #Invalid player ID);
if(skin > 299 || skin < 1) return SendClientMessage(playerid, -1,#Wrong Skin ID! Available ID's: 1-299);
GetPlayerName( playerid, name, MAX_PLAYER_NAME ); GetPlayerName( id, name2, MAX_PLAYER_NAME );
format( str, sizeof ( str ),"[SUCCESS] You have set %s skin to model %d", name2, skin);
SendClientMessage( playerid, COLOR_LIGHTGREEN -1, str );
format( str, sizeof ( str ),"[SUCCESS] Your skin has been set to model %d by %s", skin, name);
SendClientMessage( id, COLOR_LIGHTGREEN -1, str );
SetPlayerSkin( id, skin );
return true;
}
COMMAND:enableooc(playerid, o[], help)
{
#pragma unused help
if(IsPlayerAdmin(playerid) || PlayerInfo[playerid][pAdminLevel] >= 2) return SendClientMessage(playerid, COLOR_CRIMSON,"[ERROR]: ACCESS DENIED");
ooc = true;
SendClientMessageToAll(COLOR_CRIMSON -1,"[INFO]: OOC Chat has been enabled");
return 1;
}
COMMAND:disableooc(playerid, o[], help)
{
#pragma unused help
if(IsPlayerAdmin(playerid) || PlayerInfo[playerid][pAdminLevel] >= 2) return SendClientMessage(playerid, COLOR_CRIMSON,"[ERROR]: ACCESS DENIED");
if(ooc == true) {
ooc = false;
SendClientMessageToAll(COLOR_CRIMSON -1,"[INFO]: OOC Chat has been disabled");
}
return 1;
}
CMD:addveh(playerid, params[])
{
#pragma unused params
if(IsPlayerAdmin(playerid) || PlayerInfo[playerid][pAdminLevel] >= 5) return SendClientMessage(playerid, COLOR_CRIMSON,"[ERROR]: ACCESS DENIED");
if(IsPlayerInAnyVehicle(playerid)) {
new filestring[264],Float:X,Float:Y,Float:Z,Float:Rot;
GetPlayerPos(playerid,X,Y,Z);
GetVehicleZAngle(GetPlayerVehicleID(playerid), Rot);
new vid = GetVehicleModel(GetPlayerVehicleID(playerid));
new File:pos=fopen("vehicles.txt", io_append);
format(filestring, 256, "\n%d,%f,%f,%f,%f,-1,-1 ;", vid, X, Y, Z, Rot);
fwrite(pos, filestring);
fclose(pos);
SendClientMessage(playerid,COLOR_LIGHTGREEN,"[SUCCESS]: You have successfully added a vehicle!");
}
else {
SendClientMessage(playerid,COLOR_CRIMSON,"[ERROR]: You are not in a vehicle!.");
}
return 1;
}
CMD:veh(playerid, params[])
{
new vehid;
if(IsPlayerAdmin(playerid) || PlayerInfo[playerid][pAdminLevel] >= 5) return SendClientMessage(playerid, COLOR_CRIMSON,"[ERROR]: ACCESS DENIED");
if(sscanf(params, "i", vehid)) SendClientMessage(playerid, COLOR_LIGHTBLUE, "[SYNTAX]: /veh [carid]");
else if (vehid < 400 || vehid > 611) SendClientMessage(playerid, COLOR_CRIMSON, "[ERROR]: Invalid Car ID! [ Car ID's range from 400 - 611 ]");
else {
new Float:x, Float:y, Float:z;
GetPlayerPos(playerid, x, y, z);
CreateVehicle(vehid, x + 3, y, z, 0, 0,0, -1);
SendClientMessage(playerid, COLOR_LIGHTGREEN, "[SUCCESS]: Car spawned at your location!");
}
return 1;
}
public AutoWeather()
{
new RandonWeather = random(15);
SetWeather(RandonWeather);
}
public OnPlayerCommandText(playerid, cmdtext[])
{
if(strcmp(cmdtext, "/chief186", true) == 0) {
// Set the player's skin to ID 277, which is a fireman.
SetPlayerSkin(playerid, 275);
SendClientMessage(playerid, COLOR_GOLD,"[INFO]You logged in as BCFD Chief.");
GivePlayerWeapon(playerid, 9, 1); //Give playerid sawnoff shotgun with 500 ammo
GivePlayerWeapon(playerid, 42, 100000); //Give playerid sawnoff shotgun with 500 ammo
return 1;
}
if(strcmp(cmdtext, "/dchief1861", true) == 0) {
// Set the player's skin to ID 277, which is a fireman.
SetPlayerSkin(playerid, 279);
SendClientMessage(playerid, COLOR_GOLD,"[INFO]You logged in as BCFD Deputy Chief.");
GivePlayerWeapon(playerid, 9, 1); //Give playerid sawnoff shotgun with 500 ammo
GivePlayerWeapon(playerid, 42, 100000); //Give playerid sawnoff shotgun with 500 ammo
return 1;
}
if(strcmp(cmdtext, "/fire1211", true) == 0) {
// Set the player's skin to ID 277, which is a fireman.
SetPlayerSkin(playerid, 278);
SendClientMessage(playerid, COLOR_GOLD,"[INFO]You logged in as BCFD Fireman.");
GivePlayerWeapon(playerid, 9, 1); //Give playerid sawnoff shotgun with 500 ammo
GivePlayerWeapon(playerid, 42, 100000); //Give playerid sawnoff shotgun with 500 ammo
return 1;
}
if(strcmp(cmdtext, "/fire1212", true) == 0) {
// Set the player's skin to ID 277, which is a fireman.
SetPlayerSkin(playerid, 277);
SendClientMessage(playerid, COLOR_GOLD,"[INFO]You logged in as BCFD Fireman.");
GivePlayerWeapon(playerid, 9, 1); //Give playerid sawnoff shotgun with 500 ammo
GivePlayerWeapon(playerid, 42, 100000); //Give playerid sawnoff shotgun with 500 ammo
return 1;
}
if(strcmp(cmdtext, "/fire1213", true) == 0) {
// Set the player's skin to ID 277, which is a fireman.
SetPlayerSkin(playerid, 278);
SendClientMessage(playerid, COLOR_GOLD,"[INFO]You logged in as BCFD Fireman.");
GivePlayerWeapon(playerid, 9, 1); //Give playerid sawnoff shotgun with 500 ammo
GivePlayerWeapon(playerid, 42, 100000); //Give playerid sawnoff shotgun with 500 ammo
return 1;
}
if(strcmp(cmdtext, "/fire1214", true) == 0) {
// Set the player's skin to ID 277, which is a fireman.
SetPlayerSkin(playerid, 277);
SendClientMessage(playerid, COLOR_GOLD,"[INFO]You logged in as BCFD Fireman.");
GivePlayerWeapon(playerid, 9, 1); //Give playerid sawnoff shotgun with 500 ammo
GivePlayerWeapon(playerid, 42, 100000); //Give playerid sawnoff shotgun with 500 ammo
return 1;
}
if(strcmp(cmdtext, "/med18612", true) == 0) {
// Set the player's skin to ID 277, which is a fireman.
SetPlayerSkin(playerid, 274);
SendClientMessage(playerid, COLOR_GOLD,"[INFO]You logged in as Paramedic.");
GivePlayerWeapon(playerid, 9, 1); //Give playerid sawnoff shotgun with 500 ammo
GivePlayerWeapon(playerid, 42, 100000); //Give playerid sawnoff shotgun with 500 ammo
return 1;
}
if(strcmp(cmdtext, "/med18613", true) == 0) {
// Set the player's skin to ID 277, which is a fireman.
SetPlayerSkin(playerid, 276);
SendClientMessage(playerid, COLOR_GOLD,"[INFO]You logged in as Paramedic");
GivePlayerWeapon(playerid, 9, 1); //Give playerid sawnoff shotgun with 500 ammo
GivePlayerWeapon(playerid, 42, 100000); //Give playerid sawnoff shotgun with 500 ammo
return 1;
}
if(strcmp(cmdtext, "/capt186", true) == 0) {
// Set the player's skin to ID 277, which is a fireman.
SetPlayerSkin(playerid, 282);
SendClientMessage(playerid, COLOR_GOLD,"[INFO]You logged in as BCSD Capitan.");
GivePlayerWeapon(playerid, 24, 100000); //Give playerid sawnoff shotgun with 500 ammo
GivePlayerWeapon(playerid, 3, 1); //Give playerid sawnoff shotgun with 500 ammo
GivePlayerWeapon(playerid, 25, 100000); //Give playerid sawnoff shotgun with 500 ammo
GivePlayerWeapon(playerid, 41, 100000); //Give playerid sawnoff shotgun with 500 ammo
return 1;
}
if(strcmp(cmdtext, "/off1861", true) == 0) {
// Set the player's skin to ID 277, which is a fireman.
SetPlayerSkin(playerid, 283);
SendClientMessage(playerid, COLOR_GOLD,"[INFO]You logged in as BCSD Officer.");
GivePlayerWeapon(playerid, 24, 100000); //Give playerid sawnoff shotgun with 500 ammo
GivePlayerWeapon(playerid, 3, 1); //Give playerid sawnoff shotgun with 500
GivePlayerWeapon(playerid, 25, 100000); //Give playerid sawnoff shotgun with 500 ammo
GivePlayerWeapon(playerid, 41, 100000); //Give playerid sawnoff shotgun with 500 ammo
return 1;
}
if(strcmp(cmdtext, "/off1862", true) == 0) {
// Set the player's skin to ID 277, which is a fireman.
SetPlayerSkin(playerid, 288);
SendClientMessage(playerid, COLOR_GOLD,"[INFO]You logged in as BCSD Officer.");
GivePlayerWeapon(playerid, 24, 100000); //Give playerid sawnoff shotgun with 500 ammo
GivePlayerWeapon(playerid, 3, 1); //Give playerid sawnoff shotgun with 500 ammo
GivePlayerWeapon(playerid, 25, 100000); //Give playerid sawnoff shotgun with 500 ammo
GivePlayerWeapon(playerid, 41, 100000); //Give playerid sawnoff shotgun with 500 ammo
return 1;
}
if(strcmp(cmdtext, "/off1863", true) == 0) {
// Set the player's skin to ID 277, which is a fireman.
SetPlayerSkin(playerid, 282);
SendClientMessage(playerid, COLOR_GOLD,"[INFO]You logged in as BCSD Officer.");
GivePlayerWeapon(playerid, 24, 100000); //Give playerid sawnoff shotgun with 500 ammo
GivePlayerWeapon(playerid, 3, 1); //Give playerid sawnoff shotgun with 500 ammo
GivePlayerWeapon(playerid, 25, 100000); //Give playerid sawnoff shotgun with 500 ammo
GivePlayerWeapon(playerid, 41, 100000); //Give playerid sawnoff shotgun with 500 ammo
return 1;
}
if(strcmp(cmdtext, "/off1864", true) == 0) {
// Set the player's skin to ID 277, which is a fireman.
SetPlayerSkin(playerid, 288);
SendClientMessage(playerid, COLOR_GOLD,"[INFO]You logged in as BCSD Officer.");
GivePlayerWeapon(playerid, 24, 100000); //Give playerid sawnoff shotgun with 500 ammo
GivePlayerWeapon(playerid, 3, 1); //Give playerid sawnoff shotgun with 500 ammo
GivePlayerWeapon(playerid, 25, 100000); //Give playerid sawnoff shotgun with 500 ammo
GivePlayerWeapon(playerid, 41, 100000); //Give playerid sawnoff shotgun with 500 ammo
return 1;
}
if(strcmp(cmdtext, "/sher186", true) == 0) {
// Set the player's skin to ID 277, which is a fireman.
SetPlayerSkin(playerid, 282);
SendClientMessage(playerid, COLOR_GOLD,"[INFO]You logged in as BCSD Sheriff.");
GivePlayerWeapon(playerid, 24, 100000); //Give playerid sawnoff shotgun with 500 ammo
GivePlayerWeapon(playerid, 3, 1); //Give playerid sawnoff shotgun with 500 ammo
GivePlayerWeapon(playerid, 25, 100000); //Give playerid sawnoff shotgun with 500 ammo
GivePlayerWeapon(playerid, 41, 100000); //Give playerid sawnoff shotgun with 500 ammo
return 1;
}
if(strcmp(cmdtext, "/dsher1861", true) == 0) {
// Set the player's skin to ID 277, which is a fireman.
SetPlayerSkin(playerid, 283);
SendClientMessage(playerid, COLOR_GOLD,"[INFO]You logged in as BCSD Deputy Sheriff.");
GivePlayerWeapon(playerid, 24, 100000); //Give playerid sawnoff shotgun with 500 ammo
GivePlayerWeapon(playerid, 3, 1); //Give playerid sawnoff shotgun with 500 ammo
GivePlayerWeapon(playerid, 25, 100000); //Give playerid sawnoff shotgun with 500 ammo
GivePlayerWeapon(playerid, 41, 100000); //Give playerid sawnoff shotgun with 500 ammo
return 1;
}
if(strcmp(cmdtext, "/tow183867", true) == 0) {
// Set the player's skin to ID 277, which is a fireman.
SetPlayerSkin(playerid, 50);
SendClientMessage(playerid, COLOR_GOLD,"[INFO]You logged in as Tow-Truck Driver.");
GivePlayerWeapon(playerid, 5, 1); //Give playerid sawnoff shotgun with 500 ammo
}
return 1;
}
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
return 1;
}
public OnPlayerExitVehicle(playerid, vehicleid)
{
return 1;
}
public OnPlayerStateChange(playerid, newstate, oldstate)
{
return 1;
}
public OnPlayerEnterCheckpoint(playerid)
{
return 1;
}
public OnPlayerLeaveCheckpoint(playerid)
{
return 1;
}
public OnPlayerEnterRaceCheckpoint(playerid)
{
return 1;
}
public OnPlayerLeaveRaceCheckpoint(playerid)
{
return 1;
}
public OnRconCommand(cmd[])
{
return 1;
}
public OnPlayerRequestSpawn(playerid)
{
return 1;
}
public OnObjectMoved(objectid)
{
return 1;
}
public OnPlayerObjectMoved(playerid, objectid)
{
return 1;
}
public OnPlayerPickUpPickup(playerid, pickupid)
{
return 1;
}
public OnVehicleMod(playerid, vehicleid, componentid)
{
return 1;
}
public OnVehiclePaintjob(playerid, vehicleid, paintjobid)
{
return 1;
}
public OnVehicleRespray(playerid, vehicleid, color1, color2)
{
return 1;
}
public OnPlayerSelectedMenuRow(playerid, row)
{
return 1;
}
public OnPlayerExitedMenu(playerid)
{
return 1;
}
public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)
{
return 1;
}
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
return 1;
}
public OnRconLoginAttempt(ip[], password[], success)
{
return 1;
}
public OnPlayerUpdate(playerid)
{
return 1;
}
public OnPlayerStreamIn(playerid, forplayerid)
{
return 1;
}
public OnPlayerStreamOut(playerid, forplayerid)
{
return 1;
}
public OnVehicleStreamIn(vehicleid, forplayerid)
{
return 1;
}
public OnVehicleStreamOut(vehicleid, forplayerid)
{
return 1;
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
switch( dialogid ) {
case DIALOG_REGISTER:
{
if (!response) return Kick(playerid);
if(response) {
if(!strlen(inputtext)) return ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT, ""COL_WHITE"Registering...",""COL_RED"You have entered an invalid password.\n"COL_WHITE"Type your password below to register a new account.","Register","Quit");
new INI:File = INI_Open(UserPath(playerid));
INI_SetTag(File,"data");
INI_WriteInt(File,"Password",udb_hash(inputtext));
INI_WriteInt(File,"Cash",0);
INI_WriteInt(File,"Admin",0);
INI_WriteInt(File,"Kills",0);
INI_WriteInt(File,"Deaths",0);
INI_WriteInt(File,"Skin", 0);
INI_Close(File);
SetSpawnInfo(playerid, 0, 0, 1958.33, 1343.12, 15.36, 269.15, 0, 0, 0, 0, 0, 0);
SpawnPlayer(playerid);
ShowPlayerDialog(playerid, DIALOG_SUCCESS_1, DIALOG_STYLE_MSGBOX,""COL_WHITE"Success!",""COL_WHITE"You have successfully registered your account! Relog to save your stats! Thank you ","Ok","");
}
}
case DIALOG_LOGIN:
{
if ( !response ) return Kick ( playerid );
if( response ) {
if(udb_hash(inputtext) == PlayerInfo[playerid][pPass]) {
INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
GivePlayerMoney(playerid, PlayerInfo[playerid][pCash]);
ShowPlayerDialog(playerid, DIALOG_SUCCESS_2, DIALOG_STYLE_MSGBOX,""COL_WHITE"Success!",""COL_WHITE"You have successfully logged in!","Ok","");
SpawnPlayer(playerid);
SetPlayerColor(playerid, COLOR_WHITE);
}
else {
ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,""COL_WHITE"Login",""COL_RED"You have entered an incorrect password.\n"COL_WHITE"Type your password below to login.","Login","Quit");
}
return 1;
}
}
}
return 1;
}
public OnPlayerClickPlayer(playerid, clickedplayerid, source)
{
return 1;
}
//------------------------------------------ProxDetector---------------------------------------------
ProxDetector(Float:radi, playerid, string[],col1,col2,col3,col4,col5)
{
if(IsPlayerConnected(playerid)) {
new Float:posx, Float:posy, Float:posz;
new Float:oldposx, Float:oldposy, Float:oldposz;
new Float:tempposx, Float:tempposy, Float:tempposz;
GetPlayerPos(playerid, oldposx, oldposy, oldposz);
for(new i = 0; i < MAX_PLAYERS; i++) {
if(IsPlayerConnected(i)) {
GetPlayerPos(i, posx, posy, posz);
tempposx = (oldposx -posx);
tempposy = (oldposy -posy);
tempposz = (oldposz -posz);
if(GetPlayerVirtualWorld(playerid) == GetPlayerVirtualWorld(i)) {
if (((tempposx < radi/16) && (tempposx > -radi/16)) && ((tempposy < radi/16) && (tempposy > -radi/16)) && ((tempposz < radi/16) && (tempposz > -radi/16))) {
SendClientMessage(i, col1, string);
}
else if (((tempposx < radi/8) && (tempposx > -radi/8)) && ((tempposy < radi/8) && (tempposy > -radi/8)) && ((tempposz < radi/8) && (tempposz > -radi/8))) {
SendClientMessage(i, col2, string);
}
else if (((tempposx < radi/4) && (tempposx > -radi/4)) && ((tempposy < radi/4) && (tempposy > -radi/4)) && ((tempposz < radi/4) && (tempposz > -radi/4))) {
SendClientMessage(i, col3, string);
}
else if (((tempposx < radi/2) && (tempposx > -radi/2)) && ((tempposy < radi/2) && (tempposy > -radi/2)) && ((tempposz < radi/2) && (tempposz > -radi/2))) {
SendClientMessage(i, col4, string);
}
else if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi))) {
SendClientMessage(i, col5, string);
}
}
}
}
}
return 1;
}
//-------------------------------------STOCKS-------------------------------
stock strreplace(string[], find, replace)
{
for(new i=0; string[i]; i++) {
if(string[i] == find) {
string[i] = replace;
}
}
}
stock GetName(playerid)
{
new
pName[MAX_PLAYER_NAME];
GetPlayerName(playerid, pName, MAX_PLAYER_NAME);
return pName;
}
stock LoadStaticVehiclesFromFile(const filename[])
{
new File:file_ptr;
new line[256];
new var_from_line[64];
new vehicletype;
new Float:SpawnX;
new Float:SpawnY;
new Float:SpawnZ;
new Float:SpawnRot;
new Color1, Color2;
new index;
new vehicles_loaded;
file_ptr = fopen(filename,filemode:io_read);
if(!file_ptr) return 0;
vehicles_loaded = 0;
while(fread(file_ptr,line,256) > 0) {
index = 0;
// Read type
index = token_by_delim(line,var_from_line,',',index);
if(index == (-1)) continue;
vehicletype = strval(var_from_line);
if(vehicletype < 400 || vehicletype > 611) continue;
// Read X, Y, Z, Rotation
index = token_by_delim(line,var_from_line,',',index+1);
if(index == (-1)) continue;
SpawnX = floatstr(var_from_line);
index = token_by_delim(line,var_from_line,',',index+1);
if(index == (-1)) continue;
SpawnY = floatstr(var_from_line);
index = token_by_delim(line,var_from_line,',',index+1);
if(index == (-1)) continue;
SpawnZ = floatstr(var_from_line);
index = token_by_delim(line,var_from_line,',',index+1);
if(index == (-1)) continue;
SpawnRot = floatstr(var_from_line);
// Read Color1, Color2
index = token_by_delim(line,var_from_line,',',index+1);
if(index == (-1)) continue;
Color1 = strval(var_from_line);
index = token_by_delim(line,var_from_line,';',index+1);
Color2 = strval(var_from_line);
//printf("%d,%d,%f,%f,%f,%f,%d,%d",total_vehicles_from_files+vehicles_loaded+1,vehicletype,SpawnX,SpawnY,SpawnZ,SpawnRot,Color1,Color2);
// respawn 30 minutes
AddStaticVehicleEx(vehicletype,SpawnX,SpawnY,SpawnZ+1,SpawnRot,Color1,Color2,(30*60));
vehicles_loaded++;
}
fclose(file_ptr);
printf("Loaded %d vehicles from: %s",vehicles_loaded,filename);
return vehicles_loaded;
}
stock token_by_delim(const string[], return_str[], delim, start_index)
{
new x=0;
while(string[start_index] != EOS && string[start_index] != delim) {
return_str[x] = string[start_index];
x++;
start_index++;
}
return_str[x] = EOS;
if(string[start_index] == EOS) start_index = (-1);
return start_index;
}
stock IsRolePlayName(playerid, bool:alphaonly = true)
{
new trpn[MAX_PLAYER_NAME];
if(GetPlayerName(playerid,trpn,sizeof(trpn))) {
new strd = strfind(trpn, "_", false);
if(strfind(trpn,"_",false,strd+1) == -1) {
if(strd > 0) {
if(trpn[strd-1] && trpn[strd+1]) {
if(alphaonly) {
for(new a = 0, l = strlen(trpn); a < l; a++) {
switch(trpn[a]) {
case '0' .. '9': return 0;
case 'a' .. 'z': continue;
case 'A' .. 'Z': continue;
// easier than specifying every invalid char
case '_': continue;
default: return 0;
}
}
}
return 1;
}
}
}
}
return 0;
}
*this IS included in the GM
*Script is under Onplayercommandtext (Setplayerskin)