CMD help -
ALoX12 - 12.07.2015
PHP код:
CMD:tie(playerid, params[])
{
new targetid;
new current_zone;
current_zone = Player_Zone[targetid];
new vehicle;
vehicle = GetPlayerVehicleID(playerid);
if(sscanf(params, "u", targetid)) return SendClientMessage(playerid, RED, "[USAGE]: /tie [name/id]");
if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid, RED, "Player not found.");
if(GetTeam{playerid} != CLASS_CIV) return SendClientMessage(playerid, RED, "Only civilians can use this command.");
if(GetTeam{targetid} == CLASS_MEDIC) return SendClientMessage(playerid, RED, "You cant kidnap medics.");
if(targetid == playerid) return SendClientMessage(playerid, RED, "You cant kidnap yourself");
if(!ProxDetectorS(5.0, playerid, targetid)) return SendClientMessage(playerid, RED, "That player is not close enough.");
if(!IsPlayerInAnyVehicle(targetid) && !IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, RED, "You both have to be in a vehicle.");
if(PlayerInfo[playerid][pRope] < 1) return SendClientMessage(playerid, RED, "You need rope to kidnap players.");
if(HasBeenTied{targetid} == true) return SendClientMessage(playerid, RED, "That player is already tied up.");
if(!IsPlayerInVehicle(targetid, vehicle)) return SendClientMessage(playerid, RED, "You both have to be in the same vehicle.");
if(GetPlayerState(targetid) == PLAYER_STATE_DRIVER) return SendClientMessage(playerid, RED, "You cant kidnap the driver.");
if(IsOnduty{targetid} == 1) return SendClientMessage(playerid, RED, "You cant kidnap On-Duty admins.");
if(IsAtEvent{targetid} == 1) return SendClientMessage(playerid, RED, "You cant kidnap players at events.");
if(IsAtEvent{targetid} == 0)
{
TogglePlayerControllable(targetid, false);
HasBeenTied{targetid} = true;
PlayerInfo[playerid][pCrimes] ++;
PlayerInfo[playerid][pRope] --;
SetPlayerWantedLevel(playerid, GetPlayerWantedLevel(playerid) + 4);
format(fstr, sizeof(fstr), "%s [%d] has just kidnapped you.", GetName(playerid), playerid);
SendClientMessage(targetid, RED, fstr);
GameTextForPlayer(targetid, "~r~Kidnapped", 3000, 5);
GameTextForPlayer(playerid, "~g~Player Tied Up", 3000, 5);
SendClientMessage(playerid, YELLOW, "You have successfully tied the player up.");
SendClientMessage(playerid, RED, "Kidnap [WANTED LEVEL INCREASED]");
format(fstr, sizeof(fstr), "[DISPATCH]: Suspect %s [%d] has just kidnapped %s [%d] at %s.", GetName(playerid), playerid, GetName(targetid), targetid, ZoneNames[current_zone][zone_name]);
CopRadio(BLUE, fstr);
}
else
{
SendClientMessage(playerid, RED, "You cant kidnap players at events.");
}
new astring[64];
format(astring, sizeof(astring),"%s [%d] typed: /tie %d", GetName(playerid), playerid, targetid);
SendAdminMessage(GREY, astring);
return true;
}
How can i add if player is kidnapped so it should take target cash and give it player in every 1 in game minute. like 20 percentage cash from target cash and give it to playerid
Re: CMD help -
IceBilizard - 12.07.2015
You can use Timer let me give you a simple example
pawn Код:
new TTime[MAX_PLAYERS]; //On TOp of script
CMD:tie(playerid, params[])
{
new targetid;
new current_zone;
current_zone = Player_Zone[targetid];
new vehicle;
vehicle = GetPlayerVehicleID(playerid);
if(sscanf(params, "u", targetid)) return SendClientMessage(playerid, RED, "[USAGE]: /tie [name/id]");
if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid, RED, "Player not found.");
if(GetTeam{playerid} != CLASS_CIV) return SendClientMessage(playerid, RED, "Only civilians can use this command.");
if(GetTeam{targetid} == CLASS_MEDIC) return SendClientMessage(playerid, RED, "You cant kidnap medics.");
if(targetid == playerid) return SendClientMessage(playerid, RED, "You cant kidnap yourself");
if(!ProxDetectorS(5.0, playerid, targetid)) return SendClientMessage(playerid, RED, "That player is not close enough.");
if(!IsPlayerInAnyVehicle(targetid) && !IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, RED, "You both have to be in a vehicle.");
if(PlayerInfo[playerid][pRope] < 1) return SendClientMessage(playerid, RED, "You need rope to kidnap players.");
if(HasBeenTied{targetid} == true) return SendClientMessage(playerid, RED, "That player is already tied up.");
if(!IsPlayerInVehicle(targetid, vehicle)) return SendClientMessage(playerid, RED, "You both have to be in the same vehicle.");
if(GetPlayerState(targetid) == PLAYER_STATE_DRIVER) return SendClientMessage(playerid, RED, "You cant kidnap the driver.");
if(IsOnduty{targetid} == 1) return SendClientMessage(playerid, RED, "You cant kidnap On-Duty admins.");
if(IsAtEvent{targetid} == 1) return SendClientMessage(playerid, RED, "You cant kidnap players at events.");
if(IsAtEvent{targetid} == 0)
{
TogglePlayerControllable(targetid, false);
HasBeenTied{targetid} = true;
PlayerInfo[playerid][pCrimes] ++;
PlayerInfo[playerid][pRope] --;
SetPlayerWantedLevel(playerid, GetPlayerWantedLevel(playerid) + 4);
format(fstr, sizeof(fstr), "%s [%d] has just kidnapped you.", GetName(playerid), playerid);
SendClientMessage(targetid, RED, fstr);
GameTextForPlayer(targetid, "~r~Kidnapped", 3000, 5);
GameTextForPlayer(playerid, "~g~Player Tied Up", 3000, 5);
SendClientMessage(playerid, YELLOW, "You have successfully tied the player up.");
SendClientMessage(playerid, RED, "Kidnap [WANTED LEVEL INCREASED]");
format(fstr, sizeof(fstr), "[DISPATCH]: Suspect %s [%d] has just kidnapped %s [%d] at %s.", GetName(playerid), playerid, GetName(targetid), targetid, ZoneNames[current_zone][zone_name]);
TTime[targetid] = SetTimerEx("TieTimer", 120000, 1 ,"i", targetid);//new thing Added
CopRadio(BLUE, fstr);
}
else
{
SendClientMessage(playerid, RED, "You cant kidnap players at events.");
}
new astring[64];
format(astring, sizeof(astring),"%s [%d] typed: /tie %d", GetName(playerid), playerid, targetid);
SendAdminMessage(GREY, astring);
return true;
}
forward TieTimer(playerid);
public TieTimer(playerid)
{
if(HasBeenTied{playerid} == true)
{
//Do stuff here
}
return 1;
}
Note: You must kill timer when player get released from kidnapper with KillTimer(TTime[playerid or targetid]);
Re : CMD help -
KillerDVX - 12.07.2015
Try this :
PHP код:
CMD:tie(playerid, params[])
{
new targetid;
new current_zone;
current_zone = Player_Zone[targetid];
new vehicle;
vehicle = GetPlayerVehicleID(playerid);
if(sscanf(params, "u", targetid)) return SendClientMessage(playerid, RED, "[USAGE]: /tie [name/id]");
if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid, RED, "Player not found.");
if(GetTeam{playerid} != CLASS_CIV) return SendClientMessage(playerid, RED, "Only civilians can use this command.");
if(GetTeam{targetid} == CLASS_MEDIC) return SendClientMessage(playerid, RED, "You cant kidnap medics.");
if(targetid == playerid) return SendClientMessage(playerid, RED, "You cant kidnap yourself");
if(!ProxDetectorS(5.0, playerid, targetid)) return SendClientMessage(playerid, RED, "That player is not close enough.");
if(!IsPlayerInAnyVehicle(targetid) && !IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, RED, "You both have to be in a vehicle.");
if(PlayerInfo[playerid][pRope] < 1) re[/CENTER]turn SendClientMessage(playerid, RED, "You need rope to kidnap players.");
if(HasBeenTied{targetid} == true) return SendClientMessage(playerid, RED, "That player is already tied up.");
if(!IsPlayerInVehicle(targetid, vehicle)) return SendClientMessage(playerid, RED, "You both have to be in the same vehicle.");
if(GetPlayerState(targetid) == PLAYER_STATE_DRIVER) return SendClientMessage(playerid, RED, "You cant kidnap the driver.");
if(IsOnduty{targetid} == 1) return SendClientMessage(playerid, RED, "You cant kidnap On-Duty admins.");
if(IsAtEvent{targetid} == 1) return SendClientMessage(playerid, RED, "You cant kidnap players at events.");
if(IsAtEvent{targetid} == 0)
{
TogglePlayerControllable(targetid, false);
HasBeenTied{targetid} = true;
PlayerInfo[playerid][pCrimes] ++;
PlayerInfo[playerid][pRope] --;
SetPlayerWantedLevel(playerid, GetPlayerWantedLevel(playerid) + 4);
format(fstr, sizeof(fstr), "%s [%d] has just kidnapped you.", GetName(playerid), playerid);
SendClientMessage(targetid, RED, fstr);
GameTextForPlayer(targetid, "~r~Kidnapped", 3000, 5);
GameTextForPlayer(playerid, "~g~Player Tied Up", 3000, 5);
SendClientMessage(playerid, YELLOW, "You have successfully tied the player up.");
SendClientMessage(playerid, RED, "Kidnap [WANTED LEVEL INCREASED]");
format(fstr, sizeof(fstr), "[DISPATCH]: Suspect %s [%d] has just kidnapped %s [%d] at %s.", GetName(playerid), playerid, GetName(targetid), targetid, ZoneNames[current_zone][zone_name]);
SetTimerEx("TakeMoney",60000,false,"i",playerid);
CopRadio(BLUE, fstr);
}
else
{
SendClientMessage(playerid, RED, "You cant kidnap players at events.");
}
new astring[64];
format(astring, sizeof(astring),"%s [%d] typed: /tie %d", GetName(playerid), playerid, targetid);
SendAdminMessage(GREY, astring);
return true;
}
forward TakeMoney(playerid);
public TakeMoney(playerid)
{
new targetid;
new mrand =random(GetPlayerMoney(targetid));
GivePlayerMoney(playerid,mrand);
GivePlayerMoney(ID,-mrand);
return 1;
}
Re: CMD help -
Roberto80 - 12.07.2015
how you use " if(HasBeenTied{targetid} == true) "
{targetid} ? its [targetid] and same for "if(IsOnduty{targetid} == 1) || if(IsAtEvent{targetid} == 1) "