Guest User

Help with finishing these /aduty & /setaname commands please

a guest
Mar 23rd, 2013
135
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.39 KB | None | 0 0
  1. enum pInfo
  2. {
  3. pName[24],
  4. pPass,
  5. pCash,
  6. pSkin,
  7. pLevel,
  8. pInt,
  9. pVW,
  10. pAdmin,
  11. aName[24],
  12. bool:HasSetAdminName,
  13. OnDuty,
  14. pSecKey,
  15. onDuty,
  16. pKills,
  17. pDeaths,
  18. Float:pFacingAngle,
  19. Float:pHealth,
  20. Float:pArmour,
  21. Float:pLastX,
  22. Float:pLastY,
  23. Float:pLastZ,
  24. pBizID
  25. }
  26. new PlayerInfo[MAX_PLAYERS][pInfo];
  27.  
  28. public SaveAccountInfo(playerid)
  29. {
  30. new cash = GetPlayerMoney(playerid);
  31. new skin = GetPlayerSkin(playerid);
  32. new level = GetPlayerScore(playerid);
  33. new int = GetPlayerInterior(playerid);
  34. new vw = GetPlayerVirtualWorld(playerid);
  35. new Float:X, Float:Y, Float:Z;
  36. new Float:facingangle;
  37. new Float:health, Float:armour;
  38. GetPlayerHealth(playerid, health);
  39. GetPlayerArmour(playerid, armour);
  40. GetPlayerFacingAngle(playerid, facingangle);
  41. GetPlayerPos(playerid, X, Y, Z);
  42. new INI:File = INI_Open(UserPath(playerid));
  43. INI_SetTag(File,"data");
  44. INI_WriteString(File,"pName", PlayerInfo[playerid][pName]);
  45. INI_WriteInt(File,"Cash",cash);
  46. INI_WriteInt(File,"Skin",skin);
  47. INI_WriteInt(File,"Level",level);
  48. INI_WriteInt(File,"Int",int);
  49. INI_WriteInt(File,"VW",vw);
  50. INI_WriteInt(File,"Admin",PlayerInfo[playerid][pAdmin]);
  51. INI_WriteString(File,"AdminName", PlayerInfo[playerid][aName]);
  52. INI_WriteInt(File,"SecKey",PlayerInfo[playerid][pSecKey]);
  53. INI_WriteInt(File,"OnDuty",PlayerInfo[playerid][onDuty]);
  54. INI_WriteInt(File,"Kills",PlayerInfo[playerid][pKills]);
  55. INI_WriteInt(File,"Deaths",PlayerInfo[playerid][pDeaths]);
  56. INI_WriteFloat(File, "FacingAngle", facingangle);
  57. INI_WriteFloat(File, "Health", health);
  58. INI_WriteFloat(File, "Armour", armour);
  59. INI_WriteFloat(File, "LastX", X);
  60. INI_WriteFloat(File, "LastY", Y);
  61. INI_WriteFloat(File, "LastZ", Z);
  62. INI_WriteInt(File, "BizID", pBizID);
  63. INI_Close(File);
  64. return 1;
  65. }
  66.  
  67. public LoadUser_data(playerid,name[],value[], skin[],FacingAngle[],LastX[],LastY[],LastZ[], BizID[])
  68. {
  69. INI_String("pName",PlayerInfo[playerid][pName],128);
  70. INI_Int("Password",PlayerInfo[playerid][pPass]);
  71. INI_Int("Cash",PlayerInfo[playerid][pCash]);
  72. INI_Int("Skin",PlayerInfo[playerid][pSkin]);
  73. INI_Int("Level",PlayerInfo[playerid][pLevel]);
  74. INI_Int("Admin",PlayerInfo[playerid][pAdmin]);
  75. INI_String("AdminName",PlayerInfo[playerid][aName],128);
  76. INI_Int("SecKey",PlayerInfo[playerid][pSecKey]);
  77. INI_Int("Kills",PlayerInfo[playerid][pKills]);
  78. INI_Int("Deaths",PlayerInfo[playerid][pDeaths]);
  79. INI_Float("FacingAngle",PlayerInfo[playerid][pFacingAngle]);
  80. INI_Float("Health",PlayerInfo[playerid][pHealth]);
  81. INI_Float("Armour",PlayerInfo[playerid][pArmour]);
  82. INI_Float("LastX", PlayerInfo[playerid][pLastX]);
  83. INI_Float("LastY", PlayerInfo[playerid][pLastY]);
  84. INI_Float("LastZ", PlayerInfo[playerid][pLastZ]);
  85. INI_Int("BizID", PlayerInfo[playerid][pBizID]);
  86. return 1;
  87. }
  88.  
  89.  
  90. CMD:setaname(playerid, params[])
  91. {
  92. if(PlayerInfo[playerid][pAdmin] < 1)
  93. {
  94. return SendClientMessage(playerid, -1, "You are not an admin.");
  95. }
  96. new adminname[24], a_string[65];
  97. if(sscanf(params, "s[24]", adminname))
  98. {
  99. return SendClientMessage(playerid, -1, "USAGE: /setaname [name]");
  100. }
  101.  
  102. PlayerInfo[playerid][aName] = adminname;
  103. format(a_string, 65, "Your admin name is %s.", PlayerInfo[playerid][aName]);
  104. SendClientMessage(playerid, -1, a_string);
  105. PlayerInfo[playerid][HasSetAdminName] = true;
  106. return 1;
  107. }
  108.  
  109. CMD:aduty(playerid, params[])
  110. {
  111. new playername[MAX_PLAYER_NAME+1], string[24+MAX_PLAYER_NAME+1];
  112. GetPlayerName(playerid, playername, sizeof(playername));
  113. if(!PlayerInfo[playerid][pAdmin])
  114. {
  115. return SendClientMessage(playerid, -1, "You are not an admin.");
  116. }
  117.  
  118. if(PlayerInfo[playerid][OnDuty])
  119. {
  120. SetPlayerName(playerid, playername);
  121. PlayerInfo[playerid][OnDuty] = false;
  122. SendClientMessage(playerid,COLOR_YELLOW, "You have gone OFF administrator duty!");
  123. }
  124. else
  125. {
  126. if(!PlayerInfo[playerid][HasSetAdminName])
  127. {
  128. return SendClientMessage(playerid, -1, "You haven't set an admin name yet.");
  129. }
  130. SetPlayerName(playerid, PlayerInfo[playerid][aName]);
  131. PlayerInfo[playerid][OnDuty] = true;
  132. SendClientMessage(playerid,COLOR_YELLOW, "You have gone ON administrator duty!");
  133. }
  134.  
  135. return 1;
  136. }
Advertisement
Add Comment
Please, Sign In to add comment