09.12.2010, 18:39
Hello, I'm Trying To lower My Script Lines, Ive Trying to make a command with 2 Extra Values, Yes, The Class is The Class.
Here's My Cmd.
Without the Values.
When i do it With Values,
After The second Vaules it Sends "You aren't a Cop...
So Please, if Someone Can Help me, it would be Great.
Here's My Cmd.
Код:
dcmd_cuff(playerid,params[]) { new Float:X, Float:Y, Float:Z, target, string[128]; if(PlayerInfo[playerid][IsCivil] == 1) return SendClientMessage(playerid,red,"You are not a cop!"); if(sscanf(params,"u",target)) return SendClientMessage(playerid,COLOR_WHITE,"USAGE: /cuff [ID]"); // if(target == INVALID_PLAYER_ID || target == playerid || !IsPlayerConnected(target)) // return SendClientMessage(playerid,red,"Invalid playerid"); if(PlayerInfo[playerid][IsDead] == 1) return SendClientMessage(playerid,red,"You are dead, you can't cuff!"); if(PlayerInfo[playerid][IsInEvent] == 1) return SendClientMessage(playerid,red,"You can't do that in a event!"); if(IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid,red,"You can't cuff from vehicle!"); if(IsPlayerInAnyVehicle(target)) return SendClientMessage(playerid,red,"That player is in vehicle, you can't cuff him!"); GetPlayerPos(target,X,Y,Z); if(!IsPlayerInRangeOfPoint(playerid,3.00,X,Y,Z)) return SendClientMessage(playerid,red,"You are too far away from him!"); if(GetPlayerInterior(target)!= 0) return SendClientMessage(playerid,red,"You can't cuff inside buildings!"); if(PlayerInfo[playerid][Jailed] == 1) return SendClientMessage(playerid,red,"You are jailed, you can't cuff!"); if(PlayerInfo[target][Jailed] == 1) return SendClientMessage(playerid,red,"That player is jailed, you can't cuff him!"); if(PlayerInfo[target][IsCuffed] == 1) return SendClientMessage(playerid,red,"That player is already cuffed!"); if(PlayerInfo[playerid][IsCop] == 1) { format(string, sizeof(string), "%s(%d) has been cuff by cop %s(%d)",PlayerName(target),target,PlayerName(playerid),playerid); SendClientMessageToAll(COLOR_WHITE,string); format(string, sizeof(string), "~w~Cuff ~r~succees!"); GameTextForPlayer(playerid,string,3000,4); format(string, sizeof(string), "~w~Cuffed ~r~by cop %s(%d)!",PlayerName(playerid),playerid); GameTextForPlayer(target,string,3000,4); PlayerInfo[target][IsCuffed] = 1; TogglePlayerControllable(target,0); ApplyAnimation(target,"COP_AMBIENT","Copbrowse_in",4.1,0,0,0,0,-1); SendClientMessage(target,COLOR_BLUE1,"You may attempt escaping, /breakcuffs"); new rand = random(3); if(rand == 0) return true; if(rand == 1) return GivePlayerScore(playerid,1); if(rand == 2) { GivePlayerScore(playerid,1); PlayerInfo[playerid][CopSkill] ++; format(string, sizeof(string), "Congrats! Your cop skill has been upraged to %d!",PlayerInfo[playerid][CopSkill]); SendClientMessage(playerid,blue,string); } } else return SendClientMessage(playerid,red,"You aren't a cop!"); return true; }
When i do it With Values,
Код:
dcmd_cuff(playerid,params[]) { new Float:X, Float:Y, Float:Z, target, string[128]; if(PlayerInfo[playerid][IsCivil] == 1) return SendClientMessage(playerid,red,"You are not a cop!"); if(sscanf(params,"u",target)) return SendClientMessage(playerid,COLOR_WHITE,"USAGE: /cuff [ID]"); // if(target == INVALID_PLAYER_ID || target == playerid || !IsPlayerConnected(target)) // return SendClientMessage(playerid,red,"Invalid playerid"); if(PlayerInfo[playerid][IsDead] == 1) return SendClientMessage(playerid,red,"You are dead, you can't cuff!"); if(PlayerInfo[playerid][IsInEvent] == 1) return SendClientMessage(playerid,red,"You can't do that in a event!"); if(IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid,red,"You can't cuff from vehicle!"); if(IsPlayerInAnyVehicle(target)) return SendClientMessage(playerid,red,"That player is in vehicle, you can't cuff him!"); GetPlayerPos(target,X,Y,Z); if(!IsPlayerInRangeOfPoint(playerid,3.00,X,Y,Z)) return SendClientMessage(playerid,red,"You are too far away from him!"); if(GetPlayerInterior(target)!= 0) return SendClientMessage(playerid,red,"You can't cuff inside buildings!"); if(PlayerInfo[playerid][Jailed] == 1) return SendClientMessage(playerid,red,"You are jailed, you can't cuff!"); if(PlayerInfo[target][Jailed] == 1) return SendClientMessage(playerid,red,"That player is jailed, you can't cuff him!"); if(PlayerInfo[target][IsCuffed] == 1) return SendClientMessage(playerid,red,"That player is already cuffed!"); if(PlayerInfo[playerid][IsCop] == 1 && PlayerInfo[playerid][IsSwatSpawned] == 1 && PlayerInfo[playerid][IsArmySpawned == 1) { format(string, sizeof(string), "%s(%d) has been cuff by cop %s(%d)",PlayerName(target),target,PlayerName(playerid),playerid); SendClientMessageToAll(COLOR_WHITE,string); format(string, sizeof(string), "~w~Cuff ~r~succees!"); GameTextForPlayer(playerid,string,3000,4); format(string, sizeof(string), "~w~Cuffed ~r~by cop %s(%d)!",PlayerName(playerid),playerid); GameTextForPlayer(target,string,3000,4); PlayerInfo[target][IsCuffed] = 1; TogglePlayerControllable(target,0); ApplyAnimation(target,"COP_AMBIENT","Copbrowse_in",4.1,0,0,0,0,-1); SendClientMessage(target,COLOR_BLUE1,"You may attempt escaping, /breakcuffs"); new rand = random(3); if(rand == 0) return true; if(rand == 1) return GivePlayerScore(playerid,1); if(rand == 2) { GivePlayerScore(playerid,1); PlayerInfo[playerid][CopSkill] ++; format(string, sizeof(string), "Congrats! Your cop skill has been upraged to %d!",PlayerInfo[playerid][CopSkill]); SendClientMessage(playerid,blue,string); } } else return SendClientMessage(playerid,red,"You aren't a cop!"); return true; }
So Please, if Someone Can Help me, it would be Great.