16.01.2018, 16:17
Use this.
You need to decide. Or u use
on every local script, or u can create a pName stock in global
then u can use it everywhere.
But u can't use both methods with same names function-string!
I hope u undestood.
Код:
CMD:a(playerid, params[]) { new string[128], Msg[128], stringName[24]; GetPlayerName(playerid, stringName, sizeof(stringName)); if(PlayerInfo[playerid][Level] >= 1) { if(isnull(params)) return SendClientMessage(playerid, red, "USAGE: /a <Text>"); if(PlayerInfo[playerid][Level] == 1) { format(string, 128, "[Basic Moderator] {00FC00}%s: %s", stringName, params); <<<<<<======== Error Line (2244) MessageToAdmins(newblue1, string); format(Msg, 128, "7[Basic Moderator] 9%s: %s", stringName, params); } else if(PlayerInfo[playerid][Level] == 2) { format(string, 128, "[Moderator] {00FC00}%s: %s", stringName, params); MessageToAdmins(COLOR_GREEN, string); format(Msg, 128, "7[Moderator] 9%s: %s", stringName, params); } else if(PlayerInfo[playerid][Level] == 3) { format(string, 128, "[Master Moderator] {00FF00}%s: %s", stringName, params); MessageToAdmins(COLOR_YELLOW, string); format(Msg, 128, "11[Master Moderator] 9%s: %s", stringName, params); } else if(PlayerInfo[playerid][Level] == 4) { format(string, 128, "[Administrator] {00FC00}%s: %s", stringName, params); MessageToAdmins(COLOR_ORANGE, string); format(Msg, 128, "11[Administrator] 9%s: %s", stringName, params); } else if(PlayerInfo[playerid][Level] == 5) { format(string, 128, "[Senior Admin] {00FC00}%s: %s", stringName, params); MessageToAdmins(blue1, string); format(Msg, 128, "12[Senior Admin] 9%s: %s", stringName, params); } else if(PlayerInfo[playerid][Level] == 6) { format(string, 128, "[Elite Admin] {00FC00}%s: %s", stringName, params); MessageToAdmins(COLOR_Silver, string); format(Msg, 128, "12[Elite Admin] 9%s: %s", stringName, params); } else if(PlayerInfo[playerid][Level] == 7) { format(string, 128, "[General] {00FC00}%s: %s", stringName, params); MessageToAdmins(red, string); format(Msg, 128, "4[General] 9%s: %s", stringName, params); } else if(PlayerInfo[playerid][Level] == 8) { format(string, 128, "[Director] {00FC00}%s: %s", stringName, params); MessageToAdmins(Color_Major_Elite1, string); format(Msg, 128, "69[Director] 9%s: %s", stringName, params); } } else return SendClientMessage(playerid, red, "ERROR: You need to be administrator to use this command"); return 1; }
Код:
new stringName[24]; GetPlayerName(playerid, stringName, sizeof(stringName));
Код:
stock pName(playerid) // pName or whatever u want to call your stock to use it. { new stringName[24]; GetPlayerName(playerid, stringName, sizeof(stringName)); return stringName; }
But u can't use both methods with same names function-string!
I hope u undestood.