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; }
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; }
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; }
public OnPlayerText(playerid, text[])
{
new msg[128];
//Send the msg
return 0;
}
public OnPlayerText(playerid, text[])
{
if(Player[id][Gagged] == 0)
{
new msg[128];
//Send the msg
}
return 0;
}
Player[playerid][CopDuty] = 1;
Your OnPlayerText would probably look like this:
PHP код:
PHP код:
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 код:
and make another cmd as /duty |
Player[playerid][CopDuty] = 1;
if(Player[playerid][CopDuty] == 0)
command(duty, 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;
}
if(Player[playerid][CopDuty] == 1)
{
GivePlayerWeapon(playerid, 24, 100); //desert eagle
GivePlayerWeapon(playerid, 25, 50); //shotgun
GivePlayerWeapon(playerid, 29, 200); //mp5
GivePlayerWeapon(playerid, 3, 1); //nitestick
GivePlayerWeapon(playerid, 41, 400); //spray can
}