Advertisement
Guest User

Untitled

a guest
Feb 23rd, 2018
133
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.60 KB | None | 0 0
  1. CMD:freeze(playerid,params[])
  2. {
  3. if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, 0xA9C4E4FF, "You are not an admin!");
  4. {
  5. new Target; //defines the playerid we wanna freeze
  6. if(sscanf(params, "u", Target)) SendClientMessage(playerid, COLOR_LIGHTBLUE, "USAGE: /freeze [playerid]"); //tell sscanf again if the parameters/syntax is wrong to return a special message
  7. if(!IsPlayerConnected(Target)) //if the ID doesn't exist, return an error-message
  8. return SendClientMessage(playerid, -1, "ERROR:Player is not connected!");
  9. if(!sscanf(params, "u", Target))
  10. {
  11. //if(Target == playerid) return SendClientMessage(playerid, COLOR_RED, "ERROR: Cant perform this command on yourself!" ); //I wouldn't add this line, because it won't let you perform this CMD on yourself
  12. //if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid,-1,"ERROR: You cant perform this on Admins that are higher than your level!"); // if the player you're performing this command on has a higher level as you, return a message, you ain't able to freeze him
  13. new tname[MAX_PLAYER_NAME]; //define the new target-name of the playerid
  14. GetPlayerName(Target,tname,sizeof(tname)); //get the playername with this function
  15. new pname[MAX_PLAYER_NAME]; //define the adminname
  16. GetPlayerName(playerid,pname,sizeof(pname)); //get the adminname with this function
  17. new tstring[128]; //define the string for the player (victim)
  18. new pstring[128];// define the string for the admin which is performing
  19. new astring[128];//define the string for all the players which are online
  20. format(tstring,sizeof(tstring),"You have been frozen by administrator %s! You cant move!",pname); //this is formatting the player-string, while it's also getting the adminname
  21. format(pstring,sizeof(pstring),"You have frozen player %s(%d)!",tname,Target); //this is formatting the adminname-string, while it's also getting the playername and his ID(target)
  22. format(astring,sizeof(astring),"Administrator %s has frozen %s!",pname,tname); //this is formatting the all-string, while it's sending this message to everybody and is getting admin- and playername
  23. SendClientMessage(Target,-1,tstring);//sends the message to the victim
  24. SendClientMessage(playerid,-1,pstring);//sends the message to the admin
  25. SendAdminMessage(-1,astring);//sends the message to everybody
  26. TogglePlayerControllable(Target,0); //with that function, the player won't be able to mov, while we're using the variable "Target" as the playerid
  27. }
  28. }
  29. return 1;
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement