09.08.2016, 20:52
Hello SA:MP Community,
I wanna know how to make the gOwner in my script get updated everytime I use [/makegateowner] so that it shows the gate owner when I use the command [/gused]
Here's my [/makegatowner] code:
Thanks for Helping me!
I wanna know how to make the gOwner in my script get updated everytime I use [/makegateowner] so that it shows the gate owner when I use the command [/gused]
Here's my [/makegatowner] code:
Код:
CMD:gused(playerid, params[]) { new string[128]; if(!gPlayerLogged[playerid]) return SendClientMessage(playerid, COLOR_GREY, "To use the commands, you need to login first."); if(PlayerInfo[playerid][pAdmin] < 6) return SendClientMessage(playerid, COLOR_GREY, "You are not authorized to use this command."); SendClientMessage(playerid, COLOR_ORANGE, "[Used Gates]:"); for(new idx=1; idx<MAX_GATES; idx++) { if(GateInfo[idx][gModel]) { format(string, sizeof(string), "ID: %d | Owner: %s | Object: %d | Speed: %f | Password: %s", idx, GateInfo[idx][gOwner], GateInfo[idx][gModel], GateInfo[idx][gSpeed], GateInfo[idx][gPassword]); SendClientMessage(playerid, COLOR_ORANGE, string); } } return 1; }
Код:
CMD:makegateowner(playerid, params[]) { new giveplayerid, slot, idx, string[128]; if(!gPlayerLogged[playerid]) return SendClientMessage(playerid, COLOR_GREY, "To use the commands, you need to login first."); if(PlayerInfo[playerid][pAdmin] < 6) return SendClientMessage(playerid, COLOR_GREY, "You are not authorized to use this command"); if(sscanf(params, "uii", playerid, slot, idx)) return SendClientMessage(playerid, COLOR_GREEN, "[+]{FFFFFF} /makegateowner [playerid] [slot(1-3)] [gateid]"); if(!gPlayerLogged[playerid]) return SendClientMessage(playerid, COLOR_GREY, "Suitable non-player ID si."); if(idx > 0 && !GateInfo[idx][gModel] || idx < 0) return SendClientMessage(playerid, COLOR_GREY, "Invalid gate ID!"); if(slot < 1 || slot > 3) return SendClientMessage(playerid, COLOR_GREY, "Gate slots are between 1 and 3."); switch(slot) { case 1: PlayerInfo[playerid][pGate1] = idx; case 2: PlayerInfo[playerid][pGate2] = idx; case 3: PlayerInfo[playerid][pGate3] = idx; } if(idx == 0) { format(string, sizeof(string), "%s admin %d to you deleted gate", GetPlayerNameEx(giveplayerid), slot); SendClientMessage(playerid, COLOR_WHITE, string); format(string, sizeof(string), "AdminWrong: %s admin %d to you deleted gate", GetPlayerNameEx(giveplayerid), GetPlayerNameEx(playerid), slot); SendAdminMessage(COLOR_LIGHTRED, 1, string); Log("logs/gates.log", string); } else { format(string, sizeof(string), "%s admin %d ID for gate owner you!", GetPlayerNameEx(giveplayerid), idx, slot); SendClientMessage(playerid, COLOR_WHITE, string); format(string, sizeof(string), "AdminWrong: %s gate owned %s you ID! %d. (Slot %d)", GetPlayerNameEx(giveplayerid), GetPlayerNameEx(playerid), idx, slot); SaveGates(); SendAdminMessage(COLOR_LIGHTRED, 1, string); Log("logs/gates.log", string); } return 1; }