SA-MP Forums Archive
[Help] /Gag system few more - 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: [Help] /Gag system few more (/showthread.php?tid=590639)



[Help] /Gag system /badge /tazer - BigGreen - 02.10.2015

Hello so i have 3 things i need help with so number 1 when i try doing /gag on a player they are post to be muted from talking in In-character as its for a Roleplay script so basicly i want the player who i /gag to be muted Icly but he can talk in /b(Out of character) so here is the /gag code

Код:
command(gag, playerid, params[])
{
	new id, string[128];
	if(sscanf(params, "u", id))
	{
	    SendClientMessage(playerid, WHITE, "SYNTAX: /gag [playerid]");
	}
	else
	{
	    if(!IsPlayerConnectedEx(id))
	    {
	        SendClientMessage(playerid, WHITE, "That player is not connected or is not logged in.");
	    }
	    else
	    {
		    if(Player[playerid][Rags] >= 1)
		    {
		        if(GetDistanceBetweenPlayers(playerid, id) < 5)
		        {
		            if(Player[playerid][Cuffed] >= 1 || Player[playerid][HospitalTime] >= 1 || Player[playerid][Tied] >= 1 || Player[playerid][Tazed] >= 1)
		            {
		                SendClientMessage(playerid, WHITE, "You can't do this right now.");
		            }
		            else
		            {
		                if(Player[id][Tied] >= 1 || Player[id][Cuffed] >= 1)
		                {
			                Player[id][Gagged] = 1;
							format(string, sizeof(string), "* %s grabs a rag, and ties it around %s's mouth.", GetName(playerid), GetName(id));
							NearByMessage(playerid, SCRIPTPURPLE, string);
							Player[playerid][Rags]--;
						}
						else
						{
						    SendClientMessage(playerid, WHITE, "You must cuff/tie them first.");
						}
		            }
		        }
		        else
		        {
		            SendClientMessage(playerid, WHITE, "You're too far away.");
		        }
		    }
		    else
		    {
		        SendClientMessage(playerid, WHITE, "You have no rags left.");
		    }
	    }
	}
	return 1;
}


Second problem i have is a /tazer command i want it to work like a real Tazer when the Police officer shoots it the police officer would have to wait some amount of time to re-charge so basicly just like real life Tazer's recharge time

Код:
command(tazer, playerid, params[])
{
	new string[128];
    if(Groups[Player[playerid][Group]][CommandTypes] == 1 || Groups[Player[playerid][Group]][CommandTypes] == 4)
        {
        if(!IsPlayerInAnyVehicle(playerid))
        {
	    	if(Player[playerid][Tazer] == 0)
	    	{
                ResetPlayerWeapons(playerid);
	    	    GivePlayerWeaponEx(playerid, 47);
	    	    format(string, sizeof(string), "* %s has withdrawn their tazer.", GetName(playerid));
	    	    NearByMessage(playerid, SCRIPTPURPLE, string);
	    	    Player[playerid][Tazer] = 1;
	    	    SetPlayerArmedWeapon(playerid, 23);
	    	}
	    	else
	    	{
	    		ResetPlayerWeapons(playerid);
	    		GivePlayerSavedWeapons(playerid);
	    		format(string, sizeof(string), "* %s has holstered their tazer.", GetName(playerid));
	    	    NearByMessage(playerid, SCRIPTPURPLE, string);
	    		Player[playerid][Tazer] = 0;
	    	}
        }
	    else
    	{
    		SendClientMessage(playerid, WHITE, "You can't do this in a vehicle.");
    	}
	}
	return 1;
}
Third problem i have is i want this command /badge to give the Police officers/SASD officer there firearms while doing /badge but it still lets them go on duty



Код:
command(badge, playerid, params[])
{
	if(Player[playerid][Group] >= 1)
	{
		if(Groups[Player[playerid][Group]][CommandTypes] == 1 || Groups[Player[playerid][Group]][CommandTypes] == 4)
		{
			if(Player[playerid][CopDuty] == 0)
			{
                SetPlayerColor(playerid, Groups[Player[playerid][Group]][GroupColour] * 256 + 255);
				SendClientMessage(playerid, WHITE, "You have attached your badge, and are now being identified as on duty.");
				Player[playerid][CopDuty] = 1;
			}
			else
			{
                SetPlayerColor(playerid, 0xFFFFFFFF);
                SendClientMessage(playerid, WHITE, "You have deattached your badge, and are now being identified as off duty.");
                Player[playerid][CopDuty] = 0;
			}
		}
	}
	return 1;
}
i'll Rep who ever has helped me


