SA-MP Forums Archive
Scripting Help - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Scripting Help (/showthread.php?tid=652356)



Scripting Help - Toss - 08.04.2018

Hello, i'm new to scripting and stuff like that and i got an god father script that i'm willing to open a server with but i noticed players hacking weapons by using /dropgun and other cmds on an server with this game mode..So i'm just wondering is there anyway to prevent the player weapon from switching after dropping an weapon...
Example:
If i have an deagle in hand and an m4 in inventory, when i drop the deagle, The M4 will spawn in hand without i switching it manually...Anyway to stop this from happening? i'm trying to avoid hackers.
Код:
CMD:dropgun(playerid, params[])
{
	if(isnull(params))
	{
		SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: /dropgun [weapon name]");
		SendClientMessageEx(playerid, COLOR_GRAD2, "Available Names: sdpistol, shotgun, 9mm, mp5, uzi, tec9, rifle, deagle, ak47, m4, spas12, sniper, camera");
		SendClientMessageEx(playerid, COLOR_GRAD2, "Available Names: flowers, knuckles, baseballbat, cane, shovel, poolcue, golfclub, katana, dildo, parachute");
		if(PlayerInfo[playerid][pMember] == 8 || PlayerInfo[playerid][pLeader] == 8)
		{
			SendClientMessageEx(playerid, COLOR_GRAD2, "Available Names: knife");
		}
		if(PlayerInfo[playerid][pMember] == 3 || PlayerInfo[playerid][pLeader] == 3 || PlayerInfo[playerid][pMember] == 1 || PlayerInfo[playerid][pLeader] == 1 || PlayerInfo[playerid][pMember] == 2 || PlayerInfo[playerid][pLeader] == 2 ||  PlayerInfo[playerid][pMember] == 4 && PlayerInfo[playerid][pDivision] == 2 || (PlayerInfo[playerid][pMember] == 4 && PlayerInfo[playerid][pRank] >= 5) || PlayerInfo[playerid][pMember] == 7 || PlayerInfo[playerid][pMember] == 11)
		{
			SendClientMessageEx(playerid, COLOR_GRAD2, "Available Names: nitestick, mace, smoke, chainsaw, fire");
		}
		return 1;
	}

	if(IsPlayerInAnyVehicle(playerid))
	{
		SendClientMessageEx (playerid, COLOR_GRAD2, "You can not drop weapons in a vehicle!");
		return 1;
	}
	if(GetPVarInt(playerid, "IsInArena") >= 0)
	{
		SendClientMessageEx(playerid, COLOR_WHITE, "You can't do this right now, you are in a arena!");
		return 1;
	}
	if(GetPVarInt( playerid, "EventToken") != 0)
	{
		SendClientMessageEx(playerid, COLOR_GREY, "You can't use this while you're in an event.");
		return 1;
	}
	new string[128];
	if(strcmp(params, "sdpistol", true) == 0)
	{
		if(PlayerInfo[playerid][pGuns][ 2 ] == 23)
		{
			if(pTazer[playerid] == 1) return SendClientMessageEx(playerid, COLOR_RED, "You cannot drop your tazer.");
			SendClientMessageEx(playerid, COLOR_LIGHTBLUE, "You have dropped your silenced pistol.");
			format(string, sizeof(string), "* %s has dropped their silenced pistol.", GetPlayerNameEx(playerid));
			ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
			RemovePlayerWeapon(playerid, 23);
		}
		else
		{
			SendClientMessageEx(playerid, COLOR_GREY, "You do not have that weapon!");
		}
	}

	else
	{
		SendClientMessageEx(playerid, COLOR_GRAD1, "You have entered an invalid weapon name.");
	}
	return 1;
}
Please note: This is not the entire code, i just placed this as an example but if the entire code is needed let me know..Thanks for any help in advance.


Re: Scripting Help - GTLS - 15.05.2018

Bro dont use Godfather edits they are so old now..!


Re: Scripting Help - CodeStyle175 - 15.05.2018

When you want to make successful server, you have to write gamemode by yourself


Re: Scripting Help - Sew_Sumi - 15.05.2018

Quote:
Originally Posted by CodeStyle175
Посмотреть сообщение
When you want to make successful server, you have to write gamemode by yourself
lol, that's actually very incorrect. If that was true, we wouldn't have multiple GF edits in the server list, and they wouldn't be populated.


Re: Scripting Help - GTLS - 16.05.2018

Quote:
Originally Posted by Sew_Sumi
Посмотреть сообщение
lol, that's actually very incorrect. If that was true, we wouldn't have multiple GF edits in the server list, and they wouldn't be populated.
True.