Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // DogFight World - Fly Like a Fighter
- ////credits
- /*SAMP Team - For SA:MP.
- *Y_Less - For Many includes in Server.
- *Zeex - For zcmd.
- *newbienoob - Login/Register system.
- *Avi Raj - for Creating this GM.*/
- #include <a_samp>
- #include <YSI\y_ini>
- #include <tColors>
- #include <zcmd>
- #include <sscanf2>
- #define register 1
- #define login 2
- #define dogfights 3
- #define acmds 4
- #define cmds 5
- #define rules 6
- #define UserPath "Users/%s.ini"
- native WP_Hash(buffer[],len,const str[]);
- enum PlayerInfo
- {
- Pass[129],
- Adminlevel,
- VIPlevel,
- Money,
- Scores,
- Kills,
- Deaths,
- DogfightWon
- }
- new pInfo[MAX_PLAYERS][PlayerInfo];
- stock Path(playerid)
- {
- new str[128],name[MAX_PLAYER_NAME];
- GetPlayerName(playerid,name,sizeof(name));
- format(str,sizeof(str),UserPath,name);
- return str;
- }
- forward loadaccount_user(playerid, name[], value[]);
- public loadaccount_user(playerid, name[], value[])
- {
- INI_String("Password", pInfo[playerid][Pass],129);
- INI_Int("AdminLevel",pInfo[playerid][Adminlevel]);
- INI_Int("VIPLevel",pInfo[playerid][VIPlevel]);
- INI_Int("Money",pInfo[playerid][Money]);
- INI_Int("Scores",pInfo[playerid][Scores]);
- INI_Int("Kills",pInfo[playerid][Kills]);
- INI_Int("Deaths",pInfo[playerid][Deaths]);
- INI_Int("DogfightWon",pInfo[playerid][DogfightWon]);
- return 1;
- }
- new InRustler[MAX_PLAYERS];
- new InHydra[MAX_PLAYERS];
- new InHunter[MAX_PLAYERS];
- new InSeaSparrow[MAX_PLAYERS];
- new Float:Planespawns[][] =
- {
- {-1636.8337,-160.9740,14.8600,315.8028},
- {-1645.6366,-152.4947,14.8544,314.1924},
- {-1654.3047,-143.8319,14.8515,314.5324},
- {-1067.6602,407.5844,14.9496,135.3408},
- {-1075.7490,416.1673,14.9512,134.6229},
- {-1084.5680,424.9647,14.9465,135.2840}
- };
- main()
- {
- print("\n----------------------------------");
- print("DogFight World - Fly Like a Fighter");
- print("----------------------------------\n");
- }
- public OnGameModeInit()
- {
- SetGameModeText("DogFight World");
- AddPlayerClass(61, -1764.305786, -579.576904, 16.335937, 89.666854, 0, 0, 0, 0, 0, 0);
- AddPlayerClass(101, -1764.305786, -579.576904, 16.335937, 89.666854, 0, 0, 0, 0, 0, 0);
- return 1;
- }
- public OnGameModeExit()
- {
- return 1;
- }
- public OnPlayerRequestClass(playerid, classid)
- {
- SetPlayerPos(playerid, -1764.305786, -579.576904, 16.335937);
- SetPlayerFacingAngle(playerid, 89.666854);
- SetPlayerCameraLookAt(playerid, -1764.305786, -579.576904, 16.335937);
- SetPlayerCameraPos(playerid, -1764.305786 + (10 * floatsin(-89.666854, degrees)), -579.576904 + (10 * floatcos(-89.666854, degrees)), 16.335937);
- GameTextForPlayer(playerid,"~w~Select Your ~y~Skin", 3000, 6);
- return 1;
- }
- public OnPlayerConnect(playerid)
- {
- new name[MAX_PLAYER_NAME];
- GetPlayerName(playerid,name,sizeof(name));
- if(fexist(Path(playerid)))
- {
- INI_ParseFile(Path(playerid),"loadaccount_%s", .bExtra = true, .extra = playerid);
- ShowPlayerDialog(playerid,login,DIALOG_STYLE_INPUT,"DogFight World - 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
- {
- ShowPlayerDialog(playerid,register,DIALOG_STYLE_INPUT,"DogFight World - Register","Welcome! This account is not registered.\nEnter your own password to create a new account.","Register","Quit");
- return 1;
- }
- return 1;
- }
- public OnPlayerDisconnect(playerid, reason)
- {
- new INI:file = INI_Open(Path(playerid));
- INI_SetTag(file,"Player's Data");
- INI_WriteInt(file,"AdminLevel",pInfo[playerid][Adminlevel]);
- INI_WriteInt(file,"VIPLevel",pInfo[playerid][VIPlevel]);
- INI_WriteInt(file,"Money",GetPlayerMoney(playerid));
- INI_WriteInt(file,"Scores",GetPlayerScore(playerid));
- INI_WriteInt(file,"Kills",pInfo[playerid][Kills]);
- INI_WriteInt(file,"Deaths",pInfo[playerid][Deaths]);
- INI_WriteInt(file,"DogfightWon",pInfo[playerid][DogfightWon]);
- INI_Close(file);
- return 1;
- }
- public OnPlayerSpawn(playerid)
- {
- GameTextForPlayer(playerid,"~w~Select Your ~y~Plane", 3000, 6);
- ShowPlayerDialog(playerid, dogfights, DIALOG_STYLE_LIST, "Dogfight World - Select Your DogFight Plane.", "Rustler\nHydra\nHunter\nSea-Sparrow", "Select", "");
- return 1;
- }
- public OnPlayerDeath(playerid, killerid, reason)
- {
- pInfo[playerid][Deaths]++;
- SendClientMessage(killerid, COLOR_CYAN,"Boom! Boom!. You are DEAD!");
- GameTextForPlayer(playerid,"~r~DEAD~", 3000, 6);
- InRustler[playerid] = 0;
- InHydra[playerid] = 0;
- InHunter[playerid] = 0;
- InSeaSparrow[playerid] = 0;
- return 1;
- }
- public OnVehicleSpawn(vehicleid)
- {
- return 1;
- }
- public OnVehicleDeath(vehicleid, killerid)
- {
- pInfo[killerid][Kills]++;
- pInfo[killerid][DogfightWon]++;
- SetPlayerScore(killerid,(GetPlayerScore(killerid))+ 5);
- GivePlayerMoney(killerid, 500);
- SendClientMessage(killerid, COLOR_CYAN,"Boom! You Owned Him!.");
- GameTextForPlayer(killerid,"~b~OWNED!", 3000, 6);
- return 1;
- }
- public OnPlayerText(playerid, text[])
- {
- return 1;
- }
- public OnPlayerCommandText(playerid, cmdtext[])
- {
- if (strcmp("/mycommand", cmdtext, true, 10) == 0)
- {
- // Do something here
- return 1;
- }
- return 0;
- }
- public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
- {
- new Float:vx, Float:vy, Float:vz, Float:vHealth, string[10];
- GetVehicleHealth(vehicleid, vHealth);
- new Text3D:V3D = Create3DTextLabel(string,COLOR_YELLOW,vx,vy,vz, 50, 0,0);
- Attach3DTextLabelToVehicle(V3D,vehicleid,vx, vy, vz+1.5);
- format(string, sizeof(string), "Heatlh : %.0f", vHealth);
- return 1;
- }
- public OnPlayerExitVehicle(playerid, vehicleid)
- {
- if(InRustler[playerid] == 1) return SendClientMessage(playerid,COLOR_RED,"You Cannot Leave the Plane when you are in Dogfight");
- if(InHydra[playerid] == 1) return SendClientMessage(playerid,COLOR_RED,"You Cannot Leave the Plane when you are in Dogfight");
- if(InHunter[playerid] == 1) return SendClientMessage(playerid,COLOR_RED,"You Cannot Leave the Plane when you are in Dogfight");
- if(InSeaSparrow[playerid] == 1) return SendClientMessage(playerid,COLOR_RED,"You Cannot Leave the Plane when you are in Dogfight");
- PutPlayerInVehicle(playerid, vehicleid, 0);
- 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[])
- {
- if(dialogid == register)
- {
- if(!response) return Kick(playerid);
- if(response)
- {
- if(!strlen(inputtext))
- {
- ShowPlayerDialog(playerid,register,DIALOG_STYLE_INPUT,"DogFight World - Register","Welcome! This account is not registered.\nEnter your own password to create a new account.","Register","Quit");
- return 1;
- }
- new hashpass[129];
- WP_Hash(hashpass,sizeof(hashpass),inputtext);
- new INI:file = INI_Open(Path(playerid));
- INI_SetTag(file,"Player's Data");
- INI_WriteString(file,"Password",hashpass);
- INI_WriteInt(file,"AdminLevel",0);
- INI_WriteInt(file,"VIPLevel",0);
- INI_WriteInt(file,"Money",0);
- INI_WriteInt(file,"Scores",0);
- INI_WriteInt(file,"Kills",0);
- INI_WriteInt(file,"Deaths",0);
- INI_WriteInt(file,"DogfightWon",0);
- INI_Close(file);
- SendClientMessage(playerid,COLOR_GREEN,"You have been successfully registered");
- return 1;
- }
- }
- if(dialogid == login)
- {
- if(!response) return Kick(playerid);
- if(response)
- {
- new hashpass[129];
- WP_Hash(hashpass,sizeof(hashpass),inputtext);
- if(!strcmp(hashpass,pInfo[playerid][Pass]))
- {
- INI_ParseFile(Path(playerid),"loadaccount_%s",.bExtra = true, .extra = playerid);
- SetPlayerScore(playerid,pInfo[playerid][Scores]);
- GivePlayerMoney(playerid,pInfo[playerid][Money]);
- SendClientMessage(playerid,COLOR_GREEN,"Welcome back! You have successfully logged in");
- }
- else
- {
- ShowPlayerDialog(playerid,login,DIALOG_STYLE_INPUT,"DogFight World - Login","Welcome back. This account is registered. \nInsert your password to login to your account.\nIncorrect password!","Login","Quit");
- return 1;
- }
- }
- }
- if(dialogid == dogfights)
- {
- if(response)
- {
- if(listitem == 0)
- {
- SetPlayerVirtualWorld(playerid, 0);
- new rand = random(sizeof(Planespawns));
- new veh = CreateVehicle(476,Planespawns[rand][0],Planespawns[rand][1],Planespawns[rand][2],Planespawns[rand][3],-1,-1,-1);
- PutPlayerInVehicle(playerid,veh,0);
- InRustler[playerid] = 1;
- }
- if(listitem == 1)
- {
- SetPlayerVirtualWorld(playerid, 0);
- new rand = random(sizeof(Planespawns));
- new veh = CreateVehicle(520,Planespawns[rand][0],Planespawns[rand][1],Planespawns[rand][2],Planespawns[rand][3],-1,-1,-1);
- PutPlayerInVehicle(playerid,veh,0);
- InHydra[playerid] = 1;
- }
- if(listitem == 2)
- {
- SetPlayerVirtualWorld(playerid, 0);
- new rand = random(sizeof(Planespawns));
- new veh = CreateVehicle(425,Planespawns[rand][0],Planespawns[rand][1],Planespawns[rand][2],Planespawns[rand][3],-1,-1,-1);
- PutPlayerInVehicle(playerid,veh,0);
- InHunter[playerid] = 1;
- }
- if(listitem == 3)
- {
- SetPlayerVirtualWorld(playerid, 0);
- new rand = random(sizeof(Planespawns));
- new veh = CreateVehicle(447,Planespawns[rand][0],Planespawns[rand][1],Planespawns[rand][2],Planespawns[rand][3],-1,-1,-1);
- PutPlayerInVehicle(playerid,veh,0);
- InSeaSparrow[playerid] = 1;
- }
- }
- return 1;
- }
- return 1;
- }
- public OnPlayerClickPlayer(playerid, clickedplayerid, source)
- {
- return 1;
- }
- CMD:rules(playerid, params[])
- {
- ShowPlayerDialog(playerid, rules, DIALOG_STYLE_MSGBOX, "Server Rules", "- No Cheating\n- No Spamming\n- Respect Admins\n-No Death Matching\n-No use of Any Kind of Hacks\n\nDo you agree to these rules?", "Yes", "No");
- return 1;
- }
- CMD:changeplane(playerid, params[])
- {
- ForceClassSelection(playerid);
- SetPlayerHealth(playerid, 0.00);
- SendClientMessage(playerid, COLOR_RED, "You have Forced yourself to Plane Selection Menu.");
- return 1;
- }
- CMD:report(playerid, params[])
- {
- new string[128];
- if(!isnull(params))
- {
- SendClientMessage(playerid, COLOR_YELLOW, "Your report was sent to the Admin Teams.");
- format(string, sizeof(string), "Your Report : %s", params); // Proof to the reporter, that the command worked.
- SendClientMessage(playerid, COLOR_YELLOW, string);
- for(new i=0; i<MAX_PLAYERS; i++)
- {
- if(pInfo[playerid][Adminlevel] >= 1)
- {
- new name[MAX_PLAYER_NAME];
- GetPlayerName(playerid,name,MAX_PLAYER_NAME);
- format(string, sizeof(string), "Report from %s[%d]: %s", name, playerid, params);
- SendClientMessage(i, COLOR_ORANGE, string); // Send's the format to the online Rcon'ly Logged in Admins.
- }
- }
- }
- else
- {
- SendClientMessage(playerid, COLOR_RED, "USAGE: /Report [Text]"); // Show's the player the Usage.
- }
- return 1;
- }
- CMD:admins(playerid,params[])
- {
- new Count, string[128],n[MAX_PLAYER_NAME];
- SendClientMessage(playerid, COLOR_RED, "__________|Admins|__________");
- for(new i=0; i < GetMaxPlayers(); i++) if(IsPlayerConnected(i) && pInfo[i][Adminlevel] > 0) {
- GetPlayerName(i,n,sizeof(n));
- switch(pInfo[i][Adminlevel]) {
- case 1: format(string,sizeof(string),"Global Moderator (Level 1) : %s(%d)",n, playerid);
- case 2: format(string,sizeof(string),"Moderator (Level 2) : %s(%d)",n, playerid);
- case 3: format(string,sizeof(string),"Administrator (Level 3) : %s(%d)",n, playerid);
- case 4: format(string,sizeof(string),"Server Owner (Level 4) : %s(%d)",n, playerid);
- }
- SendClientMessage(playerid,COLOR_RED,string);
- Count++;
- }
- if(Count == 0) SendClientMessage(playerid, COLOR_RED, "No Admins Online");
- SendClientMessage(playerid, COLOR_RED, "____________________________");
- return 1;
- }
- CMD:pm(playerid, params[])
- {
- new str[256], str2[256], id, Name1[MAX_PLAYER_NAME], Name2[MAX_PLAYER_NAME];
- if(sscanf(params, "us", id, str2))
- {
- SendClientMessage(playerid, 0xFF0000FF, "Usage: /pm <id> <message>");
- return 1;
- }
- if(!IsPlayerConnected(id)) return SendClientMessage(playerid, 0xFF0000FF, "ERROR: Player not connected");
- if(playerid == id) return SendClientMessage(playerid, 0xFF0000FF, "ERROR: You cannot pm yourself!");
- {
- GetPlayerName(playerid, Name1, sizeof(Name1));
- GetPlayerName(id, Name2, sizeof(Name2));
- format(str, sizeof(str), "PM To %s(ID %d): %s", Name2, id, str2);
- SendClientMessage(playerid, COLOR_LIGHTGREEN, str);
- format(str, sizeof(str), "PM From %s(ID %d): %s", Name1, playerid, str2);
- SendClientMessage(id, COLOR_LIGHTGREEN, str);
- }
- return 1;
- }
- CMD:vips(playerid,params[])
- {
- new Count, string[128],n[MAX_PLAYER_NAME];
- SendClientMessage(playerid, COLOR_ORANGE, "__________|VIPS|__________");
- for(new i=0; i < GetMaxPlayers(); i++) if(IsPlayerConnected(i) && pInfo[i][VIPlevel] > 0) {
- GetPlayerName(i,n,sizeof(n));
- switch(pInfo[i][VIPlevel]) {
- case 1: format(string,sizeof(string),"VIP : %s(%d)",n, playerid);
- }
- SendClientMessage(playerid,COLOR_ORANGE,string);
- Count++;
- }
- if(Count == 0) SendClientMessage(playerid, COLOR_ORANGE, "No VIPS Online");
- SendClientMessage(playerid, COLOR_ORANGE, "____________________________");
- return 1;
- }
- CMD:cmds(playerid, params[])
- {
- ShowPlayerDialog(playerid, cmds, DIALOG_STYLE_MSGBOX, "Server Commands","/rules\n/changeplane\n/report\n/admins\n/vips\n/pm","Close","");
- return 1;
- }
- /////////////////////////////////////////////////////////////////////////////// Admin cmds
- CMD:setadmin(playerid, params[])
- {
- new levels,Nam[MAX_PLAYER_NAME],pname[MAX_PLAYER_NAME],str[128],ID;
- if(!IsPlayerAdmin(playerid))return 0; //This command only works for rcon
- if(sscanf(params,"ui",ID,levels)) return SendClientMessage(playerid,COLOR_RED, "USAGE: /setadmin [ID] [Level 1-4]");//it will show this if you dont use the format properly
- if(levels > 4) return SendClientMessage(playerid,COLOR_RED,"LEVELS AVAILABLE 1-4!");//Available levels
- if(!IsPlayerConnected(ID))return SendClientMessage(playerid,COLOR_RED,"That user is not connected.");//Detect if the id/partofname is connected
- if(pInfo[ID][Adminlevel] == levels) return SendClientMessage(playerid,0xFF0000FF, "ERROR: That person is already this admin level!");//Detect if the guy is already the level you setted
- GetPlayerName(playerid,Nam, MAX_PLAYER_NAME);//define the playerid name
- GetPlayerName(ID,pname,MAX_PLAYER_NAME);//define the other person name
- if(levels == 0)
- {
- format(str, sizeof(str),"%s has your Admin level to %d on the server. *cry *cry",Nam,levels);
- SendClientMessage(ID,0xFF9900AA,str);
- format(str, sizeof(str),"You had set %s Admin level to %d!",pname,levels);
- SendClientMessage(playerid,0xFF9900AA,str);
- pInfo[ID][Adminlevel] = levels;//this sets the player level
- return 1;
- }
- format(str, sizeof(str),"%s has your Admin level to %d on the server.",Nam,levels);
- SendClientMessage(ID,0xFF9900AA,str);
- format(str, sizeof(str),"You had set %s Admin level to %d!",pname,levels);
- SendClientMessage(playerid,0xFF9900AA,str);
- pInfo[ID][Adminlevel] = levels;
- return 1;
- }
- CMD:setvip(playerid, params[])
- {
- new levels,Nam[MAX_PLAYER_NAME],pname[MAX_PLAYER_NAME],str[128],ID;
- if(!IsPlayerAdmin(playerid))return 0; //This command only works for rcon
- if(sscanf(params,"ui",ID,levels)) return SendClientMessage(playerid,COLOR_RED, "USAGE: /setvip [ID] [Level]");//it will show this if you dont use the format properly
- if(levels > 1) return SendClientMessage(playerid,COLOR_RED,"LEVELS AVAILABLE 1!");//Available levels
- if(!IsPlayerConnected(ID))return SendClientMessage(playerid,COLOR_RED,"That user is not connected.");//Detect if the id/partofname is connected
- if(pInfo[ID][VIPlevel] == levels) return SendClientMessage(playerid,0xFF0000FF, "ERROR: That person is already this admin level!");//Detect if the guy is already the level you setted
- GetPlayerName(playerid,Nam, MAX_PLAYER_NAME);//define the playerid name
- GetPlayerName(ID,pname,MAX_PLAYER_NAME);//define the other person name
- if(levels == 0)
- {
- format(str, sizeof(str),"%s has your VIP level to %d on the server. *cry *cry",Nam,levels);
- SendClientMessage(ID,0xFF9900AA,str);
- format(str, sizeof(str),"You had set %s VIP level to %d!",pname,levels);
- SendClientMessage(playerid,0xFF9900AA,str);
- pInfo[ID][VIPlevel] = levels;//this sets the player level
- return 1;
- }
- format(str, sizeof(str),"%s has your VIP level to %d on the server.",Nam,levels);
- SendClientMessage(ID,0xFF9900AA,str);
- format(str, sizeof(str),"You had set %s VIP level to %d!",pname,levels);
- SendClientMessage(playerid,0xFF9900AA,str);
- pInfo[ID][VIPlevel] = levels;
- return 1;
- }
- CMD:kick(playerid, params[])
- {
- new id, reason[128];
- if(pInfo[playerid][Adminlevel] < 1)return SendClientMessage(playerid, COLOR_WHITE, "You need to be a admin to use that command!");
- else if(sscanf(params, "us", id, reason))SendClientMessage(playerid, COLOR_WHITE, "Usage: /kick [id/name][reason]");
- else if(id==playerid)SendClientMessage(playerid,COLOR_WHITE,"Error: You can not kick yourself!");
- else if(pInfo[playerid][Adminlevel] >= 1)SendClientMessage(playerid,COLOR_WHITE,"Error: You can not kick another admin!");
- else if (id==INVALID_PLAYER_ID)SendClientMessage(playerid,COLOR_WHITE,"Error: Player is not connected!");
- else {
- new Name[MAX_PLAYER_NAME], KickMessage[128];
- new Name2[MAX_PLAYER_NAME];
- GetPlayerName(playerid, Name, sizeof(Name));
- GetPlayerName(id, Name2, sizeof(Name2));
- format(KickMessage, sizeof(KickMessage), "%s(%d) has kicked player %s(%d). Reason: %s", Name, playerid, Name2, id);
- SendClientMessageToAll(COLOR_WHITE, KickMessage);
- Kick(id);
- }
- return 1;
- }
- CMD:ban(playerid, params[])
- {
- new id, reason[128];
- if(pInfo[playerid][Adminlevel] < 1)return SendClientMessage(playerid, COLOR_WHITE, "You need to be a admin to use that command!");
- else if(sscanf(params, "us", id, reason))SendClientMessage(playerid, COLOR_WHITE, "Usage: /ban [id/name][reason]");
- else if(id==playerid)SendClientMessage(playerid,COLOR_WHITE,"Error: You can not Ban yourself!");
- else if(pInfo[playerid][Adminlevel] >= 1)SendClientMessage(playerid,COLOR_WHITE,"Error: You can not ban another admin!");
- else if (id==INVALID_PLAYER_ID)SendClientMessage(playerid,COLOR_WHITE,"Error: Player is not connected!");
- else {
- new Name[MAX_PLAYER_NAME], KickMessage[128];
- new Name2[MAX_PLAYER_NAME];
- GetPlayerName(playerid, Name, sizeof(Name));
- GetPlayerName(id, Name2, sizeof(Name2));
- format(KickMessage, sizeof(KickMessage), "%s(%d) has Banned player %s(%d). Reason: %s", Name, playerid, Name2, id);
- SendClientMessageToAll(COLOR_WHITE, KickMessage);
- Kick(id);
- }
- return 1;
- }
- CMD:askin(playerid, params[])
- {
- if(pInfo[playerid][Adminlevel] < 1)return SendClientMessage(playerid, COLOR_WHITE, "You need to be a admin to use that command!");
- {
- SetPlayerSkin(playerid, 219);
- }
- return 1;
- }
- CMD:acmds(playerid, params[])
- {
- if(pInfo[playerid][Adminlevel] < 1)return SendClientMessage(playerid, COLOR_WHITE, "You need to be a admin to use that command!");
- {
- ShowPlayerDialog(playerid, acmds, DIALOG_STYLE_MSGBOX, "Admin Commands","/kick\n/ban\n/setadmin\n/setvip\n/askin\n/spec\n/specoff\n/clearchat\n/goto\n/gethere","Close","");
- }
- return 1;
- }
- CMD:ahelp(playerid, params[])
- {
- if(pInfo[playerid][Adminlevel] < 1)return SendClientMessage(playerid, COLOR_WHITE, "You need to be a admin to use that command!");
- {
- ShowPlayerDialog(playerid, acmds, DIALOG_STYLE_MSGBOX, "Admin Commands","/kick\n/ban\n/setadmin\n/setvip\n/askin\n/spec\n/specoff\n/clearchat\n/goto\n/gethere","Close","");
- }
- return 1;
- }
- CMD:clearchat(playerid,params[])
- {
- if(pInfo[playerid][Adminlevel] < 1 ) return SendClientMessage(playerid, COLOR_RED, "You must be Admin to use this command!" );
- {
- for( new i = 0; i <= 100; i ++ ) SendClientMessageToAll( COLOR_WHITE, "" );
- }
- return 1;
- }
- CMD:goto(playerid, params[])
- {
- new ID;//creates a new something idk what we call it :P but it is defined later on or used in something this 1 is used in next line
- if(sscanf(params, "u", ID)) SendClientMessage(playerid, 0xFF0000FF, "USAGE: /goto [id]");//checks if you have written something after /goto if no it sends error
- else if(!IsPlayerConnected(ID) || ID == playerid) return SendClientMessage(playerid, 0xFF0000FF, "This player is offline or it is yourself");//checks if the player you are teleporting to is connected or if it is yourself if yes then comes an error
- else if(pInfo[playerid][Adminlevel] < 1 ) return SendClientMessage(playerid, COLOR_RED, "You must be Admin to use this command!" );
- else//ELSE what will happen if no errors
- {
- new Float:x, Float:y, Float:z;//creates new floats
- GetPlayerPos(ID, x, y, z);//gets the player id(which we have entered after /goto position and like saves them into x,y,z defined above as floats
- SetPlayerPos(playerid, x+1, y+1, z);//sets the player position the id of that player +1 in x +1 in y and z remains same as it defines height
- }
- return 1;
- }
- CMD:gethere(playerid,params[])
- {
- new ID;
- new targetid, Float:x, Float:y, Float:z;//defines floats and [U]targetid(same which we did as id above)[/U]
- if(sscanf(params, "u", targetid)) return SendClientMessage(playerid, COLOR_RED, "USAGE: /gethere [id]");//checks if there is something written after /gethere if no sends the usage error
- if(!IsPlayerConnected(ID) || ID == playerid) return SendClientMessage(playerid, 0xFF0000FF, "This player is offline or it is yourself");//checks if the player is conneted or not and also checks that we are not teleporting ourselves to our self :P if we are it sends error
- else if(pInfo[playerid][Adminlevel] < 1 ) return SendClientMessage(playerid, COLOR_RED, "You must be Admin to use this command!" );
- GetPlayerPos(playerid, x, y, z);//gets player pos PLAYER POS not targetid
- SetPlayerPos(targetid, x+1, y+1, z);//gets the TARGETID player to the PLAYERID x+1,y+1 and z remains same as it defines height
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement