19.05.2015, 13:10
Код:
if(strcmp(cmd, "/createteleport", true) == 0 || strcmp(cmd, "/createtp", true) == 0) { if(PlayerInfo[playerid][pAdmin] > 3) { GetPlayerName(playerid, sendername, sizeof(sendername)); new length = strlen(cmdtext); while ((idx < length) && (cmdtext[idx] <= ' ')) { idx++; } new offset = idx; new result[64]; while ((idx < length) && ((idx - offset) < (sizeof(result) - 1))) { result[idx - offset] = cmdtext[idx]; idx++; } result[idx - offset] = EOS; if(!strlen(result)) { SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /createteleport [tp name]"); return 1; } new i = sTeleports + 1; new Float:x, Float:y, Float:z, Float:angle,interior,vw; GetPlayerPos(playerid, x, y, z); GetPlayerFacingAngle(playerid, angle); interior = GetPlayerInterior(playerid); vw = GetPlayerVirtualWorld(playerid); TeleInfo[i][tpEnabled] = 1; format(TeleInfo[i][tpOwner], 256, "%s", GetName(playerid)); format(TeleInfo[i][tpName], 256, "%s", result); TeleInfo[i][TPX] = x; TeleInfo[i][TPY] = y; TeleInfo[i][TPZ] = z; TeleInfo[i][TPAngle] = angle; TeleInfo[i][tpInterior] = interior; TeleInfo[i][tpVirtualWorld] = vw; format(string, sizeof(string), "{DC0C0C}(Teleport) {FF6633}%s a creat teleportul %s.", GetName(playerid), result); ABroadCast(RED, string, 1); format(string,sizeof(string), "INSERT INTO `teleports` ( ID, Name , Owner, X, Y, Z, Angle, Interior) VALUES ( %d,'%s','%s',%f,%f,%f,%f,%d )", i, TeleInfo[i][tpName], x,y,z,angle,TeleInfo[i][tpInterior]); mysql_tquery(mysql, string, "", ""); sTeleports ++; } return 1; } if (strcmp(cmd, "/tplist", true) == 0 || strcmp(cmd, "/teleports", true) == 0) { if(PlayerInfo[playerid][pAdmin] >= 1 || PlayerInfo[playerid][pHelper] > 1) { new count = 0; new stringx[766]; format(stringx, sizeof(stringx), "Nume destinatie\tCreator\n"); for(new i = 0; i < MAX_TELEPORTS; i++) { if(TeleInfo[i][tpEnabled] == 1) { format(stringx, sizeof(stringx), "%s\n{FFFFFF}%s\t{00CC33}%s\n", stringx,TeleInfo[i][tpName],TeleInfo[i][tpOwner]); count++; } } if(count == 0) { format(stringx, sizeof(stringx), "Nume destinatie\tCreator\n{FF6633}Nu sunt teleporturi create din pacate."); } new string2[456]; format(string2, sizeof(string2), "Lista de teleportare (%d in total)", count); ShowPlayerDialog(playerid, DIALOG_TPLIST, DIALOG_STYLE_TABLIST_HEADERS, string2, stringx, "Teleport", "Cancel"); } return 1; }