22.08.2016, 08:43
(
Last edited by Gorgeousmaniac; 22/08/2016 at 08:45 AM.
Reason: title lacking
)
I am completely new to scripting and I get these errors when compiling my dm script. I am trying to add a login/register script to it.
This is the line with error (56)
This is the whole callback with the line that has the error
This is my whole code
Code:
C:\Users\HELLO WORLD\Desktop\DM\gamemodes\LSDM.pwn(56) : error 001: expected token: "-string end-", but found "-identifier-" C:\Users\HELLO WORLD\Desktop\DM\gamemodes\LSDM.pwn(56) : error 017: undefined symbol "define" C:\Users\HELLO WORLD\Desktop\DM\gamemodes\LSDM.pwn(56) : error 017: undefined symbol "user" C:\Users\HELLO WORLD\Desktop\DM\gamemodes\LSDM.pwn(56) : fatal error 107: too many error messages on one line Compilation aborted.Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase 4 Errors.
Code:
format(str,sizeof(str),UserPath,name);
Code:
stock Path(playerid) //Will create a new stock so we can easily use it later to load/save user's data in user's path { new str[128],name[MAX_PLAYER_NAME]; GetPlayerName(playerid,name,sizeof(name)); format(str,sizeof(str),UserPath,name); return str; }
Code:
#include <a_samp> #include <sscanf2> #include <izcmd> #include <YSI\y_ini> native WP_Hash(buffer[],len,const str[]); // Whirlpool native, add it at the top of your script under includes #define COLOR_GREEN 0x41FB3CFF #define COLOR_LIGHTGREEN 0x00FF00FF #define COLOR_RED 0xFF3737FF #define COLOR_LIGHTRED 0xFF8080FF #define COLOR_BLUE 0x392FF9FF #define COLOR_LIGHTBLUE 0x80FFFFFF #define COLOR_ORANGE 0xFF8000FF #define COLOR_YELLOW 0xFFFF00FF #define COLOR_PURPLE 0x805294FF #define COLOR_PINK 0xFF59FFFF #define COLOR_BLACK 0x000000FF #define COLOR_WHITE 0xFFFFFFFF #define BODY_PART_TORSO 1 #define BODY_PART_CHEST 2 #define BODY_PART_LEFT_ARM 3 #define BODY_PART_RIGHT_ARM 4 #define BODY_PART_LEFT_LEG 5 #define BODY_PART_RIGHT_LEG 6 #define BODY_PART_HEAD 7 #define SHOP_DIALOG 0 #define dregister 2011 //Defining register dialog so it won't mixed up with the other dialogs #define dlogin 2012 //Defining login dialog so it won't mixed up with the other dialogs #define UserPath "Users/%s.ini" /Will define user's account path. In this case, we will save it in Scriptfiles/Users. So create a file inside of your Scriptfiles folder called Users forward loadaccount_user(playerid, name[], value[]); //forwarding a new function to load user's data new gTeam[MAX_PLAYERS]; //Spawn Protection Timer new Spawntimer[MAX_PLAYERS]; // //We will create an enum to store player's data. enum PlayerInfo { Pass[129], //User's password Adminlevel, //User's admin level VIPlevel, //User's vip level Money, //User's money Scores, //User's scores Kills, //User's kills Deaths //User's deaths } new pInfo[MAX_PLAYERS][PlayerInfo]; //This will create a new variable so we can later use it to saving/loading user's info. forward Spawnprotect(playerid); stock Path(playerid) //Will create a new stock so we can easily use it later to load/save user's data in user's path { new str[128],name[MAX_PLAYER_NAME]; GetPlayerName(playerid,name,sizeof(name)); format(str,sizeof(str),UserPath,name); return str; } public Spawnprotect(playerid) { SetPlayerVirtualWorld(playerid, 0); // This will set the player's world to the default (0) SendClientMessage(playerid, -1, "You are now no longer under spawn protection."); // This will send the player a white message. GameTextForPlayer(playerid, "~r~Spawn Protection Off", 3000, 4); // This will send the player a red game text (because of ~r~) and it will last 3000 miliseconds (3 seconds) with game text type 4. SetPlayerHealth(playerid, 100); // We will give back the player's normal health (100) return 1; } main() { print("\n----------------------------------"); print(" Your server name here! "); print("----------------------------------\n"); } //TEAMS #define TEAM_GROVE 0 #define TEAM_POLICE 1 #define TEAM_FIRE 2 #define TEAM_SLUTS 3 #define TEAM_BALLAS 4 #define TEAM_MEXICANS 5 #define TEAM_MAFIA 6 public OnGameModeInit() { SetGameModeText("YourServer vX.X"); DisableInteriorEnterExits(); EnableStuntBonusForAll(0); AddPlayerClass(105, 2495.3105, -1687.8232, 13.5162, 1.2058, 0, 0, 0, 0, 0, 0); //TEAM_GROVE AddPlayerClass(106, 2495.3105, -1687.8232, 13.5162, 1.2058, 0, 0, 0, 0, 0, 0); //TEAM_GROVE AddPlayerClass(107, 2495.3105, -1687.8232, 13.5162, 1.2058, 0, 0, 0, 0, 0, 0); //TEAM_GROVE AddPlayerClass(280, 1568.6521, -1690.8263, 5.8906, 179.6833, 0, 0, 0, 0, 0, 0); //TEAM_POLICE AddPlayerClass(281, 1568.6521, -1690.8263, 5.8906, 179.6833, 0, 0, 0, 0, 0, 0); //TEAM_POLICE AddPlayerClass(282, 1568.6521, -1690.8263, 5.8906, 179.6833, 0, 0, 0, 0, 0, 0); //TEAM_POLICE AddPlayerClass(283, 1568.6521, -1690.8263, 5.8906, 179.6833, 0, 0, 0, 0, 0, 0); //TEAM_POLICE AddPlayerClass(288, 1568.6521, -1690.8263, 5.8906, 179.6833, 0, 0, 0, 0, 0, 0); //TEAM_POLICE AddPlayerClass(284, 1568.6521, -1690.8263, 5.8906, 179.6833, 0, 0, 0, 0, 0, 0); //TEAM_POLICE AddPlayerClass(285, 1568.6521, -1690.8263, 5.8906, 179.6833, 0, 0, 0, 0, 0, 0); //TEAM_POLICE AddPlayerClass(286, 1568.6521, -1690.8263, 5.8906, 179.6833, 0, 0, 0, 0, 0, 0); //TEAM_POLICE AddPlayerClass(287, 1568.6521, -1690.8263, 5.8906, 179.6833, 0, 0, 0, 0, 0, 0); //TEAM_POLICE AddPlayerClass(300, 1568.6521, -1690.8263, 5.8906, 179.6833, 0, 0, 0, 0, 0, 0); //TEAM_POLICE AddPlayerClass(301, 1568.6521, -1690.8263, 5.8906, 179.6833, 0, 0, 0, 0, 0, 0); //TEAM_POLICE AddPlayerClass(302, 1568.6521, -1690.8263, 5.8906, 179.6833, 0, 0, 0, 0, 0, 0); //TEAM_POLICE AddPlayerClass(306, 1568.6521, -1690.8263, 5.8906, 179.6833, 0, 0, 0, 0, 0, 0); //TEAM_POLICE AddPlayerClass(309, 1568.6521, -1690.8263, 5.8906, 179.6833, 0, 0, 0, 0, 0, 0); //TEAM_POLICE AddPlayerClass(310, 1568.6521, -1690.8263, 5.8906, 179.6833, 0, 0, 0, 0, 0, 0); //TEAM_POLICE AddPlayerClass(311, 1568.6521, -1690.8263, 5.8906, 179.6833, 0, 0, 0, 0, 0, 0); //TEAM_POLICE AddPlayerClass(307, 1568.6521, -1690.8263, 5.8906, 179.6833, 0, 0, 0, 0, 0, 0); //TEAM_POLICE AddPlayerClass(277, 1181.2627, -1323.4020, 13.5843, 269.0506, 0, 0, 0, 0, 0, 0); //TEAM_FIRE AddPlayerClass(278, 1181.2627, -1323.4020, 13.5843, 269.0506, 0, 0, 0, 0, 0, 0); //TEAM_FIRE AddPlayerClass(279, 1181.2627, -1323.4020, 13.5843, 269.0506, 0, 0, 0, 0, 0, 0); //TEAM_FIRE AddPlayerClass(274, 1181.2627, -1323.4020, 13.5843, 269.0506, 0, 0, 0, 0, 0, 0); //TEAM_FIRE AddPlayerClass(275, 1181.2627, -1323.4020, 13.5843, 269.0506, 0, 0, 0, 0, 0, 0); //TEAM_FIRE AddPlayerClass(276, 1181.2627, -1323.4020, 13.5843, 269.0506, 0, 0, 0, 0, 0, 0); //TEAM_FIRE AddPlayerClass(308, 1181.2627, -1323.4020, 13.5843, 269.0506, 0, 0, 0, 0, 0, 0); //TEAM_FIRE AddPlayerClass(152, 2421.5195, -1222.0642, 25.3795, 179.6391, 0, 0, 0, 0, 0, 0); //TEAM_SLUTS AddPlayerClass(178, 2421.5195, -1222.0642, 25.3795, 179.6391, 0, 0, 0, 0, 0, 0); //TEAM_SLUTS AddPlayerClass(237, 2421.5195, -1222.0642, 25.3795, 179.6391, 0, 0, 0, 0, 0, 0); //TEAM_SLUTS AddPlayerClass(238, 2421.5195, -1222.0642, 25.3795, 179.6391, 0, 0, 0, 0, 0, 0); //TEAM_SLUTS AddPlayerClass(102, 2166.8865, -1672.3538, 15.0752, 222.8898, 0, 0, 0, 0, 0, 0); //TEAM_BALLAS AddPlayerClass(103, 2166.8865, -1672.3538, 15.0752, 222.8898, 0, 0, 0, 0, 0, 0); //TEAM_BALLAS AddPlayerClass(104, 2166.8865, -1672.3538, 15.0752, 222.8898, 0, 0, 0, 0, 0, 0); //TEAM_BALLAS AddPlayerClass(114, 1874.1731, -2020.4147, 13.5469, 270.3323, 0, 0, 0, 0, 0, 0); //TEAM_MEXICANS AddPlayerClass(115, 1874.1731, -2020.4147, 13.5469, 270.3323, 0, 0, 0, 0, 0, 0); //TEAM_MEXICANS AddPlayerClass(116, 1874.1731, -2020.4147, 13.5469, 270.3323, 0, 0, 0, 0, 0, 0); //TEAM_MEXICANS AddPlayerClass(108, 1874.1731, -2020.4147, 13.5469, 270.3323, 0, 0, 0, 0, 0, 0); //TEAM_MEXICANS AddPlayerClass(109, 1874.1731, -2020.4147, 13.5469, 270.3323, 0, 0, 0, 0, 0, 0); //TEAM_MEXICANS AddPlayerClass(110, 1874.1731, -2020.4147, 13.5469, 270.3323, 0, 0, 0, 0, 0, 0); //TEAM_MEXICANS AddPlayerClass(173, 1874.1731, -2020.4147, 13.5469, 270.3323, 0, 0, 0, 0, 0, 0); //TEAM_MEXICANS AddPlayerClass(174, 1874.1731, -2020.4147, 13.5469, 270.3323, 0, 0, 0, 0, 0, 0); //TEAM_MEXICANS AddPlayerClass(175, 1874.1731, -2020.4147, 13.5469, 270.3323, 0, 0, 0, 0, 0, 0); //TEAM_MEXICANS return 1; } public OnGameModeExit() { return 1; } public OnPlayerWeaponShot(playerid, weaponid, hittype, hitid, Float:fX, Float:fY, Float:fZ) { if(hittype == 1 && gTeam[playerid] == gTeam[hitid]) { SendClientMessage(playerid, COLOR_RED, "Do not shoot your teammates!"); return 0; } return 1; } public OnPlayerRequestClass(playerid, classid) { GameTextForPlayer(playerid, "~r~Select Your Team!", 60000, 5); SetPlayerPos(playerid, 2323.5686, 1283.2742, 97.4860); SetPlayerCameraPos(playerid, 2311.0457, 1283.4103, 101.1352); SetPlayerCameraLookAt(playerid, 2323.5686, 1283.2742, 97.4860); return 1; } public OnPlayerConnect(playerid) { return 1; } public OnPlayerDisconnect(playerid, reason) { //Same as OnDialogResponse, we will save their stats inside of their user's account new INI:file = INI_Open(Path(playerid)); //will open their file INI_SetTag(file,"Player's Data");//We will set a tag inside of user's account called "Player's Data" INI_WriteInt(file,"AdminLevel",pInfo[playerid][Adminlevel]); //If you've set his/her admin level, then his/her admin level will be saved inside of his/her account INI_WriteInt(file,"VIPLevel",pInfo[playerid][VIPlevel]);//As explained above INI_WriteInt(file,"Money",GetPlayerMoney(playerid));//We will save his money inside of his account INI_WriteInt(file,"Scores",GetPlayerScore(playerid));//We will save his score inside of his account INI_WriteInt(file,"Kills",pInfo[playerid][Kills]);//As explained above INI_WriteInt(file,"Deaths",pInfo[playerid][Deaths]);//As explained above INI_Close(file);//Now after we've done saving their data, we now need to close the file return 1; } public OnPlayerSpawn(playerid) { //Spawn Protection new world[MAX_PLAYERS]; world[playerid] = playerid; SetPlayerVirtualWorld(playerid, world[playerid]); if(world[playerid] == 0) { SetPlayerVirtualWorld(playerid, 0); } SetPlayerHealth(playerid, 100000); Spawntimer[playerid] = SetTimerEx("Spawnprotect", 5000, false, "d", playerid); SendClientMessage(playerid, -1, "You are under spawn protection for 5 seconds."); GameTextForPlayer(playerid, "~g~Spawn Protection On", 3000, 4); // SetPlayerSkillLevel(playerid, WEAPONSKILL_SAWNOFF_SHOTGUN, 1); SetPlayerSkillLevel(playerid, WEAPONSKILL_MICRO_UZI, 1); SetPlayerHealth(playerid, 100); SetPlayerArmour(playerid, 100); GivePlayerWeapon(playerid, 25, 1000); GivePlayerWeapon(playerid, 28, 1000); GivePlayerWeapon(playerid, 30, 1000); GivePlayerWeapon(playerid, 33, 1000); GivePlayerWeapon(playerid, 4, 1000); GivePlayerWeapon(playerid, 24, 1000); new playerskin = GetPlayerSkin(playerid); if(playerskin == 105 || playerskin == 106 || playerskin == 107) { gTeam[playerid] = TEAM_GROVE; SetPlayerTeam(playerid, TEAM_GROVE); SetPlayerColor(playerid, COLOR_GREEN); } else if(playerskin == 280 || playerskin == 281 || playerskin == 282 || playerskin == 283 || playerskin == 288 ||playerskin == 284 || playerskin == 285 || playerskin == 286 || playerskin == 287 || playerskin == 300 || playerskin == 301 || playerskin == 302 || playerskin == 306 || playerskin == 309 || playerskin == 310 || playerskin == 311 || playerskin == 307) { gTeam[playerid] = TEAM_POLICE; SetPlayerTeam(playerid, TEAM_POLICE); SetPlayerColor(playerid, COLOR_BLUE); } else if(playerskin == 274 || playerskin == 275 || playerskin == 276 || playerskin == 277 || playerskin == 278 || playerskin == 279|| playerskin == 308) { gTeam[playerid] = TEAM_FIRE; SetPlayerTeam(playerid, TEAM_FIRE); SetPlayerColor(playerid, COLOR_RED); } else if(playerskin == 152 || playerskin == 178 || playerskin == 237 || playerskin == 238) { gTeam[playerid] = TEAM_SLUTS; SetPlayerTeam(playerid, TEAM_SLUTS); SetPlayerColor(playerid, COLOR_PINK); } else if(playerskin == 102 || playerskin == 103 || playerskin == 104) { gTeam[playerid] = TEAM_BALLAS; SetPlayerTeam(playerid, TEAM_BALLAS); SetPlayerColor(playerid, COLOR_PURPLE); } else if(playerskin == 114 || playerskin == 115 || playerskin == 116 || playerskin == 108 || playerskin == 109 || playerskin == 110 || playerskin == 173 || playerskin == 174 || playerskin == 175) { gTeam[playerid] = TEAM_MEXICANS; SetPlayerTeam(playerid, TEAM_MEXICANS); SetPlayerColor(playerid, COLOR_LIGHTBLUE); } else { SendClientMessage(playerid, -1, "ERROR: You are not a member of any team, /changeteam immediately!"); } return 1; } public OnPlayerDeath(playerid, killerid, reason) { GameTextForPlayer(playerid, "~w~Wasted", 5000, 1); SendDeathMessage(killerid, playerid, reason); pInfo[killerid][Kills]++;//Will give 1 kill to killer and it will be saved inside of his/her account pInfo[playerid][Deaths]++;//Will give 1 death each time they die and it will be saved inside of his/her account return 1; } public OnVehicleSpawn(vehicleid) { return 1; } public OnVehicleDeath(vehicleid, killerid) { return 1; } public OnPlayerText(playerid, text[]) { return 1; } public OnPlayerCommandText(playerid, cmdtext[]) { return 0; } 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[]) { return 0; } public OnPlayerClickPlayer(playerid, clickedplayerid, source) { return 1; } public OnPlayerGiveDamage(playerid, damagedid, Float: amount, weaponid, bodypart) { PlayerPlaySound(playerid, 17802, 0.0, 0.0, 0.0); return 1; } public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid, bodypart) { new Float:HP; GetPlayerHealth(playerid, HP); new Float:AP; GetPlayerArmour(playerid, AP); if(!IsPlayerConnected(playerid)) return 0; if(!IsPlayerConnected(issuerid)) return 0; PlayerPlaySound(issuerid, 17802, 0.0, 0.0, 0.0); //DESERT EAGLE DAMAGE PER BONE if(issuerid != INVALID_PLAYER_ID && weaponid == 24 && bodypart == 1) SetPlayerArmour(playerid, AP-49); if(issuerid != INVALID_PLAYER_ID && weaponid == 24 && bodypart == 2) SetPlayerArmour(playerid, AP-49); if(issuerid != INVALID_PLAYER_ID && weaponid == 24 && bodypart == 3) SetPlayerHealth(playerid, HP-25); if(issuerid != INVALID_PLAYER_ID && weaponid == 24 && bodypart == 4) SetPlayerHealth(playerid, HP-25); if(issuerid != INVALID_PLAYER_ID && weaponid == 24 && bodypart == 5) SetPlayerHealth(playerid, HP-25); if(issuerid != INVALID_PLAYER_ID && weaponid == 24 && bodypart == 6) SetPlayerHealth(playerid, HP-25); if(issuerid != INVALID_PLAYER_ID && weaponid == 24 && bodypart == 7) SetPlayerHealth(playerid, HP-75); //COLT 45 DAMAGE PER BONE if(issuerid != INVALID_PLAYER_ID && weaponid == 22 && bodypart == 1) SetPlayerArmour(playerid, AP-29); if(issuerid != INVALID_PLAYER_ID && weaponid == 22 && bodypart == 2) SetPlayerArmour(playerid, AP-29); if(issuerid != INVALID_PLAYER_ID && weaponid == 22 && bodypart == 3) SetPlayerHealth(playerid, HP-15); if(issuerid != INVALID_PLAYER_ID && weaponid == 22 && bodypart == 4) SetPlayerHealth(playerid, HP-15); if(issuerid != INVALID_PLAYER_ID && weaponid == 22 && bodypart == 5) SetPlayerHealth(playerid, HP-15); if(issuerid != INVALID_PLAYER_ID && weaponid == 22 && bodypart == 6) SetPlayerHealth(playerid, HP-15); if(issuerid != INVALID_PLAYER_ID && weaponid == 22 && bodypart == 7) SetPlayerHealth(playerid, HP-55); //SILENCED PISTOL DAMAGE PER BONE if(issuerid != INVALID_PLAYER_ID && weaponid == 23 && bodypart == 1) SetPlayerArmour(playerid, AP-29); if(issuerid != INVALID_PLAYER_ID && weaponid == 23 && bodypart == 2) SetPlayerArmour(playerid, AP-29); if(issuerid != INVALID_PLAYER_ID && weaponid == 23 && bodypart == 3) SetPlayerHealth(playerid, HP-15); if(issuerid != INVALID_PLAYER_ID && weaponid == 23 && bodypart == 4) SetPlayerHealth(playerid, HP-15); if(issuerid != INVALID_PLAYER_ID && weaponid == 23 && bodypart == 5) SetPlayerHealth(playerid, HP-15); if(issuerid != INVALID_PLAYER_ID && weaponid == 23 && bodypart == 6) SetPlayerHealth(playerid, HP-15); if(issuerid != INVALID_PLAYER_ID && weaponid == 23 && bodypart == 7) SetPlayerHealth(playerid, HP-55); //SHOTGUN DAMAGE PER BONE if(issuerid != INVALID_PLAYER_ID && weaponid == 25 && bodypart == 1) SetPlayerArmour(playerid, AP-49); if(issuerid != INVALID_PLAYER_ID && weaponid == 25 && bodypart == 2) SetPlayerArmour(playerid, AP-49); if(issuerid != INVALID_PLAYER_ID && weaponid == 25 && bodypart == 3) SetPlayerHealth(playerid, HP-25); if(issuerid != INVALID_PLAYER_ID && weaponid == 25 && bodypart == 4) SetPlayerHealth(playerid, HP-25); if(issuerid != INVALID_PLAYER_ID && weaponid == 25 && bodypart == 5) SetPlayerHealth(playerid, HP-25); if(issuerid != INVALID_PLAYER_ID && weaponid == 25 && bodypart == 6) SetPlayerHealth(playerid, HP-25); if(issuerid != INVALID_PLAYER_ID && weaponid == 25 && bodypart == 7) SetPlayerHealth(playerid, HP-75); //SAWN OFF DAMAGE PER BONE if(issuerid != INVALID_PLAYER_ID && weaponid == 26 && bodypart == 1) SetPlayerArmour(playerid, AP-39); if(issuerid != INVALID_PLAYER_ID && weaponid == 26 && bodypart == 2) SetPlayerArmour(playerid, AP-39); if(issuerid != INVALID_PLAYER_ID && weaponid == 26 && bodypart == 3) SetPlayerHealth(playerid, HP-15); if(issuerid != INVALID_PLAYER_ID && weaponid == 26 && bodypart == 4) SetPlayerHealth(playerid, HP-15); if(issuerid != INVALID_PLAYER_ID && weaponid == 26 && bodypart == 5) SetPlayerHealth(playerid, HP-15); if(issuerid != INVALID_PLAYER_ID && weaponid == 26 && bodypart == 6) SetPlayerHealth(playerid, HP-15); if(issuerid != INVALID_PLAYER_ID && weaponid == 26 && bodypart == 7) SetPlayerHealth(playerid, HP-65); //COMBAT SHOTGUN DAMAGE PER BONE if(issuerid != INVALID_PLAYER_ID && weaponid == 27 && bodypart == 1) SetPlayerArmour(playerid, AP-30); if(issuerid != INVALID_PLAYER_ID && weaponid == 27 && bodypart == 2) SetPlayerArmour(playerid, AP-30); if(issuerid != INVALID_PLAYER_ID && weaponid == 27 && bodypart == 3) SetPlayerHealth(playerid, HP-15); if(issuerid != INVALID_PLAYER_ID && weaponid == 27 && bodypart == 4) SetPlayerHealth(playerid, HP-15); if(issuerid != INVALID_PLAYER_ID && weaponid == 27 && bodypart == 5) SetPlayerHealth(playerid, HP-15); if(issuerid != INVALID_PLAYER_ID && weaponid == 27 && bodypart == 6) SetPlayerHealth(playerid, HP-15); if(issuerid != INVALID_PLAYER_ID && weaponid == 27 && bodypart == 7) SetPlayerHealth(playerid, HP-49); //UZI DAMAGE PER BONE if(issuerid != INVALID_PLAYER_ID && weaponid == 28 && bodypart == 1) SetPlayerArmour(playerid, AP-20); if(issuerid != INVALID_PLAYER_ID && weaponid == 28 && bodypart == 2) SetPlayerArmour(playerid, AP-20); if(issuerid != INVALID_PLAYER_ID && weaponid == 28 && bodypart == 3) SetPlayerHealth(playerid, HP-10); if(issuerid != INVALID_PLAYER_ID && weaponid == 28 && bodypart == 4) SetPlayerHealth(playerid, HP-10); if(issuerid != INVALID_PLAYER_ID && weaponid == 28 && bodypart == 5) SetPlayerHealth(playerid, HP-10); if(issuerid != INVALID_PLAYER_ID && weaponid == 28 && bodypart == 6) SetPlayerHealth(playerid, HP-10); if(issuerid != INVALID_PLAYER_ID && weaponid == 28 && bodypart == 7) SetPlayerHealth(playerid, HP-33); //MP5 DAMAGE PER BONE if(issuerid != INVALID_PLAYER_ID && weaponid == 29 && bodypart == 1) SetPlayerArmour(playerid, AP-20); if(issuerid != INVALID_PLAYER_ID && weaponid == 29 && bodypart == 2) SetPlayerArmour(playerid, AP-20); if(issuerid != INVALID_PLAYER_ID && weaponid == 29 && bodypart == 3) SetPlayerHealth(playerid, HP-10); if(issuerid != INVALID_PLAYER_ID && weaponid == 29 && bodypart == 4) SetPlayerHealth(playerid, HP-10); if(issuerid != INVALID_PLAYER_ID && weaponid == 29 && bodypart == 5) SetPlayerHealth(playerid, HP-10); if(issuerid != INVALID_PLAYER_ID && weaponid == 29 && bodypart == 6) SetPlayerHealth(playerid, HP-10); if(issuerid != INVALID_PLAYER_ID && weaponid == 29 && bodypart == 7) SetPlayerHealth(playerid, HP-33); //AK47 DAMAGE PER BONE if(issuerid != INVALID_PLAYER_ID && weaponid == 30 && bodypart == 1) SetPlayerArmour(playerid, AP-33); if(issuerid != INVALID_PLAYER_ID && weaponid == 30 && bodypart == 2) SetPlayerArmour(playerid, AP-33); if(issuerid != INVALID_PLAYER_ID && weaponid == 30 && bodypart == 3) SetPlayerHealth(playerid, HP-20); if(issuerid != INVALID_PLAYER_ID && weaponid == 30 && bodypart == 4) SetPlayerHealth(playerid, HP-20); if(issuerid != INVALID_PLAYER_ID && weaponid == 30 && bodypart == 5) SetPlayerHealth(playerid, HP-20); if(issuerid != INVALID_PLAYER_ID && weaponid == 30 && bodypart == 6) SetPlayerHealth(playerid, HP-20); if(issuerid != INVALID_PLAYER_ID && weaponid == 30 && bodypart == 7) SetPlayerHealth(playerid, HP-49); //M4 DAMAGE PER BONE if(issuerid != INVALID_PLAYER_ID && weaponid == 31 && bodypart == 1) SetPlayerArmour(playerid, AP-33); if(issuerid != INVALID_PLAYER_ID && weaponid == 31 && bodypart == 2) SetPlayerArmour(playerid, AP-33); if(issuerid != INVALID_PLAYER_ID && weaponid == 31 && bodypart == 3) SetPlayerHealth(playerid, HP-20); if(issuerid != INVALID_PLAYER_ID && weaponid == 31 && bodypart == 4) SetPlayerHealth(playerid, HP-20); if(issuerid != INVALID_PLAYER_ID && weaponid == 31 && bodypart == 5) SetPlayerHealth(playerid, HP-20); if(issuerid != INVALID_PLAYER_ID && weaponid == 31 && bodypart == 6) SetPlayerHealth(playerid, HP-20); if(issuerid != INVALID_PLAYER_ID && weaponid == 31 && bodypart == 7) SetPlayerHealth(playerid, HP-49); //TEC-9 DAMAGE PER BONE if(issuerid != INVALID_PLAYER_ID && weaponid == 32 && bodypart == 1) SetPlayerArmour(playerid, AP-20); if(issuerid != INVALID_PLAYER_ID && weaponid == 32 && bodypart == 2) SetPlayerArmour(playerid, AP-20); if(issuerid != INVALID_PLAYER_ID && weaponid == 32 && bodypart == 3) SetPlayerHealth(playerid, HP-10); if(issuerid != INVALID_PLAYER_ID && weaponid == 32 && bodypart == 4) SetPlayerHealth(playerid, HP-10); if(issuerid != INVALID_PLAYER_ID && weaponid == 32 && bodypart == 5) SetPlayerHealth(playerid, HP-10); if(issuerid != INVALID_PLAYER_ID && weaponid == 32 && bodypart == 6) SetPlayerHealth(playerid, HP-10); if(issuerid != INVALID_PLAYER_ID && weaponid == 32 && bodypart == 7) SetPlayerHealth(playerid, HP-33); //RIFLE DAMAGE PER BONE if(issuerid != INVALID_PLAYER_ID && weaponid == 33 && bodypart == 1) SetPlayerArmour(playerid, AP-49); if(issuerid != INVALID_PLAYER_ID && weaponid == 33 && bodypart == 2) SetPlayerArmour(playerid, AP-49); if(issuerid != INVALID_PLAYER_ID && weaponid == 33 && bodypart == 3) SetPlayerHealth(playerid, HP-49); if(issuerid != INVALID_PLAYER_ID && weaponid == 33 && bodypart == 4) SetPlayerHealth(playerid, HP-49); if(issuerid != INVALID_PLAYER_ID && weaponid == 33 && bodypart == 5) SetPlayerHealth(playerid, HP-49); if(issuerid != INVALID_PLAYER_ID && weaponid == 33 && bodypart == 6) SetPlayerHealth(playerid, HP-49); if(issuerid != INVALID_PLAYER_ID && weaponid == 33 && bodypart == 7) SetPlayerHealth(playerid, 0); //SNIPER RIFLE DAMAGE PER BONE if(issuerid != INVALID_PLAYER_ID && weaponid == 34 && bodypart == 1) SetPlayerArmour(playerid, AP-49); if(issuerid != INVALID_PLAYER_ID && weaponid == 34 && bodypart == 2) SetPlayerArmour(playerid, AP-49); if(issuerid != INVALID_PLAYER_ID && weaponid == 34 && bodypart == 3) SetPlayerHealth(playerid, HP-49); if(issuerid != INVALID_PLAYER_ID && weaponid == 34 && bodypart == 4) SetPlayerHealth(playerid, HP-49); if(issuerid != INVALID_PLAYER_ID && weaponid == 34 && bodypart == 5) SetPlayerHealth(playerid, HP-49); if(issuerid != INVALID_PLAYER_ID && weaponid == 34 && bodypart == 6) SetPlayerHealth(playerid, HP-49); if(issuerid != INVALID_PLAYER_ID && weaponid == 34 && bodypart == 7) SetPlayerHealth(playerid, 0); //MINIGUN DAMAGE PER BONE (Troll hackers) if(issuerid != INVALID_PLAYER_ID && weaponid == 38) SetPlayerArmour(playerid, 10000); if(issuerid != INVALID_PLAYER_ID && weaponid == 38) SetPlayerHealth(playerid, 10000); //RPG DAMAGE PER BONE (Troll Hackers) if(issuerid != INVALID_PLAYER_ID && weaponid == 35 && bodypart == 1) SetPlayerArmour(playerid, AP-1); if(issuerid != INVALID_PLAYER_ID && weaponid == 35 && bodypart == 2) SetPlayerArmour(playerid, AP-1); if(issuerid != INVALID_PLAYER_ID && weaponid == 35 && bodypart == 3) SetPlayerHealth(playerid, HP-1); if(issuerid != INVALID_PLAYER_ID && weaponid == 35 && bodypart == 4) SetPlayerHealth(playerid, HP-1); if(issuerid != INVALID_PLAYER_ID && weaponid == 35 && bodypart == 5) SetPlayerHealth(playerid, HP-1); if(issuerid != INVALID_PLAYER_ID && weaponid == 35 && bodypart == 6) SetPlayerHealth(playerid, HP-1); if(issuerid != INVALID_PLAYER_ID && weaponid == 35 && bodypart == 7) SetPlayerHealth(playerid, HP-1); //HS ROCKET DAMAGE PER BONE (Troll Hackers) if(issuerid != INVALID_PLAYER_ID && weaponid == 36 && bodypart == 1) SetPlayerArmour(playerid, AP-1); if(issuerid != INVALID_PLAYER_ID && weaponid == 36 && bodypart == 2) SetPlayerArmour(playerid, AP-1); if(issuerid != INVALID_PLAYER_ID && weaponid == 36 && bodypart == 3) SetPlayerHealth(playerid, HP-1); if(issuerid != INVALID_PLAYER_ID && weaponid == 36 && bodypart == 4) SetPlayerHealth(playerid, HP-1); if(issuerid != INVALID_PLAYER_ID && weaponid == 36 && bodypart == 5) SetPlayerHealth(playerid, HP-1); if(issuerid != INVALID_PLAYER_ID && weaponid == 36 && bodypart == 6) SetPlayerHealth(playerid, HP-1); if(issuerid != INVALID_PLAYER_ID && weaponid == 36 && bodypart == 7) SetPlayerHealth(playerid, HP-1); //KNIFE DAMAGE PER BONE if(issuerid != INVALID_PLAYER_ID && weaponid == 4 && bodypart == 1) SetPlayerArmour(playerid, AP-25); if(issuerid != INVALID_PLAYER_ID && weaponid == 4 && bodypart == 2) SetPlayerArmour(playerid, AP-25); if(issuerid != INVALID_PLAYER_ID && weaponid == 4 && bodypart == 3) SetPlayerHealth(playerid, HP-25); if(issuerid != INVALID_PLAYER_ID && weaponid == 4 && bodypart == 4) SetPlayerHealth(playerid, HP-25); if(issuerid != INVALID_PLAYER_ID && weaponid == 4 && bodypart == 5) SetPlayerHealth(playerid, HP-25); if(issuerid != INVALID_PLAYER_ID && weaponid == 4 && bodypart == 6) SetPlayerHealth(playerid, HP-25); if(issuerid != INVALID_PLAYER_ID && weaponid == 4 && bodypart == 7) SetPlayerHealth(playerid, HP-25); return 1; } CMD:heal(playerid,params[]) { SetPlayerHealth(playerid, 100); GameTextForPlayer(playerid, "~r~You have been healed.", 5000, 1); SendClientMessage(playerid, COLOR_LIGHTRED, "You have been healed."); return 1; } CMD:health(playerid,params[]) { return cmd_heal(playerid, params); } CMD:armor(playerid,params[]) { SetPlayerArmour(playerid, 100); GameTextForPlayer(playerid, "~b~You were given body armor.", 5000, 1); SendClientMessage(playerid, COLOR_LIGHTBLUE, "You were given body armor."); return 1; } CMD:armour(playerid,params[]) { SetPlayerArmour(playerid, 100); GameTextForPlayer(playerid, "~b~You were given body armour.", 5000, 1); SendClientMessage(playerid, COLOR_LIGHTBLUE, "You were given body armour."); return 1; } CMD:help (playerid,params[]) { SendClientMessage(playerid, COLOR_LIGHTBLUE, "|__________________________SERVERNAME COMMAND HELP__________________________|"); SendClientMessage(playerid, COLOR_LIGHTBLUE, "| /heal(health] | /armor(armour) | /changeteam |"); SendClientMessage(playerid, COLOR_LIGHTBLUE, "[________________________________________________________________________]"); return 1; } CMD:changeteam(playerid, params[]) { ForceClassSelection(playerid); TogglePlayerSpectating(playerid, true); TogglePlayerSpectating(playerid, false); return 1; } //Now we will use our own function that we have created above public loadaccount_user(playerid, name[], value[]) { INI_String("Password", pInfo[playerid][Pass],129); //we will use INI_String to load user's password. //("Password",.. will load user's password inside of user's path. 'pInfo[playerid][Pass]',...We have defined our user's variable above called, pInfo. Now it's time to use it here to load user's password. '129',... 129 is a length of a hashed user's password. Whirlpool will hash 128 characters + NULL*/ INI_Int("AdminLevel",pInfo[playerid][Adminlevel]);//We will use INI_Int to load user's admin level. INI_Int stands for INI_Integer. This load an admin level. */ INI_Int("VIPLevel",pInfo[playerid][VIPlevel]);//As explained above INI_Int("Money",pInfo[playerid][Money]); //As explained above INI_Int("Scores",pInfo[playerid][Scores]);//As explained above INI_Int("Kills",pInfo[playerid][Kills]);//As explained above INI_Int("Deaths",pInfo[playerid][Deaths]);//As explained above return 1; } //OnPlayerConnect will be called when players is connected to your server. So now we will need to show a register or login dialog public OnPlayerConnect(playerid) { new name[MAX_PLAYER_NAME]; //Making a new variable called 'name'. name[MAX_PLAYER_NAME] is created so we can use it to get player's name. GetPlayerName(playerid,name,sizeof(name)); //Get player's name if(fexist(Path(playerid))) //Check if the connected user is registered or not. fexist stands for file exist. So if file exist in the files(Path(playerid)), { INI_ParseFile(Path(playerid),"loadaccount_%s", .bExtra = true, .extra = playerid); //Will load user's data using INI_Parsefile. ShowPlayerDialog(playerid,dlogin,DIALOG_STYLE_INPUT,"Login","Welcome back. This account is registered. \nInsert your password to login to your account","Login","Quit");//A dialog with input style will appear so you can insert your password to login. } else //If the connected user is not registered, //then we will 'force' him to register :) { ShowPlayerDialog(playerid,dregister,DIALOG_STYLE_INPUT,"Register","Welcome! This account is not registered.\nEnter your own password to create a new account.","Register","Quit"); return 1; } return 1; }