Guest User

Untitled

a guest
Feb 20th, 2018
286
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.64 KB | None | 0 0
  1. COMMAND:setadminlevel(playerid,params[])
  2. {
  3. new adminlevel,id,file[256],n[MAX_PLAYER_NAME];//creating the new variabls
  4. new tmp[256], tmp2[256], Index,str[50];// creating the new variables
  5. tmp = strtok(params,Index), tmp2 = strtok(params,Index),id = strval(tmp),adminlevel = strval(tmp2);// setting them to strtok so we can use them as parameters of our command
  6. GetPlayerName(id,n,MAX_PLAYER_NAME);//getting the players name
  7. format(file,sizeof(file),"RealityC/Users/%s.txt",n);//formatting the file
  8. if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid,COLOR_GREY,"You are not an RCON admin!");//if the player is not rcon admin
  9. if(!strlen(params)) return SendClientMessage(playerid,COLOR_GREY,"USAGE: /setlevel <ID> <Level>");// if the string is empty
  10. if(!IsPlayerConnected(id))return SendClientMessage(playerid,COLOR_GREY,"You have entered an incorrect ID"); //if the id is not connected
  11. PInfo[id][ADMINLEVEL] = adminlevel;//sets the level of the player
  12. INI_Int("Admin Level",adminlevel);//saves the new level to the file
  13. format(str,sizeof(str),"You have set %s's level to %d",n,adminlevel);//creates the string
  14. SendClientMessage(playerid,COLOR_LIGHTBLUE,str);
  15. return 1;
  16. }
  17. COMMAND:setfaction(playerid,params[])
  18. {
  19. new faction,id,file[256],n[MAX_PLAYER_NAME];//creating the new variabls
  20. new tmp[256], tmp2[256], Index,str[50];// creating the new variables
  21. tmp = strtok(params,Index), tmp2 = strtok(params,Index),id = strval(tmp),faction = strval(tmp2);// setting them to strtok so we can use them as parameters of our command
  22. GetPlayerName(id,n,MAX_PLAYER_NAME);//getting the players name
  23. format(file,sizeof(file),"RealityC/Users/%s.txt",n);//formatting the file
  24. if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid,COLOR_GREY,"You are not an RCON admin!");//if the player is not rcon admin
  25. if(!strlen(params)) return SendClientMessage(playerid,COLOR_GREY,"USAGE: /setfaction <ID> <Level>");// if the string is empty
  26. if(!IsPlayerConnected(id))return SendClientMessage(playerid,COLOR_GREY,"You have entered an incorrect ID"); //if the id is not connected
  27. PInfo[id][FACTION] = faction;//sets the level of the player
  28. INI_Int("Faction",faction);//saves the new level to the file
  29. format(str,sizeof(str),"You have set %s's faction to %d",n,faction);//creates the string
  30. SendClientMessage(playerid,COLOR_LIGHTBLUE,str);
  31. return 1;
  32. }
Add Comment
Please, Sign In to add comment