Re: [Help] /Gag system few more - BigGreen - 02.10.2015

BUMP

NOTE: i really need this fixed someone help


Re: [Help] /Gag system few more - PrO.GameR - 02.10.2015

Your OnPlayerText would probably look like this:
PHP код:
public OnPlayerText(playeridtext[])
{
    new 
msg[128];
//Send the msg
    
return 0;

change it to
PHP код:
public OnPlayerText(playeridtext[])
{
    if(
Player[id][Gagged] == 0)
    {
    new 
msg[128];
    
//Send the msg
    
}
    return 
0;

This simply checks if your player isn't gagged, you need to apply this to all your IC commands btw (/low /s /w) and others you have
for second one, you need to make a global variable that sets the time, and check if current time - that variable is more than your recharge time when a player shoots anotherone with your tazer gun, more info about the way I suggested here: forum.sa-mp.com/showthread.php?t=254915&highlight=unix+timestamp
as for your third question, simply take this out
PHP код:
            Player[playerid][CopDuty] = 1
( and the = 0 one too)
and make another cmd as /duty


Re: [Help] /Gag system few more - BigGreen - 02.10.2015

Quote:
Originally Posted by PrO.GameR
Посмотреть сообщение
Your OnPlayerText would probably look like this:
PHP код:
public OnPlayerText(playeridtext[])
{
    new 
msg[128];
//Send the msg
    
return 0;

change it to
PHP код:
public OnPlayerText(playeridtext[])
{
    if(
Player[id][Gagged] == 0)
    {
    new 
msg[128];
    
//Send the msg
    
}
    return 
0;

This simply checks if your player isn't gagged, you need to apply this to all your IC commands btw (/low /s /w) and others you have
for second one, you need to make a global variable that sets the time, and check if current time - that variable is more than your recharge time when a player shoots anotherone with your tazer gun, more info about the way I suggested here: forum.sa-mp.com/showthread.php?t=254915&highlight=unix+timestamp
as for your third question, simply take this out
PHP код:
            Player[playerid][CopDuty] = 1
( and the = 0 one too)
and make another cmd as /duty
So for the last one do i remove this
Код:
Player[playerid][CopDuty] = 1;
and this
Код:
if(Player[playerid][CopDuty] == 0)
from the script code? and also note that when they do /badge or /duty it will give them a desert eagle and shotgun, spraycan ,mp5


Re: [Help] /Gag system few more - BigGreen - 02.10.2015

BUMP


Am going to explain how i need the last command to work so maybe some people would understand

When the PD/SD member does /duty I already have a duty commd but it does not work how i want it to i tried making 1 but i have failed so when the PD/SD Does /duty it puts them on duty and it gives them the selected guns Desert eagle, mp5 , Spraycan, Nitestick, shotgun those are what i need so if player A does /duty it will put his status on duty as a Police officer/SD and he will have those desired guns i put ontop or even maybe a command that is /dutybelt and it gives them the guns


Re: [Help] /Gag system few more - PrO.GameR - 03.10.2015

Well actually your badge cmd works just fine, just change it's name to duty
PHP код:
command(dutyplayeridparams[])
{
    if(
Player[playerid][Group] >= 1)
    {
        if(
Groups[Player[playerid][Group]][CommandTypes] == || Groups[Player[playerid][Group]][CommandTypes] == 4)
        {
            if(
Player[playerid][CopDuty] == 0)
            {
                
SetPlayerColor(playeridGroups[Player[playerid][Group]][GroupColour] * 256 255);
                
SendClientMessage(playeridWHITE"You have attached your badge, and are now being identified as on duty.");
                
Player[playerid][CopDuty] = 1;
            }
            else
            {
                
SetPlayerColor(playerid0xFFFFFFFF);
                
SendClientMessage(playeridWHITE"You have deattached your badge, and are now being identified as off duty.");
                
Player[playerid][CopDuty] = 0;
            }
        }
    }
    return 
1;

for the dutybelt cmd
PHP код:
    if(Player[playerid][CopDuty] == 1
{
GivePlayerWeapon(playerid24100); //desert eagle
GivePlayerWeapon(playerid2550); //shotgun
GivePlayerWeapon(playerid29200); //mp5
GivePlayerWeapon(playerid31); //nitestick
GivePlayerWeapon(playerid41400); //spray can

just put this under your dutybelt, after that an officer needs to /duty to get his duty status, and then needs to /dutybelt to get his weapons
is this the same thing you want ?
if you want your /duty cmd to give those guns too, just put the same code under
SendClientMessage(playerid, WHITE, "You have attached your badge, and are now being identified as on duty.");
in your duty command